Posted By: AndrewAMD
Ally Invest API - BrokerTime makes so many requests - 05/26/17 21:06
Hi,
I'm writing an Ally Invest plugin for the community, and I hit a snag.
Ally's API uses rate limiting.
https://www.ally.com/api/invest/documentation/rate-limiting/
Basically, you can only make so many requests per minute, depending on the type of request you make. Actually, their website says that this only applies to authenticated requests, but I just found out the hard way that this also applies to unauthenticated requests.
Here's what the server returned to me when my Zorro plugin makes unauthenticated clock requests:
Is there a practical way to limit the number of clock requests that I send to the server without depriving Zorro of connectivity status?
EDIT: While we're on the topic, I'm using Zorro's HTTP request/response system. Is there a way to parse the response headers? i.e. this kind of text:
EDIT2: Just got back from vacation.
Instead of forcing all function calls to get the server clock, I guess I'll just only grab it once every five seconds. Between each actual call, I will emulate the clock by adding milliseconds to the most recently parsed date/time.
I'm writing an Ally Invest plugin for the community, and I hit a snag.
Ally's API uses rate limiting.
https://www.ally.com/api/invest/documentation/rate-limiting/
Basically, you can only make so many requests per minute, depending on the type of request you make. Actually, their website says that this only applies to authenticated requests, but I just found out the hard way that this also applies to unauthenticated requests.
Here's what the server returned to me when my Zorro plugin makes unauthenticated clock requests:
Code:
<?xml version="1.0"?> <string>API calls quota exceeded! maximum admitted 180 per Minute.</string>
Is there a practical way to limit the number of clock requests that I send to the server without depriving Zorro of connectivity status?
EDIT: While we're on the topic, I'm using Zorro's HTTP request/response system. Is there a way to parse the response headers? i.e. this kind of text:
Code:
HTTP/1.1 200 OK Content-Length: 6024 Content-Type: application/xml; charset=UTF-8 Date: Wed, 16 Mar 2011 14:51:44 GMT Server: Apache-Coyote/1.1 X-RateLimit-Used: 8 X-RateLimit-Expire: 1300286940 X-RateLimit-Limit: 60 X-RateLimit-Remaining: 52
EDIT2: Just got back from vacation.
Instead of forcing all function calls to get the server clock, I guess I'll just only grab it once every five seconds. Between each actual call, I will emulate the clock by adding milliseconds to the most recently parsed date/time.