Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TWAP - Error calculating fee in quote when using V2 strategy #6927

Closed
rapcmia opened this issue Mar 25, 2024 · 1 comment
Closed

TWAP - Error calculating fee in quote when using V2 strategy #6927

rapcmia opened this issue Mar 25, 2024 · 1 comment

Comments

@rapcmia
Copy link
Contributor

rapcmia commented Mar 25, 2024

Describe the bug

When running the TWAP V2 strategy on taker mode, noticed that it returns an error on the first filled market order Error updating executors info: Could not find the exchange rate for BNB-USDT using the rate source binance rate oracle (please verify it has been correctly configured)

image

2024-03-25 12:43:52,001 - 68323 - hummingbot.strategy.script_strategy_base - ERROR - Error updating executors info: Could not find the exchange rate for BNB-USDT using the rate source binance rate oracle (please verify it has been correctly configured)
Traceback (most recent call last):
  File "/Users/rapcomia/github/hummingbot/6915/hummingbot/strategy/strategy_v2_base.py", line 259, in update_executors_info
    self.executors_info = self.executor_orchestrator.get_executors_report()
  File "/Users/rapcomia/github/hummingbot/6915/hummingbot/smart_components/executors/executor_orchestrator.py", line 142, in get_executors_report
    report[controller_id] = [executor.executor_info for executor in executors_list if executor]
  File "/Users/rapcomia/github/hummingbot/6915/hummingbot/smart_components/executors/executor_orchestrator.py", line 142, in <listcomp>
    report[controller_id] = [executor.executor_info for executor in executors_list if executor]
  File "/Users/rapcomia/github/hummingbot/6915/hummingbot/smart_components/executors/executor_base.py", line 116, in executor_info
    net_pnl_pct=self.net_pnl_pct,
  File "/Users/rapcomia/github/hummingbot/6915/hummingbot/smart_components/executors/executor_base.py", line 193, in net_pnl_pct
    return self.get_net_pnl_pct()
  File "/Users/rapcomia/github/hummingbot/6915/hummingbot/smart_components/executors/twap_executor/twap_executor.py", line 267, in get_net_pnl_pct
    return self.net_pnl_quote / total_executed_quote if total_executed_quote > Decimal("0") else Decimal("0")
  File "/Users/rapcomia/github/hummingbot/6915/hummingbot/smart_components/executors/executor_base.py", line 186, in net_pnl_quote
    return self.get_net_pnl_quote()
  File "/Users/rapcomia/github/hummingbot/6915/hummingbot/smart_components/executors/twap_executor/twap_executor.py", line 260, in get_net_pnl_quote
    return self.trade_pnl_quote - self.cum_fees_quote
  File "/Users/rapcomia/github/hummingbot/6915/hummingbot/smart_components/executors/executor_base.py", line 200, in cum_fees_quote
    return self.get_cum_fees_quote()
  File "/Users/rapcomia/github/hummingbot/6915/hummingbot/smart_components/executors/twap_executor/twap_executor.py", line 254, in get_cum_fees_quote
    return sum([order.cum_fees_quote for order in self._order_plan.values() if order])
  File "/Users/rapcomia/github/hummingbot/6915/hummingbot/smart_components/executors/twap_executor/twap_executor.py", line 254, in <listcomp>
    return sum([order.cum_fees_quote for order in self._order_plan.values() if order])
  File "/Users/rapcomia/github/hummingbot/6915/hummingbot/smart_components/models/executors.py", line 59, in cum_fees_quote
    return self.order.cumulative_fee_paid(token=self.order.quote_asset)
  File "/Users/rapcomia/github/hummingbot/6915/hummingbot/core/data_type/in_flight_order.py", line 306, in cumulative_fee_paid
    total_fee_in_token += trade_update.fee.fee_amount_in_token(
  File "/Users/rapcomia/github/hummingbot/6915/hummingbot/core/data_type/trade_fee.py", line 226, in fee_amount_in_token
    conversion_rate: Decimal = self._get_exchange_rate(conversion_pair, exchange, rate_source)
  File "/Users/rapcomia/github/hummingbot/6915/hummingbot/core/data_type/trade_fee.py", line 193, in _get_exchange_rate
    raise ValueError(f"Could not find the exchange rate for {trading_pair} using the rate source "
ValueError: Could not find the exchange rate for BNB-USDT using the rate source binance rate oracle (please verify it has been correctly configured)

When this error occurred, the rate oracle and token is set to default binance, USDT

Steps to reproduce

  1. Create script-config for TWAP on V2 strategy
  2. Start the script with config
  3. Observe the error on the first filled market order

Release version

development

Type of installation

Source

Attach required files

03252024.zip

@rapcmia
Copy link
Contributor Author

rapcmia commented Apr 19, 2024

Refer to #6964

@rapcmia rapcmia closed this as completed Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant