hummingbot / hummingbot

Open source software that helps you create and deploy high-frequency crypto trading bots
https://hummingbot.org
Apache License 2.0
8.26k stars 2.84k forks source link

Add new parameter to only replenish orders if mid-price has moved #1794

Closed cartano closed 3 years ago

cartano commented 4 years ago

Feature Suggestion Prevent the bot from replenishing orders at the same price that just got filled

Example scenario: PMM on DGB-BTC (8 decimals) highest bid 165sat lowest ask 166sat = mid price 165.5 , bid/ask spread ea at 0.5% puts buy at 165 and sell at 166, if there is now big order depth at that price, any fill will result in replenish at same price until the mid_price moves.

This appears to be a common scenario, since many satoshi pairs have high order depth around mid-price, in single satoshi steps.

**Impact This may accumulate one-sided trades at same price, and rapidly depletes inventory in case of sells or vice versa, without covering the opposite side. The risk remains even when using hanging orders, since it racks up one-sided hanging orders at same price without mid price moving = big risk if then comes opposite-side movement past the hanging_orders_cancel_pct.

Using filled_order_delay only "dampens" the effect, it does not solve it and is even counter productive in markets that have fluctuating transaction frequency.

Adding a parameter for an option to prevent to replenish orders until mid-price has moved would solve the problem.

It may even be considered to make it Default behavior to not replenish without mid-price move, to make the PMM bot "safer" for new users.

NOTE: Implementing Issue PMM Extend price source param #1715 enabling an option where price_source_type = last_trade , where mid-price is being determined from last trade price would also solve this problem.

phbrgnomo commented 3 years ago

Isnt this feature already available with order_refresh_tolerance_pct?

@dennisocana could you confirm this?

cartano commented 3 years ago

my understanding is that order_refresh_tolerance_pct works on otherwise periodic order refresh, not on replenish after one-side got filled regardless, additional background: this feature request goes back to when price_type = last_own_trade was not implemented yet (v0.30) relevant in all single-satoshi step markets when you want a grid-bot-like behavior, and not execute more then one trade on ea satoshi step. Introduction of price_type = last_own_trade solved for this.

However, usually if you run out of base or quote currency, order_refresh_time will take care of moving the one-sided buy or sell order with the market, unless you have price_type = last_own_trade, which will only refresh / replace the last order at the same price, since the mid-price (being my last trade) cannot have moved. It may be a consideration to elaborate on this example in the documentation

hope this helps

On Mon, Mar 8, 2021 at 8:52 AM phbrgnomo notifications@github.com wrote:

Isnt this feature already available with order_refresh_tolerance_pct?

@dennisocana https://github.com/dennisocana could you confirm this?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CoinAlpha/hummingbot/issues/1794#issuecomment-792807674, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJBOEBBMCX5JIRMQAFDEOU3TCTQD3ANCNFSM4NG6LODQ .