enarjord / passivbot

Trading bot running on Binance, Bybit, Bitget, OKX, BingX, and Hyperliquid
https://www.passivbot.com
Other
1.02k stars 395 forks source link

Live Results #7

Closed merv22 closed 3 years ago

merv22 commented 3 years ago

Hello. Could you please explain a little bit about live results, if that's OK? Actually I was wondering if market making especially on ByBit (or Bitmex) which pay a rebate is overall profitable or at least not a completely looser strategy. Thanks

enarjord commented 3 years ago

EDIT 2024-06-05: "The results indicated below are not sustainable. While such gains are possible for a week or even a month when markets are favorable, liquidation is almost guaranteed in the medium to long term."

hi, thanks for your interest

live, my bots have been making on average between 4 and 15% a day, depending on what settings are used and market conditions.

it can vary from day to day, i've seen bots make over 20% in a day, not breaking a sweat, other days it can be slow, making only 2%.

in previous stages of development of the algorithm i have also seen liquidations happen, wiping the entire wallet, due to poorly tested settings, bugs in the code and unsafe algorithms. so be careful.

the bot will only reduce a position with profit, unless soft stop is triggered. if it has a long pos, reentry bid is always < pos_price and close ask is always > pos_price. inversely, if it has a short pos, reentry ask is always > pos_price, and close bid is always < pos_price. if liquidation price comes within a given percentage of last price, the bot will reduce position at a loss to push liq price away. i recommend using the backtester in jupyter notebook to get a feel for the behavior.

there are many approaches. for example, you can tune the bot conservatively, targeting 1-4% a day, with risk of soft stops being triggered low. i say low risk based on backtesting for a month or so back in time, including the worst price drops/spikes.

another approach is much more aggressive settings, allowing soft stop to hit more often, but making more gains. one user reports 30% gain in 30 hours using the dynamic grid mode with aggressive settings.

the bot works in bybit and binance (tho at the moment the backtester only works with bybit).

in bybit you can set min_markup to 0.0 and still be profitable because of the maker rebates. binance is proftiable too, but set min_markup > 0.0004 to cover maker fees.

if you want to test with small amounts you can try the bot, for example, on binance ethusdt with 10 usdt in the wallet, or bybit btcusd with ~0.0006 btc in the wallet

but i must repeat the disclaimer: use at own risk. 100+x leverage crypto futures can be dangerous business.

merv22 commented 3 years ago

Well, That's a very good result !

Does the result with bybit and binance differ significantly? I mean in you opinion is the rebate big part of profit?

enarjord commented 3 years ago

it depends on what markup you set

say volume one day is 10000 usd, on bybit that's 10000 -0.00025 == -2.5 usd fees on binance it's 10000 0.00018 == 1.8 usd fees

if weighted avg markup is 0.005, that's 10000 / 2 * 0.005 == 25 usd binance net pnl is 25 - 1.8 == 23.2 bybit net pnl is 25 - (-2.5) == 27.5 diff is ~18.5%

if weighted avg markup is 0.001, that's 10000 / 2 * 0.001 == 5 usd binance net pnl is 5 - 1.8 == 3.2 bybit net pnl is 5 - (-2.5) == 7.5 diff is ~134.3%

edit: miscalc. volume includes both entry and close orders, so it must be divided by 2 and multiplied by markup to get pnl

merv22 commented 3 years ago

To be more specific I am interested to know if a random strategy would be marginally profitable or close to break even? If that's the case, maybe machine learning can be used to make the random strategy better over time.

On Thu, Jan 14, 2021 at 2:01 PM enarjord notifications@github.com wrote:

hi, thanks for your interest

live, my bots have been making on average between 4 and 15% a day, depending on what settings are used and market conditions.

it can vary from day to day, i've seen bots make over 20% in a day, not breaking a sweat, other days it can be slow, making only 2%.

in previous stages of development of the algorithm i have also seen liquidations happen, wiping the entire wallet, due to poorly tested settings, bugs in the code and unsafe algorithms. so be careful.

