From 31a9909fbcea2d7b7eecce1a7eeef1ee7aac2254 Mon Sep 17 00:00:00 2001 From: Rose Heart Date: Sun, 14 Apr 2024 15:21:57 +0000 Subject: [PATCH] Bug fixed in Mimic ReduceOnly checks. Changes to be committed: modified: Base/Library/JRRmimic.py modified: Base/Library/JackrabbitRelay.py --- Base/Library/JRRmimic.py | 10 +++------- Base/Library/JackrabbitRelay.py | 5 ++++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Base/Library/JRRmimic.py b/Base/Library/JRRmimic.py index 0f260e2..d1eca32 100644 --- a/Base/Library/JRRmimic.py +++ b/Base/Library/JRRmimic.py @@ -479,14 +479,10 @@ def PlaceOrder(self,**kwargs): self.Wallet['Wallet'][base]=0 # Handle ReduceOnly. If ReduceOnly is is payload, block all flipping altogether on all sides. - if ro==True: - if amount<0 and self.Wallet['Wallet'][base]>0 \ - or amount>0 and self.Wallet['Wallet'][base]<0: + if ro==True and self.Wallet['Wallet'][base]!=0: + if (amount<0 and self.Wallet['Wallet'][base]>0) \ + or (amount>0 and self.Wallet['Wallet'][base]<0): return 'Position direction flipping disabled, close first' - elif abs(amount)>abs(self.Wallet['Wallet'][base]): - amount=self.Wallet['Wallet'][base] - - # Handle long/short flipping result=self.UpdateWallet(action,pair,amount,price,Fee) diff --git a/Base/Library/JackrabbitRelay.py b/Base/Library/JackrabbitRelay.py index 8c33dd1..41a8c91 100755 --- a/Base/Library/JackrabbitRelay.py +++ b/Base/Library/JackrabbitRelay.py @@ -713,7 +713,10 @@ def Login(self): elif self.Framework=='mimic': self.Broker=JRRmimic.mimic(self.Exchange,self.Config,self.Active,DataDirectory=self.DataDirectory) - self.Timeframes=list(self.Broker.timeframes.keys()) + if self.Broker.timeframes!=None: + self.Timeframes=list(self.Broker.timeframes.keys()) + else: + self.Timeframes=self.Broker.timeframes self.Markets=self.Broker.Markets # Get the market list from the exchange