ghostfolio icon indicating copy to clipboard operation
ghostfolio copied to clipboard

[BUG] Could not get historical market data for bitcoin (COINGECKO) when the time range is more than one year

Open swissbuechi opened this issue 1 year ago • 4 comments

Bug Description

Not able to gather historical data for bitcoin via coingecko. I have existing activities starting from 2021-10-17 all the way to 2024. When I delete all activities from 2021 till 2023, the historical market data gathering works fine.

To Reproduce

  1. Create activity to buy bitcoin in 2021
  2. Create activity to buy bitcoin in 2024
  3. Click on "Gather Historical Data" (bitcoin) -> Error (See logs)
  4. Delete buy bitcoin activity from 2021
  5. Click on "Gather Historical Data" (bitcoin) -> Works

Expected behavior

The market data should also be captured if the range is more than one year. Maybe request the data in junks of max one year?

Logs

[Nest] 109  - 04/01/2024, 12:14:08 PM     LOG [DataGatheringProcessor (GATHER_HISTORICAL_MARKET_DATA)] Historical market data gathering has been started for bitcoin (COINGECKO) at 2021-10-17
[Nest] 109  - 04/01/2024, 12:14:08 PM   ERROR [DataProviderService] Error: Could not get historical market data for bitcoin (COINGECKO) from 2021-10-17 to 2024-04-01: [HTTPError] Response code 401 (Unauthorized)
[Nest] 109  - 04/01/2024, 12:14:08 PM     LOG [DataGatheringProcessor (GATHER_HISTORICAL_MARKET_DATA)] Historical market data gathering has been completed for bitcoin (COINGECKO) at 2024-04-01
[Nest] 109  - 04/01/2024, 12:14:12 PM     LOG [DataGatheringProcessor (GATHER_HISTORICAL_MARKET_DATA)] Historical market data gathering has been started for bitcoin (COINGECKO) at 2021-10-17
[Nest] 109  - 04/01/2024, 12:14:12 PM   ERROR [DataProviderService] Error: Could not get historical market data for bitcoin (COINGECKO) from 2021-10-17 to 2024-04-01: [HTTPError] Response code 401 (Unauthorized)
[Nest] 109  - 04/01/2024, 12:14:12 PM     LOG [DataGatheringProcessor (GATHER_HISTORICAL_MARKET_DATA)] Historical market data gathering has been completed for bitcoin (COINGECKO) at 2024-04-01
[Nest] 109  - 04/01/2024, 12:14:19 PM     LOG [DataGatheringProcessor (GATHER_HISTORICAL_MARKET_DATA)] Historical market data gathering has been started for bitcoin (COINGECKO) at 2021-10-17
[Nest] 109  - 04/01/2024, 12:14:19 PM   ERROR [DataProviderService] Error: Could not get historical market data for bitcoin (COINGECKO) from 2021-10-17 to 2024-04-01: [HTTPError] Response code 401 (Unauthorized)
[Nest] 109  - 04/01/2024, 12:14:19 PM     LOG [DataGatheringProcessor (GATHER_HISTORICAL_MARKET_DATA)] Historical market data gathering has been completed for bitcoin (COINGECKO) at 2024-04-01
[Nest] 109  - 04/01/2024, 12:14:23 PM     LOG [DataGatheringProcessor (GATHER_HISTORICAL_MARKET_DATA)] Historical market data gathering has been started for bitcoin (COINGECKO) at 2021-10-17
[Nest] 109  - 04/01/2024, 12:14:23 PM   ERROR [DataProviderService] Error: Could not get historical market data for bitcoin (COINGECKO) from 2021-10-17 to 2024-04-01: [HTTPError] Response code 401 (Unauthorized)
[Nest] 109  - 04/01/2024, 12:14:23 PM     LOG [DataGatheringProcessor (GATHER_HISTORICAL_MARKET_DATA)] Historical market data gathering has been completed for bitcoin (COINGECKO) at 2024-04-01
[Nest] 109  - 04/01/2024, 12:14:27 PM     LOG [DataGatheringProcessor (GATHER_HISTORICAL_MARKET_DATA)] Historical market data gathering has been started for bitcoin (COINGECKO) at 2021-10-17
[Nest] 109  - 04/01/2024, 12:15:27 PM   ERROR [DataProviderService] Error: Could not get historical market data for bitcoin (COINGECKO) from 2021-10-17 to 2024-04-01: [RequestError] The operation was aborted
[Nest] 109  - 04/01/2024, 12:15:27 PM     LOG [DataGatheringProcessor (GATHER_HISTORICAL_MARKET_DATA)] Historical market data gathering has been completed for bitcoin (COINGECKO) at 2024-04-01

Environment

  • Ghostfolio Version 2.69.0
  • Self-hosted: Azure Kubernetes Service
  • Experimental Features: disabled
  • Browser: Edge
  • OS: macOS

swissbuechi avatar Apr 01 '24 12:04 swissbuechi

Can confirm I'm having the same issue (self-hosted, 2.70.0).

karter16 avatar Apr 05 '24 18:04 karter16

Improved the usability of the date range support by specific years (2023, 2022, 2021, etc.) in the assistant (experimental)

Maybe this new feature from release 2.70 could fix the issue.

I will try and report back.

swissbuechi avatar Apr 05 '24 18:04 swissbuechi

The assistant is purely for filtering is my understanding, it shouldn't have any bearing on things like retrieving historical data.

karter16 avatar Apr 05 '24 18:04 karter16

I ended up manually importing a .csv with the recent three years of market data, which I've downloaded from Yahoo Finance.

date,marketPrice
2021-10-27,58482.386719
2021-10-28,60622.136719
2021-10-29,62227.964844
...

swissbuechi avatar Apr 29 '24 09:04 swissbuechi

I'm having the same issue. I see the following log but no historical data pulled:


[Nest] 163  - 07/16/2024, 1:52:17 AM     LOG [DataGatheringProcessor (GATHER_HISTORICAL_MARKET_DATA)] Historical market data gathering has been started for bitcoin (COINGECKO) at 2024-07-16
[Nest] 163  - 07/16/2024, 1:52:17 AM     LOG [DataGatheringProcessor (GATHER_HISTORICAL_MARKET_DATA)] Historical market data gathering has been completed for bitcoin (COINGECKO) at 2024-07-16
[Nest] 163  - 07/16/2024, 1:52:21 AM     LOG [DataGatheringProcessor (GATHER_ASSET_PROFILE)] Asset profile data gathering has been started for bitcoin (COINGECKO)
[Nest] 163  - 07/16/2024, 1:52:21 AM     LOG [DataGatheringProcessor (GATHER_ASSET_PROFILE)] Asset profile data gathering has been completed for bitcoin (COINGECKO)



I configured the Coingecko API on the env but no success.

danipolo avatar Jul 16 '24 01:07 danipolo

I think the 1 year limit is linked to the API limitations of Coingecko's Demo plan : image https://www.coingecko.com/en/api/pricing

alexandrescieux avatar Aug 19 '24 16:08 alexandrescieux

I think the 1 year limit is linked to the API limitations of Coingecko's Demo plan :

image

https://www.coingecko.com/en/api/pricing

You're right!

Thank you.

swissbuechi avatar Aug 19 '24 17:08 swissbuechi