Petersoj / alpaca-java

A Java API for Alpaca, the commission free, algo friendly, stock trading broker. https://alpaca.markets
https://petersoj.github.io/alpaca-java/
MIT License
198 stars 84 forks source link

Update FormatUtil.java #107

Closed cloudygeek closed 3 years ago

cloudygeek commented 3 years ago

TimeZone Bug

cloudygeek commented 3 years ago

When your computer is in a timezone different to the exchange it was incorrectly converting. So I switched out your custom formatter to one of the built in Java ISO 8601 formatters. I tested against live Alpaca data and confirmed was returning the right date with the fix. without the fix it was not correctly providing the right time to alpaca.

Petersoj commented 3 years ago

Looks good! Yeah Alpaca used to have a bug with the start and end timestamps when using the RFC 3339 format that would ignore the timezone in the request and serve all data based on the America/New_York timezone. Glad they fixed it finally! I'll publish a patch right now.