📁 Strategy Info¶
- Folder: /hummingbot/strategy/perpetual_market_making
- Configs: perpetual_market_making_config_map.py
🏆 Strategy Tier¶
Community strategies have passed the Minimum Voting Power Threshold in the latest Poll and are included in each monthly release. They are not maintained by Hummingbot Foundation but may be maintained by a community member.
This strategy allows Hummingbot users to run a market making strategy on a single trading pair on a perpetuals swap (
perp) order book exchange.
Similar to the
perpetual_market_making strategy keeps placing limit buy and sell orders on the order book and waits for other participants (takers) to fill its orders. But unlike market making on spot markets, where assets are being exchanged, market making on perpetual markets creates and closes positions. Since outstanding perpetual swap positions are created after fills, the strategy has a number of parameters to determine when positions are closed to take profits and prevent losses.
🏦 Exchanges supported¶
- PERP CLOB CEX
🛠️ Strategy configs¶
||string||True||Enter your maker derivative connector|
||string||True||Enter the trading pair you would like to provide liquidity on [exchange]|
||int||True||How much leverage do you want to use?|
||string||One-way||True||Which position mode do you want to use? (One-way/Hedge)|
||decimal||True||How far away from the mid price do you want to place the first bid order?|
||decimal||True||How far away from the mid price do you want to place the first ask order?|
||decimal||-100||False||At what minimum spread should the bot automatically cancel orders?|
||float||True||How often do you want to cancel and replace bids and asks (in seconds)?|
||decimal||0||False||Enter the percent change in price needed to refresh orders at each cycle|
||decimal||True||What is the amount of [base_asset] per order?|
||decimal||0||True||At what spread from the entry price do you want to place a short order to reduce position?|
||string||0||True||At what spread from the position entry price do you want to place a long order to reduce position?|
||string||0||True||At what spread from position entry price do you want to place stop_loss order?|
||decimal||60||True||How much time should pass before refreshing a stop loss order that has not been executed? (in seconds)|
||decimal||0.5||True||How much buffer should be added in stop loss orders' price to account for slippage (Enter 1 for 1%)?|
||decimal||-1||False||Enter the price point above which only sell orders will be placed|
||decimal||-1||False||Enter the price below which only buy orders will be placed|
||int||1||False||How many orders do you want to place on both sides?|
||decimal||0||False||How much do you want to increase or decrease the order size for each additional order? (decrease < 0 > increase)|
||decimal||1||False||Enter the price increments (as percentage) for subsequent orders? (Enter 1 to indicate 1%)|
||float||60||False||How long do you want to wait before placing the next order if your order gets filled (in seconds)?|
||bool||False||False||Do you want to enable best bid ask jumping? (Yes/No)|
||decimal||0||False||How deep do you want to go into the order book for calculating the top ask, ignoring dust orders on the top (expressed in base asset amount)?|
||decimal||0||False||How deep do you want to go into the order book for calculating the top bid, ignoring dust orders on the top (expressed in base asset amount)?|
||string||current_market||False||Which price source to use? (current_market/external_market/custom_api)|
||string||mid_price||False||Which price type to use? (mid_price/last_price/last_own_trade_price/best_bid/best_ask)|
||string||False||Enter external price source connector name or derivative name|
||string||False||Enter the token trading pair on [external_market]|
||string||False||Enter pricing API URL|
||float||5||False||Enter custom API update interval in second (default: 5.0, min: 0.5)|
The description below is a general approximation of this strategy. Please inspect the strategy code in Trading Logic above to understand exactly how it works.
perpetual_market_making strategy works in a similar fashion as the
pure_market_making_strategy, except adapted to trading perpetual swaps. Trading perpetual swaps creates positions, and doesn't just exchage assets like trading on spot markets.
On every tick the strategy creates new opening orders and existing orders are being cancelled. If an outstanding order is filled, the strategy then has to manage the position.
The strategy places long and short orders to open perpetual swap positions at predefined distances from a mid price. These distances are given by the parameters
On every tick, outstanding open orders are being evaluated. If they're too far from the proposal orders, as defined by the
order_refresh_tolerance_pct parameter, they will be cancelled and replaced by new orders.
If an active order finds itself below a
min_spread threshold from the mid price, it will also be cancelled.
It's also possible to place multiple orders on each side in price layers as defined by the parameters
order_level_spread. The closest to the mid price will be always orders at distances
The strategy can be restricted to trade only within a specific price band, defined by the
price_floor parameters. If the mid price is outside of this interval, no orders will be created, only cancelled.
New opening orders are not being placed if one or more of existing opening orders were filled and the strategy holds a position. In that case, the position(s) is being evaluated on every tick whether to close it or not, and whether to either take a profit or a loss. These decisions are controlled by parameters
ℹ️ More Resources¶
Perpetual Market Making Demo | Hummingbot Live: Demo of the Perpetual Market Making strategy
Check out Hummingbot Academy for more resources related to this strategy and others!