Skip to content

Commit 4ad1cb1

Browse files
committed
Bug fixes. Extraneous diagnostics removed.
Be sure to run **./UpdatePlaceOrder** with your exchanges. While the bugs may be small, there is an overall improvement is removing them. Version update. Changes to be committed: modified: Base/CCXT-PlaceOrder.future modified: Base/CCXT-PlaceOrder.margin modified: Base/CCXT-PlaceOrder.spot modified: Base/CCXT-PlaceOrder.swap modified: Base/JackrabbitLocker modified: Base/JackrabbitOliverTwist modified: Base/JackrabbitRelay modified: Base/Library/JRRmimic.py modified: Base/Library/JRRsupport.py modified: Base/Library/JackrabbitProxy.py modified: Base/Library/JackrabbitRelay.py modified: Base/Library/OliverTwist-ccxt.py modified: Base/Library/OliverTwist-mimic.py modified: Base/Library/OliverTwist-oanda.py modified: Base/MIMIC-PlaceOrder modified: Base/OANDA-PlaceOrder modified: Base/PROXY-PlaceOrder modified: CODE_OF_CONDUCT.md modified: Extras/CodeProofs/MaxAsset
1 parent ebc7614 commit 4ad1cb1

19 files changed

+129
-166
lines changed

Base/CCXT-PlaceOrder.future

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def main():
160160
if relay.Order['Action'].lower()=='close':
161161
expire=0
162162
else:
163-
expire=(7*86400)
163+
expire=(31*86400)
164164
results=maxAssetsList.update(relay.Order['Asset'],json.dumps(relay.Order),expire)
165165
if results['Status']=='ErrorLimit' and relay.Order['Action']=='buy':
166166
relay.JRLog.Error("MaxAssets","maximum limit exceeded")

Base/CCXT-PlaceOrder.margin

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def main():
160160
if relay.Order['Action'].lower()=='close':
161161
expire=0
162162
else:
163-
expire=(7*86400)
163+
expire=(31*86400)
164164
results=maxAssetsList.update(relay.Order['Asset'],json.dumps(relay.Order),expire)
165165
if results['Status']=='ErrorLimit' and relay.Order['Action']=='buy':
166166
relay.JRLog.Error("MaxAssets","maximum limit exceeded")

Base/CCXT-PlaceOrder.spot

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def main():
169169
if relay.Order['Action'].lower()=='close':
170170
expire=0
171171
else:
172-
expire=(7*86400)
172+
expire=(31*86400)
173173
results=maxAssetsList.update(relay.Order['Asset'],json.dumps(relay.Order),expire)
174174
if results['Status']=='ErrorLimit' and relay.Order['Action']=='buy':
175175
relay.JRLog.Error("MaxAssets","maximum limit exceeded")

Base/CCXT-PlaceOrder.swap

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def main():
160160
if relay.Order['Action'].lower()=='close':
161161
expire=0
162162
else:
163-
expire=(7*86400)
163+
expire=(31*86400)
164164
results=maxAssetsList.update(relay.Order['Asset'],json.dumps(relay.Order),expire)
165165
if results['Status']=='ErrorLimit' and relay.Order['Action']=='buy':
166166
relay.JRLog.Error("MaxAssets","maximum limit exceeded")

Base/JackrabbitLocker

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import json
2828

2929
import JRRsupport
3030

31-
Version="0.0.0.1.1065"
31+
Version="0.0.0.1.1070"
3232
BaseDirectory='/home/JackrabbitRelay2/Base'
3333
ConfigDirectory='/home/JackrabbitRelay2/Config'
3434
LogDirectory="/home/JackrabbitRelay2/Logs"

Base/JackrabbitOliverTwist

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ import subprocess
6767
import JRRsupport
6868
import JackrabbitRelay as JRR
6969

70-
Version="0.0.0.1.1065"
70+
Version="0.0.0.1.1070"
7171
BaseDirectory='/home/JackrabbitRelay2/Base'
7272
DataDirectory='/home/JackrabbitRelay2/Data'
7373
ConfigDirectory='/home/JackrabbitRelay2/Config'

Base/JackrabbitRelay

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import json
1616

1717
import JRRsupport
1818

19-
Version="0.0.0.1.1065"
19+
Version="0.0.0.1.1070"
2020
BaseDirectory='/home/JackrabbitRelay2/Base'
2121
ConfigDirectory='/home/JackrabbitRelay2/Config'
2222
LogDirectory="/home/JackrabbitRelay2/Logs"

Base/Library/JRRmimic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class mimic:
4848
# released at exit.
4949

5050
def __init__(self,Exchange,Config,Active,DataDirectory=None):
51-
self.Version="0.0.0.1.1065"
51+
self.Version="0.0.0.1.1070"
5252

5353
self.StableCoinUSD=['USDT','USDC','BUSD','UST','DAI','FRAX','TUSD', \
5454
'USDP','LUSD','USDN','HUSD','FEI','TRIBE','RSR','OUSD','XSGD', \

Base/Library/JRRsupport.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ def mkdir(fn):
675675

676676
def Yesterday(ds=None):
677677
if ds!=None:
678-
date=datetime.datetime.strptime(date_str,'%Y-%m-%d')
678+
date=datetime.datetime.strptime(ds,'%Y-%m-%d')
679679
else:
680680
date=datetime.datetime.now()
681681
yesterday=date-datetime.timedelta(days=1)

Base/Library/JackrabbitProxy.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
class JackrabbitProxy:
5151
def __init__(self,framework=None,payload=None,exchange=None,account=None,asset=None,Usage=None):
5252
# All the default locations
53-
self.Version="0.0.0.1.1065"
53+
self.Version="0.0.0.1.1070"
5454
self.BaseDirectory='/home/JackrabbitRelay2/Base'
5555
self.ConfigDirectory='/home/JackrabbitRelay2/Config'
5656
self.DataDirectory="/home/JackrabbitRelay2/Data"

Base/Library/JackrabbitRelay.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def Success(self,f,s):
110110
class JackrabbitRelay:
111111
def __init__(self,framework=None,payload=None,exchange=None,account=None,asset=None,secondary=None,NoIdentityVerification=False,Usage=None,RaiseError=False):
112112
# All the default locations
113-
self.Version="0.0.0.1.1065"
113+
self.Version="0.0.0.1.1070"
114114
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>'
115115
self.Directories={}
116116
self.Directories['Base']='/home/JackrabbitRelay2/Base'

Base/Library/OliverTwist-ccxt.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def ReadStorehouse(idx=None,OrigOrphanList=None):
5757

5858
if idx==None:
5959
Storehouse=None
60-
WorkingStorehouse=Receiver
60+
WorkingStorehouse=f"{DataDirectory}/OliverTwist.Receiver"
6161
else:
6262
Storehouse=f"{OliverTwistData}/{idx}.Storehouse"
6363
WorkingStorehouse=Storehouse
@@ -112,7 +112,7 @@ def ReadStorehouse(idx=None,OrigOrphanList=None):
112112
# Assign a key, if not already present.
113113

114114
if 'Key' not in Orphan:
115-
Orphan['Key']=f"{time.time()*10000000:.0f}.{GetID()}"
115+
continue
116116

117117
# Only LIMIT orders are orphans, everything else is conditional
118118

@@ -324,13 +324,13 @@ def CheckTakeProfit(relay,Orphan,lowestTrade):
324324
if 'Spread' in relay.Active:
325325
if ticker['Spread']>=float(relay.Active['Spread']):
326326
s=f"excessivew spread, {Order['SellAction'].lower()} delayed, {ticker['Spread']:.5f} > {relay.Active['Spread']:.5f}"
327-
relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{units} {dir} {s}")
327+
relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{amount} {dir} {s}")
328328
return None
329329

330330
if 'Spread' in Order:
331331
if ticker['Spread']>=float(Order['Spread']):
332332
s=f"excessivew spread, {Order['SellAction'].lower()} delayed, {ticker['Spread']:.5f} > {Order['Spread']:.5f}"
333-
relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{units} {dir} {s}")
333+
relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{amount} {dir} {s}")
334334
return None
335335

336336
# print("CTP C")
@@ -347,15 +347,15 @@ def CheckTakeProfit(relay,Orphan,lowestTrade):
347347
# print("CTP D")
348348
StrikeHappened=False
349349
if dir=='long':
350-
if 'Diagnostics' in relay.Active:
351-
relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{units} {dir} Price: {price}, Bid: {ticker['Bid']}/{ticker['Spread']} TP: {tp}/{Order['TakeProfit']}, SL {sl}/{Order['StopLoss']}")
350+
# if 'Diagnostics' in relay.Active:
351+
# relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{amount} {dir} Price: {price}, Bid: {ticker['Bid']}/{ticker['Spread']} TP: {tp}/{Order['TakeProfit']}, SL {sl}/{Order['StopLoss']}")
352352

353353
if ticker['Bid']>(tp+ticker['Spread']):
354354
strikePrice=ticker['Bid']
355355
StrikeHappened=True
356356
else:
357-
if 'Diagnostics' in relay.Active:
358-
relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{abs(units)} {dir} Price: {price}, Ask: {ticker['Ask']}/{ticker['Spread']} TP: {tp}/{Order['TakeProfit']}, SL {sl}/{Order['StopLoss']}")
357+
# if 'Diagnostics' in relay.Active:
358+
# relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{abs(amount)} {dir} Price: {price}, Ask: {ticker['Ask']}/{ticker['Spread']} TP: {tp}/{Order['TakeProfit']}, SL {sl}/{Order['StopLoss']}")
359359

360360
if ticker['Ask']<(tp-ticker['Spread']):
361361
strikePrice=ticker['Ask']
@@ -430,15 +430,15 @@ def CheckStopLoss(relay,Orphan):
430430
# print("CSL D")
431431
StrikeHappened=False
432432
if dir=='long':
433-
if 'Diagnostics' in relay.Active:
434-
relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{units} {dir} Price: {price}, Bid: {ticker['Bid']}/{ticker['Spread']} TP: {tp}/{Order['TakeProfit']}, SL {sl}/{Order['StopLoss']}")
433+
# if 'Diagnostics' in relay.Active:
434+
# relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{units} {dir} Price: {price}, Bid: {ticker['Bid']}/{ticker['Spread']} TP: {tp}/{Order['TakeProfit']}, SL {sl}/{Order['StopLoss']}")
435435

436436
if ticker['Bid']<(sl-ticker['Spread']):
437437
strikePrice=ticker['Bid']
438438
StrikeHappened=True
439439
else:
440-
if 'Diagnostics' in relay.Active:
441-
relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{abs(units)} {dir} Price: {price}, Ask: {ticker['Ask']}/{ticker['Spread']} TP: {tp}/{Order['TakeProfit']}, SL {sl}/{Order['StopLoss']}")
440+
# if 'Diagnostics' in relay.Active:
441+
# relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{abs(units)} {dir} Price: {price}, Ask: {ticker['Ask']}/{ticker['Spread']} TP: {tp}/{Order['TakeProfit']}, SL {sl}/{Order['StopLoss']}")
442442

443443
if ticker['Ask']>(sl+ticker['Spread']):
444444
strikePrice=ticker['Ask']

Base/Library/OliverTwist-mimic.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def ReadStorehouse(idx=None,OrigOrphanList=None):
5555

5656
if idx==None:
5757
Storehouse=None
58-
WorkingStorehouse=Receiver
58+
WorkingStorehouse=f"{DataDirectory}/OliverTwist.Receiver"
5959
else:
6060
Storehouse=f"{OliverTwistData}/{idx}.Storehouse"
6161
WorkingStorehouse=Storehouse
@@ -110,7 +110,7 @@ def ReadStorehouse(idx=None,OrigOrphanList=None):
110110
# Assign a key, if not already present.
111111

112112
if 'Key' not in Orphan:
113-
Orphan['Key']=f"{time.time()*10000000:.0f}.{GetID()}"
113+
continue
114114

115115
# Only LIMIT orders are orphans, everything else is conditional
116116

@@ -321,13 +321,13 @@ def CheckTakeProfit(relay,Orphan,lowestTrade):
321321
if 'Spread' in relay.Active:
322322
if ticker['Spread']>=float(relay.Active['Spread']):
323323
s=f"excessivew spread, {Order['SellAction'].lower()} delayed, {ticker['Spread']:.5f} > {relay.Active['Spread']:.5f}"
324-
relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{units} {dir} {s}")
324+
relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{amount} {dir} {s}")
325325
return None
326326

327327
if 'Spread' in Order:
328328
if ticker['Spread']>=float(Order['Spread']):
329329
s=f"excessivew spread, {Order['SellAction'].lower()} delayed, {ticker['Spread']:.5f} > {Order['Spread']:.5f}"
330-
relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{units} {dir} {s}")
330+
relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{amount} {dir} {s}")
331331
return None
332332

333333
# print("CTP C")
@@ -344,15 +344,15 @@ def CheckTakeProfit(relay,Orphan,lowestTrade):
344344
# print("CTP D")
345345
StrikeHappened=False
346346
if dir=='long':
347-
if 'Diagnostics' in relay.Active:
348-
relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{units} {dir} Price: {price}, Bid: {ticker['Bid']}/{ticker['Spread']} TP: {tp}/{Order['TakeProfit']}, SL {sl}/{Order['StopLoss']}")
347+
# if 'Diagnostics' in relay.Active:
348+
# relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{units} {dir} Price: {price}, Bid: {ticker['Bid']}/{ticker['Spread']} TP: {tp}/{Order['TakeProfit']}, SL {sl}/{Order['StopLoss']}")
349349

350350
if ticker['Bid']>(tp+ticker['Spread']):
351351
strikePrice=ticker['Bid']
352352
StrikeHappened=True
353353
else:
354-
if 'Diagnostics' in relay.Active:
355-
relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{abs(units)} {dir} Price: {price}, Ask: {ticker['Ask']}/{ticker['Spread']} TP: {tp}/{Order['TakeProfit']}, SL {sl}/{Order['StopLoss']}")
354+
# if 'Diagnostics' in relay.Active:
355+
# relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{abs(units)} {dir} Price: {price}, Ask: {ticker['Ask']}/{ticker['Spread']} TP: {tp}/{Order['TakeProfit']}, SL {sl}/{Order['StopLoss']}")
356356

357357
if ticker['Ask']<(tp-ticker['Spread']):
358358
strikePrice=ticker['Ask']
@@ -425,15 +425,15 @@ def CheckStopLoss(relay,Orphan):
425425
# print("CSL D")
426426
StrikeHappened=False
427427
if dir=='long':
428-
if 'Diagnostics' in relay.Active:
429-
relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{units} {dir} Price: {price}, Bid: {ticker['Bid']}/{ticker['Spread']} TP: {tp}/{Order['TakeProfit']}, SL {sl}/{Order['StopLoss']}")
428+
# if 'Diagnostics' in relay.Active:
429+
# relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{units} {dir} Price: {price}, Bid: {ticker['Bid']}/{ticker['Spread']} TP: {tp}/{Order['TakeProfit']}, SL {sl}/{Order['StopLoss']}")
430430

431431
if ticker['Bid']<(sl-ticker['Spread']):
432432
strikePrice=ticker['Bid']
433433
StrikeHappened=True
434434
else:
435-
if 'Diagnostics' in relay.Active:
436-
relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{abs(units)} {dir} Price: {price}, Ask: {ticker['Ask']}/{ticker['Spread']} TP: {tp}/{Order['TakeProfit']}, SL {sl}/{Order['StopLoss']}")
435+
# if 'Diagnostics' in relay.Active:
436+
# relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{abs(units)} {dir} Price: {price}, Ask: {ticker['Ask']}/{ticker['Spread']} TP: {tp}/{Order['TakeProfit']}, SL {sl}/{Order['StopLoss']}")
437437

438438
if ticker['Ask']>(sl+ticker['Spread']):
439439
strikePrice=ticker['Ask']

Base/Library/OliverTwist-oanda.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def ReadStorehouse(idx=None,OrigOrphanList=None):
5757

5858
if idx==None:
5959
Storehouse=None
60-
WorkingStorehouse=Receiver
60+
WorkingStorehouse=f"{DataDirectory}/OliverTwist.Receiver"
6161
else:
6262
Storehouse=f"{OliverTwistData}/{idx}.Storehouse"
6363
WorkingStorehouse=Storehouse
@@ -109,10 +109,10 @@ def ReadStorehouse(idx=None,OrigOrphanList=None):
109109
resp=json.loads(Orphan['Response'])
110110
Orphan['Response']=resp
111111

112-
# Assign a key, if not already present.
112+
# If not key at this point, we have a problem.
113113

114114
if 'Key' not in Orphan:
115-
Orphan['Key']=f"{time.time()*10000000:.0f}.{GetID()}"
115+
continue
116116

117117
# Only LIMIT orders are orphans, everything else is conditional
118118

@@ -482,7 +482,7 @@ def CheckTakeProfit(relay,Orphan,lowestTrade):
482482
StrikeHappened=True
483483
else:
484484
if 'Diagnostics' in relay.Active:
485-
relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset}/{abs(units)} {dir} Price: {price}, Ask: {ticker['Ask']}/{ticker['Spread']} TP: {tp}/{Order['TakeProfit']}, SL {sl}/{Order['StopLoss']}")
485+
relay.JRLog.Write(f"{id} -> {cid}: {relay.Asset} {dir} Price: {price}, Bid: {ticker['Bid']}/{ticker['Spread']} TP: {tp}/{Order['TakeProfit']}")
486486

487487
# print(f"CTP C {id} -> {cid}: {relay.Asset} {dir} Price: {ticker['Ask']}, TP: {tp-ticker['Spread']:.5f} B: {price}")
488488
# print("CTP D",ticker['Ask'],(tp-ticker['Spread']),price)

Base/MIMIC-PlaceOrder

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def main():
155155
if relay.Order['Action'].lower()=='close':
156156
expire=0
157157
else:
158-
expire=(7*86400)
158+
expire=(31*86400)
159159
results=maxAssetsList.update(relay.Order['Asset'],json.dumps(relay.Order),expire)
160160
if results['Status']=='ErrorLimit' and relay.Order['Action']=='buy':
161161
relay.JRLog.Error("MaxAssets","maximum limit exceeded")

Base/OANDA-PlaceOrder

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def main():
244244
if relay.Order['Action'].lower()=='close':
245245
expire=0
246246
else:
247-
expire=(7*86400)
247+
expire=(31*86400)
248248
results=maxAssetsList.update(relay.Order['Asset'],json.dumps(relay.Order),expire)
249249
if results['Status']=='ErrorLimit' and relay.Order['Action']=='buy':
250250
relay.JRLog.Error("MaxAssets","maximum limit exceeded")

Base/PROXY-PlaceOrder

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def main():
303303
if relay.Order['Action'].lower()=='close':
304304
expire=0
305305
else:
306-
expire=(7*86400)
306+
expire=(31*86400)
307307
results=maxAssetsList.update(relay.Order['Asset'],json.dumps(relay.Order),expire)
308308
if results['Status']=='ErrorLimit' and relay.Order['Action']=='buy':
309309
relay.JRLog.Error("MaxAssets","maximum limit exceeded")

0 commit comments

Comments
 (0)