the bot will only reduce a position with profit, unless soft stop is triggered. if it has a long pos, reentry bid is always < pos_price and close ask is always > pos_price. inversely, if it has a short pos, reentry ask is always > pos_price, and close bid is always < pos_price. if liquidation price comes within a given percentage of last price, the bot will reduce position at a loss to push liq price away. i recommend using the backtester in jupyter notebook to get a feel for the behavior.

there are many approaches, for example, you can tune the bot conservatively, targeting 1-4% a day, with risk of soft stops being triggered very low. i say low risk based on backtesting for a month or so back in time, including the worst price drops/spikes.

another approach is much more aggressive settings, allowing soft stop to hit more often, but making more gains. one user reports 30% gain in 30 hours using the dynamic grid mode with aggressive settings.

the bot works in bybit and binance (tho at the moment the backtester only works with bybit).

in bybit you can set min_markup to 0.0 and still be profitable because of the maker rebates. binance is proftiable too, but set min_markup > 0.0004 to cover maker fees.

if you want to test with small amounts you can try the bot, for example, on binance ethusdt with 10 usdt in the wallet, or bybit btcusd with ~0.0006 btc in the wallet

but i must repeat the disclaimer: use at own risk. 100+x leverage crypto futures can be dangerous business.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/enarjord/passivbot_futures/issues/7#issuecomment-760107519, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASOZEHEN5RJSCFBNJWF4IBLSZ3BXXANCNFSM4WCDNYYQ .

merv22 commented 3 years ago

OK. I got it. (I think !) I have to do some testings myself to have a better grasp of what to expect.

On Thu, Jan 14, 2021 at 3:44 PM enarjord notifications@github.com wrote:

it depends on what markup you set

say volume one day is 10000 usd, on bybit that's 10000 -0.00025 == -2.5 usd fees on binance it's 10000 0.00018 == 1.8 usd fees

if weighted avg markup is 0.005, that's 10000 * 0.005 == 50 usd binance net pnl is 50 - 1.8 == 48.2 bybit net pnl is 50 - (-2.5) == 52.5 diff is ~7.6%

if weighted avg markup is 0.001, that's 10000 * 0.001 == 10 usd binance net pnl is 10 - 1.8 == 8.2 bybit net pnl is 10 - (-2.5) == 12.5 diff is ~52%

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/enarjord/passivbot_futures/issues/7#issuecomment-760158991, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASOZEHDULRD4HKSEF2SYF4LSZ3N2HANCNFSM4WCDNYYQ .

enarjord commented 3 years ago

To be more specific I am interested to know if a random strategy would be marginally profitable or close to break even? If that's the case, maybe machine learning can be used to make the random strategy better over time.

i don't know what you mean by random strategy

merv22 commented 3 years ago

well, there should be ways to introduce randomness to strategy. for example when bot is only allowed to quote one sided market, and decision of quoting bids or asks can be random.

On Thu, Jan 14, 2021 at 7:53 PM enarjord notifications@github.com wrote:

To be more specific I am interested to know if a random strategy would be marginally profitable or close to break even? If that's the case, maybe machine learning can be used to make the random strategy better over time.

i don't know what you mean by random strategy

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/enarjord/passivbot_futures/issues/7#issuecomment-760304352, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASOZEHCIXTF2NTICPIDG7FLSZ4LAFANCNFSM4WCDNYYQ .

enarjord commented 3 years ago

i see

this bot is perfectly deterministic and predictable. there is randomness in the simple optimizing algorithm i called jackrabbit, which can be used to iterate hundreds of backtests, converging upon more optimal settings. but there's no randomness in the actual trading algorithm.

i have dabbled with neural nets and algo trading in the past. now the bot has less than 10 variable settings. using neural nets it's like giving it 100,000 variable settings, and optimizing them over many iterations of backtesting.

merv22 commented 3 years ago

Well, I have very little experience with Algo Trading (or any other form of trading) so I could be wrong, but I thought that if a robot is restricted to using only post-only orders (to have rebate on every transaction), then the overall game (assuming the bot have enough margin) should be profitable. because the bot receives a rebate on every transaction, the bid ask spread kind of guarantees that the average buy price is lower than average sell price. As I said all this is just speculation because I am not good enough at math to try and provide a theoretical proof.

Anyway if it is True, you could say that the value of this game for a random strategy is positive. and next we can go for optimizing the bot and moving it away from random choices towards more deterministic behavior.

I will try to see if I can use your strategy to test this hypothesis more safely, cause it seems that your risk management is quite effective.

I have dabbled a little with neural nets and reinforcement learning. I have not a good grasp on your strategy yet but I guess it could be made more robust with these techniques.

enarjord commented 3 years ago

alright i get your reasoning

to be profitable in an exchange with maker rebate using only post_only limit orders, you need buy_vwap <= sell_vwap.

if long, buy_vwap is pos price, inverse when short. so it's possible to make a bot which only bids below pos price and only asks above pos price. long pos price is lowered when reentering below pos price, and short pos price is increased when reentering above pos price.

it is similar to the martingale betting system. keep reentering to push avg entry price closer to market price, and sooner or later price will bounce enough to close the position at a profit.

lifesgteam commented 3 years ago

hi, thanks for your interest

live, my bots have been making on average between 4 and 15% a day, depending on what settings are used and market conditions.

it can vary from day to day, i've seen bots make over 20% in a day, not breaking a sweat, other days it can be slow, making only 2%.

in previous stages of development of the algorithm i have also seen liquidations happen, wiping the entire wallet, due to poorly tested settings, bugs in the code and unsafe algorithms. so be careful.

the bot will only reduce a position with profit, unless soft stop is triggered. if it has a long pos, reentry bid is always < pos_price and close ask is always > pos_price. inversely, if it has a short pos, reentry ask is always > pos_price, and close bid is always < pos_price. if liquidation price comes within a given percentage of last price, the bot will reduce position at a loss to push liq price away. i recommend using the backtester in jupyter notebook to get a feel for the behavior.

there are many approaches. for example, you can tune the bot conservatively, targeting 1-4% a day, with risk of soft stops being triggered low. i say low risk based on backtesting for a month or so back in time, including the worst price drops/spikes.

another approach is much more aggressive settings, allowing soft stop to hit more often, but making more gains. one user reports 30% gain in 30 hours using the dynamic grid mode with aggressive settings.

the bot works in bybit and binance (tho at the moment the backtester only works with bybit).

in bybit you can set min_markup to 0.0 and still be profitable because of the maker rebates. binance is proftiable too, but set min_markup > 0.0004 to cover maker fees.

if you want to test with small amounts you can try the bot, for example, on binance ethusdt with 10 usdt in the wallet, or bybit btcusd with ~0.0006 btc in the wallet

but i must repeat the disclaimer: use at own risk. 100+x leverage crypto futures can be dangerous business.

Hi, can you provide some examples of aggressive and conservative settings.

enarjord commented 3 years ago

just uploaded to settings/bybit/ two example settings, one conservative (same as default) and one aggressive.

here are results from a 35 day backtest for the aggressive one:

starting_balance = 0.001 btc net pnl 0.0167 btc soft stop loss sum -0.00389 btc gain 1669.4% n_days 35.0 average_daily_gain 8.556% n trades 32465 n closes 30066 n soft stop closes 232 biggest_pos_size 3795.0 usd margin_max 0.001058 btc closest liquidation 1.04%

lifesgteam commented 3 years ago

just uploaded to settings/bybit/ two example settings, one conservative (same as default) and one aggressive.

here are results from a 35 day backtest for the aggressive one:

starting_balance = 0.001 btc net pnl 0.0167 btc soft stop loss sum -0.00389 btc gain 1669.4% n_days 35.0 average_daily_gain 8.556% n trades 32465 n closes 30066 n soft stop closes 232 biggest_pos_size 3795.0 usd margin_max 0.001058 btc closest liquidation 1.04%

Thank you!

lifesgteam commented 3 years ago

Maybe it makes sense to create a telegram group for discussion, testing and share the results/settings

enarjord commented 3 years ago

good idea

added this link to the readme

https://t.me/joinchat/Fpwl8dVn0xAH8-ML