diff --git a/Base/JackrabbitLocker b/Base/JackrabbitLocker index 36340c3..11e13b0 100755 --- a/Base/JackrabbitLocker +++ b/Base/JackrabbitLocker @@ -28,7 +28,7 @@ import json import JRRsupport -Version="0.0.0.1.1005" +Version="0.0.0.1.1010" BaseDirectory='/home/JackrabbitRelay2/Base' ConfigDirectory='/home/JackrabbitRelay2/Config' LogDirectory="/home/JackrabbitRelay2/Logs" diff --git a/Base/JackrabbitOliverTwist b/Base/JackrabbitOliverTwist index eb793a4..37f5299 100755 --- a/Base/JackrabbitOliverTwist +++ b/Base/JackrabbitOliverTwist @@ -67,7 +67,7 @@ import subprocess import JRRsupport import JackrabbitRelay as JRR -Version="0.0.0.1.1005" +Version="0.0.0.1.1010" BaseDirectory='/home/JackrabbitRelay2/Base' DataDirectory='/home/JackrabbitRelay2/Data' ConfigDirectory='/home/JackrabbitRelay2/Config' diff --git a/Base/JackrabbitRelay b/Base/JackrabbitRelay index fc0a5bc..4f8d5cc 100755 --- a/Base/JackrabbitRelay +++ b/Base/JackrabbitRelay @@ -16,7 +16,7 @@ import json import JRRsupport -Version="0.0.0.1.1005" +Version="0.0.0.1.1010" BaseDirectory='/home/JackrabbitRelay2/Base' ConfigDirectory='/home/JackrabbitRelay2/Config' LogDirectory="/home/JackrabbitRelay2/Logs" diff --git a/Base/LauncherOliverTwist b/Base/LauncherOliverTwist index a236b50..7fe2b65 100755 --- a/Base/LauncherOliverTwist +++ b/Base/LauncherOliverTwist @@ -6,7 +6,10 @@ cd $BaseDir while true ; do $BaseDir/JackrabbitOliverTwist $@ - sleep 180 + echo + echo REST + echo + sleep 60 done diff --git a/Base/Library/JRRmimic.py b/Base/Library/JRRmimic.py index f530477..75d450f 100755 --- a/Base/Library/JRRmimic.py +++ b/Base/Library/JRRmimic.py @@ -34,18 +34,21 @@ class mimic: # Account ID and bearer token will be in Active. Logging framework and # identity are embedded here as well. - # This framework doesn't need an API/Secret methodology. It must emulate both cryptocurrency exchanges - # and forex brokers reasonable well. + # This framework doesn't need an API/Secret methodology. It must + # emulate both cryptocurrency exchanges and forex brokers reasonable + # well. # Special situation: - # This class must exclusive lock at init to prevent corruption of simulated wallet. If thos were a - # standalone server, like locker, thn the method of usage would beserialized.Two processes can NOT - # manipulate a wallet at the same time without corrupting the position table and balance. The lock is - # placed in init and released at exit. + # This class must exclusive lock at init to prevent corruption of + # simulated wallet. If this were a standalone server, like locker, + # then the method of usage would be serialized. Two processes can + # NOT manipulate a wallet at the same time without corrupting the + # position table and balance. The lock is placed in init and + # released at exit. def __init__(self,Exchange,Config,Active,DataDirectory=None): - self.Version="0.0.0.1.1005" + self.Version="0.0.0.1.1010" self.StableCoinUSD=['USDT','USDC','BUSD','UST','DAI','FRAX','TUSD', \ 'USDP','LUSD','USDN','HUSD','FEI','TRIBE','RSR','OUSD','XSGD', \ @@ -278,7 +281,8 @@ def UpdateWallet(self,action,asset,amount,price,fee_rate=0): else: # long actualAmount=amount-dust - # Need to get the actual price of the asset at THIS time, not the price the user wwanted. + # Need to get the actual price of the asset at THIS time, not the + # price the user wwanted. ticker=self.Broker.GetTicker(symbol=asset) if actualAmount<0: @@ -286,7 +290,8 @@ def UpdateWallet(self,action,asset,amount,price,fee_rate=0): else: actualPrice=max(ticker['Bid'],ticker['Ask'])+ticker['Spread'] # Long - # If the exchange is Binance, these values are going to be expressed in QUOTE currency, NOT base + # If the exchange is Binance, these values are going to be + # expressed in QUOTE currency, NOT base minimum,mincost=self.Broker.GetMinimum(symbol=asset) if self.ForceQuote==True: @@ -348,8 +353,12 @@ def UpdateWallet(self,action,asset,amount,price,fee_rate=0): return 'Nothing to sell' if base in self.Wallet['Wallet'] and self.Wallet['Wallet'][base]==0: return 'Nothing to sell' + if abs(actualAmount)>abs(self.Wallet['Wallet'][base]): + return 'Not enough balance!' + + # Check if the base currency is present in the base currency + # wallet and the amount to sell is available - # Check if the base currency is present in the base currency wallet and the amount to sell is available if quote in self.Wallet['Wallet'] and self.Wallet['Wallet'][quote]>=0: # Add the total proceeds minus fees to the quote currency balance # quote MUST be >=0. @@ -362,6 +371,11 @@ def UpdateWallet(self,action,asset,amount,price,fee_rate=0): elif self.Wallet['Wallet'][base]>0 and actualAmount<0 \ or self.Wallet['Wallet'][base]<0 and actualAmount>0: self.Wallet['Wallet'][base]+=actualAmount + + # Strictly spot only + if self.NoLiquidation==True and self.Wallet['Wallet'][base]<0: + self.Wallet['Wallet'][base]=0 + # Update fee balance fee = round(abs(actualAmount) * actualPrice * fee_rate,8) if 'Fees' in self.Wallet['Wallet']: diff --git a/Base/Library/JackrabbitProxy.py b/Base/Library/JackrabbitProxy.py index cda4e11..c16443f 100755 --- a/Base/Library/JackrabbitProxy.py +++ b/Base/Library/JackrabbitProxy.py @@ -50,7 +50,7 @@ class JackrabbitProxy: def __init__(self,framework=None,payload=None,exchange=None,account=None,asset=None,Usage=None): # All the default locations - self.Version="0.0.0.1.1005" + self.Version="0.0.0.1.1010" self.BaseDirectory='/home/JackrabbitRelay2/Base' self.ConfigDirectory='/home/JackrabbitRelay2/Config' self.DataDirectory="/home/JackrabbitRelay2/Data" diff --git a/Base/Library/JackrabbitRelay.py b/Base/Library/JackrabbitRelay.py index 2b89b91..2a1b5cc 100755 --- a/Base/Library/JackrabbitRelay.py +++ b/Base/Library/JackrabbitRelay.py @@ -110,7 +110,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,RaiseError=False): # All the default locations - self.Version="0.0.0.1.1005" + self.Version="0.0.0.1.1010" self.NOhtml='NO!

NO!

' self.Directories={} self.Directories['Base']='/home/JackrabbitRelay2/Base' diff --git a/Base/Library/OliverTwist-oanda.py b/Base/Library/OliverTwist-oanda.py index 1c86a98..95d6d4c 100755 --- a/Base/Library/OliverTwist-oanda.py +++ b/Base/Library/OliverTwist-oanda.py @@ -167,6 +167,7 @@ def GetHighestLowest(OrphanList): continue price=float(order['Price']) +# print(f"{order['ID']:8} {lPrice:.5f} < {hPrice:.5f}") if price {cid}: {relay.Asset}/{abs(units)} {dir} Price: {price}, Ask: {ticker['Ask']}/{ticker['Spread']} TP: {tp}/{Order['TakeProfit']}, SL {sl}/{Order['StopLoss']}") -# print(f"CTP C {id} -> {cid}: {relay.Asset} {dir} Price: {ticker['Ask']}, TP: {tp-ticker['Spread']:.5f} {price}") +# print(f"CTP C {id} -> {cid}: {relay.Asset} {dir} Price: {ticker['Ask']}, TP: {tp-ticker['Spread']:.5f} B: {price}") # print("CTP D",ticker['Ask'],(tp-ticker['Spread']),price) if ticker['Ask']<(tp-ticker['Spread']): @@ -670,7 +671,7 @@ def OrderProcessor(osh): # Check stop loss. If a margin strike occured, force the stoploss # print("OP D") if lowestTrade['Order']['Direction'].lower()=='long': - DeleteKey=CheckStopLoss(relay,lowestestTrade,MarginStrike) + DeleteKey=CheckStopLoss(relay,lowestTrade,MarginStrike) else: DeleteKey=CheckStopLoss(relay,highestTrade,MarginStrike) diff --git a/Extras/OliverTwist/OliverTwistEquity b/Extras/OliverTwist/OliverTwistEquity index 723b239..7da9ee5 100755 --- a/Extras/OliverTwist/OliverTwistEquity +++ b/Extras/OliverTwist/OliverTwistEquity @@ -49,12 +49,6 @@ exchange=data[1] account=data[2] pair=data[3] -if 'mimic' in sys.argv[2].lower(): - asset=data[4] - pair=data[4] -else: - asset=data[3][:3]+'/'+data[3][3:] - lines=JRRsupport.ReadFile(sys.argv[2]).strip().split('\n') for line in lines: @@ -85,7 +79,7 @@ if ih=='h': else: fn=chartDir+f'Equity.{exchange}.{account}.{pair}.png' -ts=f"OliverTwist Equity Curve: {account} - {asset}" +ts=f"OliverTwist Equity Curve: {account} - {pair}" fig1=ps.make_subplots(specs=[[{"secondary_y":False}]])