Skip to content
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

Bitmex: TBP Logic #986

Open
asfbhero opened this issue Aug 13, 2019 · 5 comments
Open

Bitmex: TBP Logic #986

asfbhero opened this issue Aug 13, 2019 · 5 comments

Comments

@asfbhero
Copy link

I can’t get tbp to work as it should. Now that I’ve got things working in terms of trading it’s now time to work on risk management.

As of now it looks like the bot doesn’t understand if tbp held should be applied to the bid side or the ask side. I imagine this could be fixed by having the bot query the bitmex api and see if the net position is long or short, then hold that side.

Coding this seems a bit over my head but I’ll give it a shot, @ctubio can you point me in the right direction and I’ll poke at it after work tonight.

@Camille92
Copy link
Contributor

Are you referring to #976 ?

If not TBP is calculated with the ewma !
Anyways I don't think net position is a good help here.

@asfbhero
Copy link
Author

asfbhero commented Aug 16, 2019

I don’t think it’s what was discussed there.

Say I’m using manual mode with 1 btc in margin. I want the bot to stop buying when I’ve spent 50% of my margin on buys and stop selling when I’ve used 50% of my margin on sells.

The problem is that since the margin is in bitcoin, the bot only sees that Bitcoin held has gone down, regardless if I’ve used that bitcoin margin to accumulate long or short positions in bitcoin.

If I’m long eos/xbt it’s fine, because I’m net short bitcoin, having used 50% of my margin buying eos and selling xbt, so it will set the bid to tbp held.

But if I’m net short eos/btc, having used 50% of my margin buying btc and selling eos, it will still see that I have 50% of the bitcoin in my margin account, and it will set the bid to tbp held.

So no matter if you have too many Buys or too many Sells, the bot will only stop buying, and never stop selling.

It’s not that tbp is wrong, it’s that no matter what side of the trade you are on it always thinks that you are short the margin currency.

@MiningInMySleep
Copy link

MiningInMySleep commented Aug 22, 2019

Running into a possibly related issue where the bot, upon running out of margin, won't recognize that and proceeds to spam orders (which get "insufficient margin" error) until IP banned.

@asfbhero
Copy link
Author

asfbhero commented Aug 22, 2019 via email

@ctubio
Copy link
Owner

ctubio commented Aug 24, 2019

lemme reread all comments slowly again to see if i can understand it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants