Repository: hummingbot/hummingbot
Pull request: feat / Make more params configurable on the fly
**Before submitting this PR, please make sure**:
- [x] Your code builds clean without any errors or warnings
- [x] You are using approved title ("feat/", "fix/", "docs/", "refactor/", etc)


**Optional**:
- Related Github issue: #1716 
- Related Clubhouse Story:


**A description of the changes proposed in the pull request**:


Problem statement:
Make more params configurable on the fly
In the PMM strategy, all parameters that do not entail changing markets should be configurable on the fly. I think they should take into effect at the next tick if possible 

The key ones include:
- `order_amount`
- `order_levels`
- `order_level_spread`
- `filled_order_delay
- `inventory_skew_enabled`
- `inventory_target_base_pct`
- `inventory_range_multiplier`

Hints from issue discussion:
if there are so many key options to configure in the future, possible to allow user to add it as a separate strategy file. similar to this feature request:  https://github.com/CoinAlpha/hummingbot/issues/1968

Commit message: (feat) Make more params configurable on the fly

Patch to review:
diff --git a/hummingbot/client/command/config_command.py b/hummingbot/client/command/config_command.py
index 6daca2fe7f2..fab116ba06a 100644
--- a/hummingbot/client/command/config_command.py
+++ b/hummingbot/client/command/config_command.py
@@ -28,7 +28,8 @@
     from hummingbot.client.hummingbot_application import HummingbotApplication
 
 
-no_restart_pmm_keys = ["bid_spread", "ask_spread"]
+no_restart_pmm_keys_in_percentage = ["bid_spread", "ask_spread", "order_level_spread", "inventory_target_base_pct"]
+no_restart_pmm_keys = ["order_amount", "order_levels", "filled_order_delay", "inventory_skew_enabled", "inventory_range_multiplier"]
 global_configs_to_display = ["0x_active_cancels",
                              "kill_switch_enabled",
                              "kill_switch_rate",
@@ -94,11 +95,11 @@ async def check_password(self,  # type: HummingbotApplication
     # Make this function static so unit testing can be performed.
     @staticmethod
     def update_running_pure_mm(pure_mm_strategy: PureMarketMakingStrategy, key: str, new_value: Any):
-        if key == "bid_spread":
-            pure_mm_strategy.bid_spread = new_value / Decimal("100")
+        if key in no_restart_pmm_keys_in_percentage:
+            setattr(pure_mm_strategy, key, new_value / Decimal("100"))
             return True
-        elif key == "ask_spread":
-            pure_mm_strategy.ask_spread = new_value / Decimal("100")
+        elif key in no_restart_pmm_keys:
+            setattr(pure_mm_strategy, key, new_value)
             return True
         return False
 
diff --git a/hummingbot/strategy/pure_market_making/pure_market_making.pyx b/hummingbot/strategy/pure_market_making/pure_market_making.pyx
index 1e6db2a8204..dfb1ec750d1 100644
--- a/hummingbot/strategy/pure_market_making/pure_market_making.pyx
+++ b/hummingbot/strategy/pure_market_making/pure_market_making.pyx
@@ -606,6 +606,9 @@ cdef class PureMarketMakingStrategy(StrategyBase):
             MarketBase market = self._market_info.market
             list buys = []
             list sells = []
+        # It is necessary to point buy and sell levels to order_levels in order to make the configurable on the fly
+        self.buy_levels = self._order_levels
+        self.sell_levels = self._order_levels
         for level in range(0, self._buy_levels):
             price = self.c_get_mid_price() * (Decimal("1") - self._bid_spread - (level * self._order_level_spread))
             price = market.c_quantize_order_price(self.trading_pair, price)


Code review comments:
diff_hunk: @@ -606,6 +606,9 @@ cdef class PureMarketMakingStrategy(StrategyBase):
             MarketBase market = self._market_info.market
             list buys = []
             list sells = []
+        # It is necessary to point buy and sell levels to order_levels in order to make the configurable on the fly
path: hummingbot/strategy/pure_market_making/pure_market_making.pyx
text: @user1:
You can do this in the order_levels property setter. Resetting the buy and sell levels here will be a problem for scripts.