alpacahq / Alpaca-API

The Alpaca API is a developer interface for trading operations and market data reception through the Alpaca platform.
https://alpaca.markets/
142 stars 13 forks source link

Account daytrade_count downloaded as int not string #88

Closed still-dreaming-1 closed 3 years ago

still-dreaming-1 commented 4 years ago

According to the documentation, the Account daytrade_count should be a string that contains an int, but the JSON that gets downloaded when I GET the account information, is actually just a regular int. This tripped me up temporarily when I switched over the v2 API, but now I got it working again. I don't know if this is a bug in the behavior or inaccurate or misleading information in the documentation. It was causing my code to throw an Exception until I changed that property to be an Int instead of a String (I am writing all my code in Kotlin by the way). Here is an example of some JSON I retrieved from the API (I removed most of it to emphasize the daytrade_count portion).

{"sma":"0","daytrade_count":0}

d-e-s-o commented 4 years ago

The documentation should be fixed. It should be an int in my opinion. String is only useful for floating point numbers to preserve precision. Can you submit a pull request?