Skip to content

Commit

Permalink
Bug fixed in Mimic ReduceOnly checks.
Browse files Browse the repository at this point in the history
Changes to be committed:
	modified:   Base/Library/JRRmimic.py
	modified:   Base/Library/JackrabbitRelay.py
  • Loading branch information
rapmd73 committed Apr 14, 2024
1 parent ad3120c commit 31a9909
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
10 changes: 3 additions & 7 deletions Base/Library/JRRmimic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 4 additions & 1 deletion Base/Library/JackrabbitRelay.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 31a9909

Please sign in to comment.