tradingstrategy-ai / trade-executor

A Python framework for managing positions and trades in DeFi
https://tradingstrategy.ai
Other
107 stars 29 forks source link

Strategy crashed when requesting latest APR #1037

Closed hieuh25 closed 2 months ago

hieuh25 commented 2 months ago

Traceback:

...r/tradeexecutor/ethereum/enzyme/vault.py", line 439, in sync_interests
    return sync_interests(
  File "/usr/src/trade-executor/tradeexecutor/strategy/interest.py", line 689, in sync_interests
    record_interest_rate(state, universe, timestamp)
  File "/usr/src/trade-executor/tradeexecutor/strategy/interest.py", line 625, in record_interest_rate
    last_interest_rate = universe.get_latest_supply_apr(
  File "/usr/src/trade-executor/tradeexecutor/strategy/trading_strategy_universe.py", line 1368, in get_latest_supply_apr
    raise RuntimeError(f"get_latest_supply_apr() failed, timestamp: {timestamp}, lending reserve: {lending_reserve}, asset: {asset}, tolerance: {tolerance}\nException: {e}") from e
RuntimeError: get_latest_supply_apr() failed, timestamp: 2024-09-05 00:04:19.437125, lending reserve: <LendingReserve #23 for asset USDC (0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48) in protocol aave_v3 on Ethereum >, asset: <USDC at 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48>, tolerance: 7 days 00:00:00
Exception: ("Could not find candle data for pair USD Coin\n- Column 'close'\n- At 2024-09-05 00:04:19.437125\n- Lower bound of time range tolerance 2024-08-29 00:04:19.437125\n\n- Data lag tolerance is set to 7 days 00:00:00\n- The pair has 13 candles between 2024-06-03 00:00:00 - 2024-08-26 00:00:00\n\nData unavailability might be due to several reasons:\n\n- You are handling sparse data - trades have not been made or the blockchain was halted during the price look-up period.\n  Try to increase 'tolerance' argument time window.\n- You are asking historical data when the trading pair was not yet live.\n- Your backtest is using indicators that need more lookback buffer than you are giving to them.\n  Try set your data load range earlier or your backtesting starting later.\n\n", 'Trading pair page link: https://tradingstrategy.ai/trading-view/ethereum/lending/aave_v3/usdc')

Note: I couldn't reproduce testing this in console of the same strategy, so this bug might be time sensitive