Skip to content

Commit

Permalink
Bug fixes, verification of SSL for multi-process functionality.
Browse files Browse the repository at this point in the history
Changes to be committed:
	modified:   Base/Library/JackrabbitRelay.py
	modified:   Extras/CodeProofs/ForkTest
	modified:   requirements.txt
  • Loading branch information
rapmd73 committed Dec 26, 2023
1 parent ff937ff commit 38622ef
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Base/Library/JackrabbitRelay.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,8 @@ def GetTicker(self,**kwargs):

def GetOrderBook(self,**kwargs):
self.RotateKeys()
self.EnforceRateLimit()
self.Results=self.Broker.GetOrderBook(**kwargs)
self.EnforceRateLimit()
return self.Results

# Get open orders
Expand Down
36 changes: 24 additions & 12 deletions Extras/CodeProofs/ForkTest
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,41 @@ import sys
sys.path.append('/home/GitHub/JackrabbitRelay/Base/Library')
import os
import time
import json
import random

import JRRsupport
import JackrabbitRelay as JRR

if __name__=='__main__':
interceptor=JRRsupport.SignalInterceptor(IsMain=True)
else:
interceptor=JRRsupport.SignalInterceptor(IsMain=False)
interceptor=JRRsupport.SignalInterceptor()
relay=None

def RandoSleeper(*args,**kwargs):
try:
relay=JRR.JackrabbitRelay(exchange=args[0],account=args[1],asset=args[2])
ticker=relay.GetTicker(symbol=args[2])

def RandoSleeper():
t=random.randint(1,20)
print(f"{os.getppid()}/{os.getpid()}: {interceptor.WhoAmI()} sleeping {t} seconds")
time.sleep(t)
print(f"{os.getppid()}/{os.getpid()}: {interceptor.WhoAmI()} {args[2]} {ticker}")
except Exception as e:
print(f"{os.getppid()}/{os.getpid()}: {interceptor.WhoAmI()} {e}")

def main():
relay=JRR.JackrabbitRelay()
if relay.GetArgsLen() > 2:
exchangeName=relay.GetExchange()
account=relay.GetAccount()
else:
print("An exchange, (sub)account, and an asset must be provided.")
sys.exit(1)

print(f"Parent: {os.getpid()}, {interceptor.AnyTriggered()}")
RandoSleeper()

for i in range(100):
interceptor.StartProcess(RandoSleeper)
for asset in relay.GetMarkets():
interceptor.StartProcess(RandoSleeper,args=[exchangeName,account,asset])

while interceptor.GetChildren()>10:
l=interceptor.GetChildren()
print(f"{i}/{l} {interceptor.AnyTriggered()}")
#print(f"{asset}/{l} {interceptor.AnyTriggered()}")
if l==0:
break
time.sleep(1)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
psutil
requests
plotly
kaleido
pandas
numpy
ccxt
Expand Down

0 comments on commit 38622ef

Please sign in to comment.