5ymph0en1x/SyBrain

websocket issue after entering position

caressgents opened this issue · 8 comments

After entering a position on a test account, ran for a bit, then shut down due to the following:

0000007275 - Last Fair Price: 9725.59 - Position Taken: 0 - Balance: 2006557 Average Fair Price Variation: 0.0011400000000012368 - Last Variation: -0.009699999999993452 - Last Fair Price: 9724.62 - Position Taken: 0 - Balance: 2006557 Average Fair Price Variation: -0.006239999999999782 - Last Variation: -0.04290000000000873 - Last Fair Price: 9720.33 - Position Taken: 0 - Balance: 2006557 Checking OrderBook... Sell Side: 5442394 - Buy Side: 84589 Go Sell ! Balance before: 2006557 list index out of range This is the end ! Traceback (most recent call last): File "sybrain.py", line 367, in <module> bmex() File "sybrain.py", line 276, in bmex while ws_bmex.ws.sock.connected: AttributeError: 'NoneType' object has no attribute 'connected'

Any ideas?

Also receiving the following

Average Fair Price Variation: 0.005049999999999272 - Last Variation: 0.012799999999988359 - Last Fair Price: 9694.63 - Position Taken: 0 - Balance: 2009176 Checking OrderBook... Sell Side: 272259 - Buy Side: 2981885 Go Buy ! Balance before: 2009176 400 Bad Request: {'error': {'message': 'Invalid ordType for execInst', 'name': 'HTTPError'}} This is the end ! Traceback (most recent call last): File "sybrain.py", line 367, in <module> bmex() File "sybrain.py", line 276, in bmex while ws_bmex.ws.sock.connected: AttributeError: 'NoneType' object has no attribute 'connected'

@5ymph0en1x

The second error where it's "invalid ordtype" only happens when the bot tries to go long or "GO BUY !"

Hello !

2 questions :

Did you try to modify the order type (for example, from market to limit) sent to BitMEX ?

Have you replaced test=False by test=True at line 31 : client = bitmex.bitmex(test=False, api_key=API_key_bmex_test, api_secret=API_secret_bmex_test) for the algo to trade the test net ?

Found the issue, there was a comment on the market order line.

Have let it run for quite some time, the only thing I've noticed it do is learn to do exactly the opposite of what the market does, LOL.

Have you adjusted any parameters, or found any updates to run more efficiently?

This is my first go at any deep learning strategy, so it's a bit over my head - even with the research into the build you based the strategy off of.

Looking through it, I don't see many options to change parameters for order types, when to enter, when to stop out, or even the base reasoning the algo comes to the conclusion of when to enter.

Each test account I've run it on, as is, has done not much but bleed balances.

I really am interested in theory behind it, but kind of roadblocked at the moment.

Any suggestions or variables to play around with to test different entry/exit/stop, and learn a bit more into WHY it decides to enter when it does?

Thanks! Happy to donate towards further development, or even help integrating in my currently profitable private algo repo, that only tends to get stuck in high volatility, if we can find a solution to learn when to enter and when to drop properly, and eliminate market orders to use limit only.

If this makes sense, of course.

Would be happy to discuss directly, even share my private repo for our current algo, to see if you've got any unique ideas that we could implement/test. Do you use telegram? If so, shoot me your username if interested at all in potentially collaborating a bit deeper on cross utilizing M/L with our current algo.

Thanks again for all the help, regardless! Definitely interesting stuff on the side of M/L & D/L. @5ymph0en1x

Thanks for your useful comment !

You can alter the entry logic by modifying values from line 373 to 388 in sybrain.py for example.

I'll be more than happy to discuss directly and collaborate on your current algo.
telegram username : Symphoenix

Best regards
@caressgents

@5ymph0en1x hehe, there are only 367 lines of code in sybrain.py :-p

Typo?

Oh, and I also messaged you on telegram! Looking forward to hearing back!

My bad, I meant line 330 -> 345...

@5ymph0en1x Great work btw. I have been testing it, however I couldnt make it work with limit orders. Anyidea why limit orders are not working. Market fees could simply eat up.