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='