polygon-io / client-python

The official Python client library for the Polygon REST and WebSocket API.
https://polygon-api-client.readthedocs.io/
MIT License
744 stars 204 forks source link

Technical Indicators incorrect Time Conversion #689

Open TheBlackPlague opened 2 weeks ago

TheBlackPlague commented 2 weeks ago

Describe the bug The time conversion is done from datetime when querying for technical indicators is to a nanoseconds resolution which conflicts with what Polygon is expecting (milliseconds). This, in turn, leads to Polygon thinking the wrong period is queried.

Code Links

As you can see, this is different from the way say the Aggregates call is done: https://github.com/polygon-io/client-python/blob/b47b85245c24dcfd116ee93338ceba0c5f341f77/polygon/rest/aggs.py#L41-L45

The aggregates call is the right way. The SMA indicator also expects a millisecond timestamp: https://polygon.io/docs/stocks/get_v1_indicators_sma__stockticker

justinpolygon commented 2 weeks ago

Thanks for reporting. I'll check this out.