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.33k stars 820 forks source link

[New strategy for BitMex] Funding scalping #976

Open Camille92 opened 5 years ago

Camille92 commented 5 years ago

Hi all, I'm back,

I think no one thought about that before, but I think it can be an awesome low-risk/high reward strategy.

BitMex funding is calculated every 8 hours and is paid peer-to-peer depending on the side the future market is going in comparison to the "real" exchange market. If BitMex price is above the exchange price, a fee will be paid from btc borrowers to btc lenders (longs to shorts). If BitMex price is under the exchange price, the contrary occurs.

The rate varies between 0.03% and 0.3% per day, and you make 0.025% on all maker trades. And that's without leverage.

I think we can hack that system for our own profit 😈.

If we buy 2-3 minutes before the 8 hours mark and sell 1mn after, we take a very small risk of being exposed only a few minutes to the market and make a bit of money each time.

With a bit of leverage like 3-5, this strategy on its own starts to be very interesting.

Anyone looking to incorporate it?

Have a nice day,

Camille

asfbhero commented 5 years ago

Seems interesting, I'd give it a try.

Camille92 commented 5 years ago

Nice, keep me updated of your advance.

We need to get the funding for ETH/USD or for BTC/USD it's displayed on the website.

It's on the API under "funding", and set a time in minutes before funding for when to start the action.

If funding is positive, TBP = -1 Is funding is negative, TBP= 1.

I think there's already a feature about leverage no ?

asfbhero commented 5 years ago

Yeah, leverage is already in there, and works. The problem is that the bot still doesn't know the difference between pings and pongs on bitmex. I'm pretty sure what's happening is that the FV is wrong, and I can't figure out how to fix it. I can't make the FV get in between the bid and the ask, which results in the account getting emptied in any kind of trend.

When the FV is at the bid you will buy until there is nothing left in the account, when the FV is at the ask you will sell until there is nothing left in the account. I think we need to fix this before working on anything else.

Camille92 commented 5 years ago

Ok that's something to fix, it sounds like a rounding error, was it not fixed there? https://github.com/ctubio/Krypto-trading-bot/issues/971

In this particular case, you don't really need FV or to play with pings and pongs. Just need to set TBP to -1 or 1, with a pdiv of 0. A width of 0.0001, best width check-on should do the trick.

The bot should only buy (or sell) a few minutes before the funding and sell (or buy back)everything just after.

asfbhero commented 5 years ago

What that seemed to do was move the fv from the ask to the bid, so if the market moves down it just keeps buying until tbp is hit (which also has been acting weird, if you buy a bunch, it holds the ask side, not the bid).

On Wed, Aug 7, 2019 at 7:40 AM Camille92 notifications@github.com wrote:

Ok that's something to fix, it sounds like a rounding error, was it not fixed there? #971 https://github.com/ctubio/Krypto-trading-bot/issues/971

In this particular case, you don't really need FV or to play with pings and pongs. Just need to set TBP to -1 or 1, with a pdiv of 0. A width of 0.0001, best width check-on should do the trick.

The bot should only buy (or sell) a few minutes before the funding and sell (or buy back)everything just after.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ctubio/Krypto-trading-bot/issues/976?email_source=notifications&email_token=ABTMUZDUJ6DOMVAHTGOFEU3QDKYCFA5CNFSM4IJKFDV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3YDRFI#issuecomment-519059605, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTMUZAKM2MIEZP6ENEV2HTQDKYCFANCNFSM4IJKFDVQ .

Camille92 commented 5 years ago

I'm on holidays so I didn't try it myself, but this strategy can only work for ETH/USD and BTC/USD at BitMex. Is FV having a problem for those pairs?

asfbhero commented 5 years ago

I believe it was an issue there as well.

Sent from my iPhone

On Aug 7, 2019, at 10:04 AM, Camille92 notifications@github.com wrote:

I'm on holidays so I didn't try it myself, but this strategy can only work for ETH/USD and BTC/USD at BitMex. Is FV having a problem for those pairs?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.