FinalBuild-Studio / binance-premium-bot

Freedom of wealth.
MIT License
5 stars 5 forks source link

Add automatic arbitrage feature #1

Closed GiantBabyCorn closed 2 years ago

GiantBabyCorn commented 2 years ago

There are some potential to automate arbitrage using partial collateral. And the trades should be possible to be processed at the same time that this bot is opening funding-fee earning positions.

The taker fee in Binance USD-M future trading are 0.04%/0.03% for USDT/BUSD pair. That is, if we open some hedge position when the price spread goes to +0.08%, and close them when it goes to -0.08%. We can make 0.02% profit for this trading.

For example, If we open an 1.0 ETHUSDT-LONG and an 1.0 ETHBUSD-SHORT positions at:

pair ask price bid price
ETHUSDT 1,000 -
ETHBUSD - 1,000.8

Then close them at:

pair ask price bid price
ETHUSDT - 2,001.6
ETHBUSD 2,000.0 -

The PnL on both trades will be:

ETHUSDT: 2,001.6 - 1,000 - 2,001.6 0.04% - 1,000 0.04% = + 1,000.39936 ETHBUSD: 1,000.8 - 2,000.0 - 1,000.8 0.03% - 2,000.0 0.03% = - 1,000.10024

We made 1,000.39936 - 1,000.10024 = 0.29912 usd profit on this trade finally.

michael34435 commented 2 years ago

I’ve added arbitrage mode already. Just provide a flag named -arbitrage then enjoy 😉