Skip to content

[BWS] use coingecko days=max for all-time fiat rates - #4223

Open
msalcala11 wants to merge 1 commit into
bitpay:masterfrom
msalcala11:fix-all-time-v4-rates
Open

[BWS] use coingecko days=max for all-time fiat rates#4223
msalcala11 wants to merge 1 commit into
bitpay:masterfrom
msalcala11:fix-all-time-v4-rates

Conversation

@msalcala11

Copy link
Copy Markdown
Contributor

Description

V4 fiat-rate requests without a days parameter recently stopped returning the expected historical data. The app relies on this request to populate the 3M, 1Y, 5Y, and ALL time views, so those views are currently broken.

BWS was translating an omitted days parameter into days=100000 for CoinGecko. This PR replaces days=100000 with CoinGecko’s supported days=max value.

Changelog

  • Translate an omitted days parameter into CoinGecko’s days=max value.
  • Use a new cache key so stale days=100000 results are not reused.
  • Add focused regression coverage for omitted and numeric days requests.

Testing Notes

From packages/bitcore-wallet-service, run all integration tests:

npm run compile
npx mocha 'ts_build/test/integration/**/*.test.js'

MongoDB must be available at localhost:27017.

Test the routes used by the app to fetch all-time rate data:

GET /bws/api/v4/fiatrates/USD
GET /bws/api/v4/fiatrates/USD?coin=BTC
GET /bws/api/v4/fiatrates/USD?chain=eth&tokenAddress=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48

The response should contain all-time history. BWS should send days=max and interval=daily to CoinGecko.


Checklist

  • I have read CONTRIBUTING.md and verified that this PR follows the guidelines and requirements outlined in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant