Skip to content

Commit

Permalink
Bug fix addressing issue with TradingView using overlapping asset nam…
Browse files Browse the repository at this point in the history
…es for different markets when using {{ticker}} has been fixed.

TradingView symbol BTCUSDT can map to BTC/USDT (spot) or BTC/USDT:USDT (futures). Relay is now able to figure out which market you
want.

Version update.

Changes to be committed:
	modified:   Base/JackrabbitLocker
	modified:   Base/JackrabbitOliverTwist
	modified:   Base/JackrabbitRelay
	modified:   Base/Library/JackrabbitRelay.py
	modified:   Extras/CodeProofs/oandaOpenTrades
	modified:   Extras/TV2Exchange
  • Loading branch information
rapmd73 committed Nov 6, 2023
1 parent 8d16d26 commit c3ae919
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Base/JackrabbitLocker
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import json

import JRRsupport

Version="0.0.0.1.465"
Version="0.0.0.1.470"
BaseDirectory='/home/JackrabbitRelay2/Base'
ConfigDirectory='/home/JackrabbitRelay2/Config'
LogDirectory="/home/JackrabbitRelay2/Logs"
Expand Down
2 changes: 1 addition & 1 deletion Base/JackrabbitOliverTwist
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import subprocess
import JRRsupport
import JackrabbitRelay as JRR

Version="0.0.0.1.465"
Version="0.0.0.1.470"
BaseDirectory='/home/JackrabbitRelay2/Base'
DataDirectory='/home/JackrabbitRelay2/Data'
ConfigDirectory='/home/JackrabbitRelay2/Config'
Expand Down
2 changes: 1 addition & 1 deletion Base/JackrabbitRelay
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import json

import JRRsupport

Version="0.0.0.1.465"
Version="0.0.0.1.470"
BaseDirectory='/home/JackrabbitRelay2/Base'
ConfigDirectory='/home/JackrabbitRelay2/Config'
LogDirectory="/home/JackrabbitRelay2/Logs"
Expand Down
11 changes: 8 additions & 3 deletions Base/Library/JackrabbitRelay.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def Success(self,f,s):
class JackrabbitRelay:
def __init__(self,framework=None,payload=None,exchange=None,account=None,asset=None,secondary=None,NoIdentityVerification=False,Usage=None):
# All the default locations
self.Version="0.0.0.1.465"
self.Version="0.0.0.1.470"
self.NOhtml='<html><title>NO!</title><body style="background-color:#ffff00;display:flex;weight:100vw;height:100vh;align-items:center;justify-content:center"><h1 style="color:#ff0000;font-weight:1000;font-size:10rem">NO!</h1></body></html>'
self.BaseDirectory='/home/JackrabbitRelay2/Base'
self.ConfigDirectory='/home/JackrabbitRelay2/Config'
Expand Down Expand Up @@ -408,8 +408,13 @@ def TradingViewRemap(self):
self.JRLog.Error("TradingView Remap",f"Can't read symbol map for {self.Exchange}")

TVlist=json.loads(raw)
if self.Asset in TVlist:
NewPair=TVlist[self.Asset]
if 'Market' in self.Order and self.Order['Market'].lower()!='spot':
srchAsset=self.Asset+':'+self.Order['Market'].lower()
else:
srchAsset=self.Asset

if srchAsset in TVlist:
NewPair=TVlist[srchAsset]
else:
self.JRLog.Write('|- Pair not in symbol file')
return
Expand Down
1 change: 0 additions & 1 deletion Extras/CodeProofs/oandaOpenTrades
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ oo=relay.GetOpenTrades(symbol=asset)

tpnl=0
for o in oo:
print(o)
iu=int(o['currentUnits'])
price=float(o['price'])
upl=float(o['unrealizedPL'])
Expand Down
5 changes: 4 additions & 1 deletion Extras/TV2Exchange
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ if relay.GetFramework()=='oanda':
elif relay.GetFramework()=='ccxt':
for cur in markets:
p=markets[cur]
tv=p['id'].replace('/','').replace('-','').replace(':','')
if 'type' in p and p['type'].lower()!='spot':
tv=p['id'].replace('/','').replace('-','').replace(':','')+':'+p['type'].lower()
else:
tv=p['id'].replace('/','').replace('-','').replace(':','')
ns=p['symbol']
TradingView[tv]=ns

Expand Down

0 comments on commit c3ae919

Please sign in to comment.