rozzac90 / pinnacle

Python Wrapper for Pinnacle Sports API
MIT License
52 stars 26 forks source link

Missing toDate. The toDate must be a date in ISO 8601 format. #10

Closed r-raymond closed 6 years ago

r-raymond commented 6 years ago

When calling the get_bets routine of the betting endpoint without any arguments, I get

Missing fromDate. The fromDate must be a date in ISO 8601 format.
Missing toDate. The toDate must be a date in ISO 8601 format.

When setting from_date and to_date to datetime.utcnow() I get

Invalid fromDate. The fromDate must be a date in ISO 8601 format.
Invalid toDate. The toDate must be a date in ISO 8601 format.
rozzac90 commented 6 years ago

I have pushed some changes to hopefully handle this better. Could you try install version 0.0.7 and let me know if this is working now. I dont have access to the API due to country restrictions so cant test unfortunately.

r-raymond commented 6 years ago

Hi, thanks for the quick response and the the awesome work on you python wrapper!

If I leave from_date and to_date to the default (None) I still get the same errors. If I supply datetime.utcnow() for both, I get

{'TIMESTAMP': '2018-03-10 16:13:19.622078', 'code': 'INVALID_REQUEST_DATA', 'message': 'Invalid fromDate. The fromDate must be a valid Iso8601 time.\r\nInvalid toDate. The toDate must be a valid Iso8601 time.', 'Latency': 0.156715}

so it seems that it does not recognize the strings as valid times. The API says that they want ISO 8601 in GMT. Maybe sending with / without TZ info and or milliseconds does the trick? I've tried some combinations but without any luck so far.

rozzac90 commented 6 years ago

have you installed the updated version via pip? also you could supply datetime.datetime.utcnow().isoformat() which should handle transforming the datetime to isoformat.

r-raymond commented 6 years ago

I have (on version 0.0.7). You mean supply to form_date and to_date, or change your code?

rozzac90 commented 6 years ago

If you supply the from_date and to_date in .isoformat() rather than datetime format I think it should work.

r-raymond commented 6 years ago

Unfortunately that does not help. I'm still getting the same errors.

r-raymond commented 6 years ago

Ok, after reverse engineering the R package they provide I was able to figure out a date format they accept: YYYY-MM-DD nothing else. I did try quite a lot of different versions to include times, but didn't get any to work. Ultimately I'm fine with just specifying the date.

xgshark commented 6 years ago

What format do you pass as a "since" parameter in api.market_data.get_odds(since=...)? I tried lots but nothing works. API reference wants in64.

xgshark commented 6 years ago

yesterday received "482352841" as value for "last"