-
-
Notifications
You must be signed in to change notification settings - Fork 149
Description
Describe the bug
Fetching crypto data (e.g. btcusd) from Tiingo fails with:
json: cannot unmarshal number 20297.44489644 into Go struct field TiingoEndOfDay.volume of type int64
Stocks have integer volume so this doesn't show up there, but crypto volume can be fractional. Tiingo returns float for crypto pairs.
To Reproduce
Steps to reproduce the behavior:
- Run indicator-sync with a Tiingo API key targeting btcusd:
go run ./cmd/indicator-sync
-source-name tiingo
-source-config YOUR_API_KEY
-target-name filesystem
-target-config /tmp/data
btcusd
- See error in logs:
Unable to decode data. error="json: cannot unmarshal number 20297.44489644 into Go struct field TiingoEndOfDay.volume of type int64"
Expected behavior
btcusd data synced to the target repository without error.
Additional context
Volume and AdjVolume in TiingoEndOfDay (tiingo_repository.go:58,73) are int64.
I think changing both to float64 fixes it.
A similar volume type issue was discussed in #126 for reference.