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

Feat/minor improvements to backtesting and candles #7029

Conversation

cardosofede
Copy link
Contributor

@cardosofede cardosofede commented May 15, 2024

Before submitting this PR, please make sure:

  • Your code builds clean without any errors or warnings
  • You are using approved title ("feat/", "fix/", "docs/", "refactor/")

A description of the changes proposed in the pull request:
In this PR I changed the way that the backtesting market data provider is initialized so we can reuse the information to execute another run.
Also I fixed the method of fetch candles of kucoin spot.

Tests performed by the developer:

Tips for QA testing:

@cardosofede cardosofede marked this pull request as ready for review May 16, 2024 15:53
@rapcmia rapcmia requested review from rapcmia and nikspz May 20, 2024 07:39
@rapcmia
Copy link
Contributor

rapcmia commented May 20, 2024

Test commit 536e8a8d77d2d20411f9ea0183079819e1f994b4

  • Overview of the PR 👀
  • Run tests on binance spot candles
    • download_candles ✅
    • candles_example:
      image
      • The dates seem to be skipping, from 5-19 16:xx then goes to 5-20 8:xx
      • Running for 30mins
        image
        • Timestamps on different intervals are inconsistently updating compared to earlier screenshot
        • Should be the expected behavior displays data of timestamps every 1m, 5m?
        • Another possible issue is binance getting websocket connection closed on logs in different timeframes
        • Running another test from 2/3 attempts in progress
  • Run tests on kucoin spot candles
    • download_candles ❌
      image
      2024-05-20 16:17:48,651 - 61466 - hummingbot.data_feed.candles_feed.kucoin_spot_candles.kucoin_spot_candles - ERROR - There is no data available for the quantity of candles requested for kucoin_BTC-USDT.
      2024-05-20 16:17:48,651 - 61466 - hummingbot.data_feed.candles_feed.kucoin_spot_candles.kucoin_spot_candles - ERROR - Unexpected error occurred when getting historical klines. Retrying in 1 seconds...
      Traceback (most recent call last):
        File "/Users/rapcomia/github/hummingbot/7029/hummingbot/data_feed/candles_feed/kucoin_spot_candles/kucoin_spot_candles.py", line 117, in fill_historical_candles
          raise
      RuntimeError: No active exception to reraise
      
      • Change intervals and days_to_download from 3 to 5
      • Tried to play different markets getting same error
      • stop command does not stop the script and continues to return same error
    • candles_examples
      image
      2024-05-20 17:18:07,296 - 1160 - hummingbot.client.hummingbot_application - INFO - start command initiated.
      2024-05-20 17:18:07,329 - 1160 - hummingbot.core.network_iterator - INFO - Network status has changed to NetworkStatus.CONNECTED. Starting networking...
      2024-05-20 17:18:07,856 - 1160 - hummingbot.connector.exchange.binance.binance_api_order_book_data_source.BinanceAPIOrderBookDataSource - INFO - Subscribed to public order book and trade channels...
      2024-05-20 17:18:07,959 - 1160 - hummingbot.core.data_type.order_book_tracker - INFO - Initialized order book for SOL-USDT. 1/1 completed.
      2024-05-20 17:18:08,001 - 1160 - hummingbot.strategy.script_strategy_base - WARNING - binance is not ready. Please wait...
      2024-05-20 17:18:08,039 - 1160 - hummingbot.data_feed.candles_feed.kucoin_spot_candles.kucoin_spot_candles - INFO - Network status has changed to NetworkStatus.CONNECTED. Starting networking...
      2024-05-20 17:18:08,071 - 1160 - hummingbot.data_feed.candles_feed.kucoin_spot_candles.kucoin_spot_candles - INFO - Network status has changed to NetworkStatus.CONNECTED. Starting networking...
      2024-05-20 17:18:08,071 - 1160 - hummingbot.data_feed.candles_feed.kucoin_spot_candles.kucoin_spot_candles - INFO - Network status has changed to NetworkStatus.CONNECTED. Starting networking...
      2024-05-20 17:18:08,906 - 1160 - hummingbot.data_feed.candles_feed.kucoin_spot_candles.kucoin_spot_candles - INFO - Subscribed to public klines...
      2024-05-20 17:18:08,942 - 1160 - hummingbot.data_feed.candles_feed.kucoin_spot_candles.kucoin_spot_candles - INFO - Subscribed to public klines...
      2024-05-20 17:18:08,976 - 1160 - hummingbot.data_feed.candles_feed.kucoin_spot_candles.kucoin_spot_candles - INFO - Subscribed to public klines...
      2024-05-20 17:18:10,080 - 1160 - hummingbot.core.rate_oracle.rate_oracle - INFO - Network status has changed to NetworkStatus.CONNECTED. Starting networking...
      2024-05-20 17:18:14,350 - 1160 - hummingbot.data_feed.candles_feed.kucoin_spot_candles.kucoin_spot_candles - ERROR - There is no data available for the quantity of candles requested for kucoin_ETH-USDT.
      2024-05-20 17:18:14,351 - 1160 - hummingbot.data_feed.candles_feed.kucoin_spot_candles.kucoin_spot_candles - ERROR - Unexpected error occurred when getting historical klines. Retrying in 1 seconds...
      Traceback (most recent call last):
        File "/Users/rapcomia/github/hummingbot/7029/hummingbot/data_feed/candles_feed/kucoin_spot_candles/kucoin_spot_candles.py", line 117, in fill_historical_candles
          raise
      RuntimeError: No active exception to reraise
      2024-05-20 17:18:14,384 - 1160 - hummingbot.data_feed.candles_feed.kucoin_spot_candles.kucoin_spot_candles - ERROR - There is no data available for the quantity of candles requested for kucoin_ETH-USDT.
      2024-05-20 17:18:14,384 - 1160 - hummingbot.data_feed.candles_feed.kucoin_spot_candles.kucoin_spot_candles - ERROR - Unexpected error occurred when getting historical klines. Retrying in 1 seconds...
      Traceback (most recent call last):
        File "/Users/rapcomia/github/hummingbot/7029/hummingbot/data_feed/candles_feed/kucoin_spot_candles/kucoin_spot_candles.py", line 117, in fill_historical_candles
          raise
      RuntimeError: No active exception to reraise
      2024-05-20 17:18:14,385 - 1160 - hummingbot.data_feed.candles_feed.kucoin_spot_candles.kucoin_spot_candles - ERROR - There is no data available for the quantity of candles requested for kucoin_ETH-USDT.
      2024-05-20 17:18:14,385 - 1160 - hummingbot.data_feed.candles_feed.kucoin_spot_candles.kucoin_spot_candles - ERROR - Unexpected error occurred when getting historical klines. Retrying in 1 seconds...
      Traceback (most recent call last):
        File "/Users/rapcomia/github/hummingbot/7029/hummingbot/data_feed/candles_feed/kucoin_spot_candles/kucoin_spot_candles.py", line 117, in fill_historical_candles
          raise
      RuntimeError: No active exception to reraise
      2024-05-20 17:18:15,358 - 1160 - hummingbot.data_feed.candles_feed.kucoin_spot_candles.kucoin_spot_candles - ERROR - There is no data available for the quantity of candles requested for kucoin_ETH-USDT.
      2024-05-20 17:18:15,358 - 1160 - hummingbot.data_feed.candles_feed.kucoin_spot_candles.kucoin_spot_candles - ERROR - Unexpected error occurred when getting historical klines. Retrying in 1 seconds...
      Traceback (most recent call last):
        File "/Users/rapcomia/github/hummingbot/7029/hummingbot/data_feed/candles_feed/kucoin_spot_candles/kucoin_spot_candles.py", line 117, in fill_historical_candles
          raise
      RuntimeError: No active exception to reraise
      
      • Script does not work and return same error as for earlier tests
      • Tried to change max_records from 1000,500 and 100 still getting same results

Steps to reproduce:

  • Use utility scripts candles_examples and download_candles

Logs, script and config files:
https://drive.google.com/drive/folders/1V2Pn4TFmPK4I_MYc9yCuH34EARSszo6L


Pending:

  • Requested Nikita to reproduce this issue on development branch

@nikspz
Copy link
Contributor

nikspz commented May 20, 2024

Test commit 536e8a8d77d2d20411f9ea0183079819e1f994b4

  • Run tests on binance spot candles
    • candles_example:
      image

      • The dates seem to be skipping, from 5-19 16:xx then goes to 5-20 8:xx
      • Running for 30mins

Crosschecked on dev, not reproduced

Development binance candles
image

Development kucoin spot candles

image

download_candles:

kucoin spot, latest development used default script

  • 5m not supported

image

  • changed to ("INTERVALS", "1m,3m,15m,1h").split(",")
  • Review candles downloaded

image

@cardosofede cardosofede merged commit 71ee587 into hummingbot:development May 20, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Development 1.28.0
Development

Successfully merging this pull request may close these issues.

None yet

4 participants