-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autostop and lag issues #1
Comments
Let me know if you're open to pull requests, I'd be happy to contribute. |
Hey there, thanks for the feedback. I may have broken some things while updating this at some point and as an civilian of the United States I don't have access to bitmex anymore, so this is no longer in development by myself. Also I tend to feel that bitmex is kind of shady so I moved to Deribit before they started enforcing KYC and now I am on FTX while that lasts. Interesting find with the lag, it could be the case. Here is some code that I use for FTX that seems to work really well:
Maybe there is an answer in there. Regarding the autostop, strange , i think you need to just change that to |
Great work with the library! Is it still in use/active development?
I found a couple bugs in today's testing, I'll list them below rather than opening multiple issues:
python3 ./bmcli.py -a 0.001 0.005 25
, constantly reports lag errors as such:[+] bitmex is lagging 86399 second(s)
[+] Websocket is lagging 86399 seconds.
This is exactly 24h so I'm assuming that the
ticker['timestamp']
is reporting set to 1 day in the future? I didn't do extensive testing yet, just commented everything belowif self.lag >= 30:
in bitmex_ws.py.2.1) I'm running into some issues with the autostop function (great idea BTW). The trailing stop part seems to work fine, but the stop loss does not. More specifically, after running
python3 ./bmcli.py -a 0.001 0.001 20
and the stop loss threshold being reached, this is the output:[+] [ Params: 0.001|0.001 | 25.0] | [ High: 36924|Diff: 26.91399999999703 ]
[+] [ Unrealized PNL: -5e-08 | Realized PNL: -3.7e-07 | Balance: xxxxxxxx]
[+] [ 2021-01-16 15:29:08, Position: 1 | Entry Price: 36914.0 ]
[+] quote {'symbol': 'XBTUSD', 'id': 8796313950, 'side': 'Sell', 'size': 730214, 'price': 36860.5}
[!] Error: 'bid'
The script exits immediately after that and does not execute any sales.
2.2) The second, minor issue I observed with the autostop function is that the script doesn't terminate when autostop function successfully closes a position using the trailing stop and I need to use Ctrl+C combination to escape manually.
The text was updated successfully, but these errors were encountered: