ctubio / Krypto-trading-bot

Self-hosted crypto trading bot (automated high frequency market making) written in C++
https://127.0.0.1:3000
Other
3.35k stars 820 forks source link

Bitmex Only Limit Order Size To XBT Available On Side With Accumulated Position #994

Open asfbhero opened 5 years ago

asfbhero commented 5 years ago

I'm essentially trying to accomplish what TBPValue would do if percentages worked on Margin exchanges as they do on cash accounts.

I am able to get into winning trades without much of an issue, however, since XBT available will continue to go down as more and more leverage is added (buying more and more in an uptrend and selling more and more into a downtrend), when in a winning trade, both the bidsize and the ask size will decrease as margin available decreases.

Want I want to have happen is, if I'm long XBT/USD, and XBT available decreases, I only want the bid size to decrease along with XBT avail, not the ask size.

If I'm short and XBT available decreases, I only want the ask size to decrease along with XBT available.

This should allow for leverage not to get out of control, and turn large winners into losers. I think it would greatly help out anyone trying to use this on Bitmex.

asfbhero commented 5 years ago

@ctubio Where is the code that limits order size to available balance? The changes I've been making haven't worked, which if I was modifying the correct code it should. Clearly I'm barking up the wrong tree, and I've found that I can only get free coding help from my manager like once a month before he gets bored and I have to wait another month for him to become interested again lol.

nonkreon commented 4 years ago

@asfbhero are you getting the same thing I'm getting here: bitmexkrypto I have 0.1XBT in my account. Each contract is supposed to be 1USD, but the bot tries to sell 1XBT? It's my first time trying to get into bitmex, I'm not sure if I understand correctly the bitmex situation and what our bot is trying to do

cryp2owl commented 4 years ago

try doing it on Snapex instead, or Binance futures. I think it'll work in there.

nonkreon commented 4 years ago

thank you for your response @cryp2owl , how do you configure K.sh for Snapex or binance futures? I cannot find the API_EXCHANGE files, I checked your fork but that seems to be even with carles', can you commit the exchange config files for those exchanges?

nonkreon commented 4 years ago

@asfbhero i solved my problem by opening a ticket with bitmex, apparently something else wrong with my account.

But there's another problem @ctubio , the bot only shorts and never closes the short in xbtusd on bitmex! Even the holdings only show the xbt and not the USD

nonkreon commented 4 years ago

@asfbhero i solved my problem by opening a ticket with bitmex, apparently something else wrong with my account.

But there's another problem @ctubio , the bot only shorts and never closes the short in xbtusd on bitmex! Even the holdings only show the xbt and not the USD

OK apparently it could bid if i pull the TBP limits from 0 to 100, but I still don't understand relative to what the bot takes positions on bitmex, for example when it 'sells' the quote currency stays at 0 and as it buys the base currency stays the same... from what i figure the only way to use bitmex is to turn technical analysis to manual, turn it off, and just be a hardcore market maker right?

eniware-org commented 3 years ago

I started to dab into BITFINEX_MARGIN and found this thread. It looks like the margin trading TBP is still a mess... UP!