Skip to content

Commit

Permalink
Merge branch 'development' into fix/Beaxy_float_rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
ccraighead authored Apr 1, 2021
2 parents 21b4a4e + e4bc5ef commit 068ea8d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
9 changes: 6 additions & 3 deletions hummingbot/client/command/config_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,12 @@ async def inventory_price_prompt(
exchange = config_map["exchange"].value
market = config_map["market"].value
base_asset, quote_asset = market.split("-")
balances = await UserBalances.instance().balances(
exchange, base_asset, quote_asset
)
if global_config_map["paper_trade_enabled"].value:
balances = global_config_map["paper_trade_account_balance"].value
else:
balances = await UserBalances.instance().balances(
exchange, base_asset, quote_asset
)
if balances.get(base_asset) is None:
return

Expand Down
3 changes: 3 additions & 0 deletions hummingbot/client/command/create_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ async def prompt_a_config(self, # type: HummingbotApplication
config: ConfigVar,
input_value=None,
assign_default=True):
if config.key == "inventory_price":
await self.inventory_price_prompt(self.strategy_config_map, input_value)
return
if input_value is None:
if assign_default:
self.app.set_text(parse_config_default_to_text(config))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ def validate_price_floor_ceiling(value: str) -> Optional[str]:
return "Value must be more than 0 or -1 to disable this feature."


def on_validated_price_type(value: str):
if value == 'inventory_cost':
pure_market_making_config_map["inventory_price"].value = None


def exchange_on_validated(value: str):
required_exchanges.append(value)

Expand Down Expand Up @@ -241,6 +246,7 @@ def exchange_on_validated(value: str):
prompt="What is the price of your base asset inventory? ",
type_str="decimal",
validator=lambda v: validate_decimal(v, min_value=Decimal("0"), inclusive=True),
required_if=lambda: pure_market_making_config_map.get("price_type").value == "inventory_cost",
default=Decimal("1"),
),
"filled_order_delay":
Expand Down Expand Up @@ -308,6 +314,7 @@ def exchange_on_validated(value: str):
type_str="str",
required_if=lambda: pure_market_making_config_map.get("price_source").value != "custom_api",
default="mid_price",
on_validated=on_validated_price_type,
validator=lambda s: None if s in {"mid_price",
"last_price",
"last_own_trade_price",
Expand Down

0 comments on commit 068ea8d

Please sign in to comment.