w3f / staking-rewards-collector

Apache License 2.0
78 stars 32 forks source link

ENHANCEMENT: Allow default or "N/A" for periods when no price available #8

Closed laboon closed 3 years ago

laboon commented 3 years ago

For 19 Aug or earlier, there is no price data from CoinGecko as DOT was not trading.

When you ask for a time period where there is no price data, can you allow either a default (preferably specified) or simply show "0" or "n/a", instead of exiting?

This would only apply to accounts where the owner: 1: bought pre-summer 2020 2: claimed before 19 Aug 3: started validating after claiming but before 19 Aug

Thus, I would say this is low-priority (and workaround is relatively simple, split into pre-19 Aug and post-19 Aug where pre version has 'n' for priceData, then manually calculate with default price on a spreadsheet)

jonasW3F commented 3 years ago

Making an API request to CoinGecko for a period including at least one day without prices will return an error. The script still continues but uses prices of 0 for all the dates.

What could work is to search for the day with the first available price in the object and then only make price calls from there. The easiest way then would be to start form that iteration index only.

jonasW3F commented 3 years ago

I did some adjustments and pushed a branch "v1.2" which should solve this issue.

jonasW3F commented 3 years ago

This should be fixed in v1.2. Users are now free to request any time period with price data enabled.