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

Issue with "get_product_historic_rates" start and end dates #439

Open
Bainsbe opened this issue May 8, 2021 · 2 comments
Open

Issue with "get_product_historic_rates" start and end dates #439

Bainsbe opened this issue May 8, 2021 · 2 comments

Comments

@Bainsbe
Copy link

Bainsbe commented May 8, 2021

The "get_product_historic_rates" function seems to return more values than needed when "start" or "end" variables get passed in.

import cbpro as cbp

client = cbp.PublicClient()
response = client.get_product_historic_rates( 'BTC-USD', start = '2021-05-01T01:00:00', granularity = 86400)

The above returns 300 values despite granularity being daily and the start time being only 7 days ago. The endpoint seems to be returning correct values for the query when tested separately. Tested it on: https://gdaxurl.surge.sh/

@ensingerphilipp
Copy link

ensingerphilipp commented May 11, 2021

Specify the "end" date 1 Day later and it should work

response = client.get_product_historic_rates( 'BTC-USD', start = '2021-05-01T01:00:00', end = '2021-05-02T01:00:00', granularity = 86400)

@Bainsbe
Copy link
Author

Bainsbe commented May 11, 2021

@ensingerphilipp Thanks, that works!

Maybe worth looking into implementing a fix for this on the back end - so end defaults to today if start is passed in alone and end defaults to end date minus 300 periods if passed in alone.

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

No branches or pull requests

2 participants