Closed lavolp3 closed 5 years ago
Api is called by pooling cycle. If you have 10 stock symbols to watch, 150secs will be taken to get one cycle of the infos with 10 api calls.
Hmmm.. Strange... I can swear there was no daily limit for free acount. (https://d28lcup14p4e72.cloudfront.net/221587/3958291/API%20call%20limits.png) But it seems being changed. What the....
There is definitely. 500 calls per day. You get this number with the message if it exceeds.
I know of the pooling cycle, but I don't know the timer function well. Is the api call looped all the time like in a for loop?
Pooler has the list to query targets. Then, per each interval (15 sec), it pops one target out from Pooler and query it. The result would be sent to Module's main script to update value. If there is no remained item in the Pooler, Pooler would be refreshed and do again.
Anyway, until Last year, there was no limit per day, only limit per minutes. So I have to remake this module newly. Fortunately, they provide Multi-symbol batch query since Dec 28, 2017, and I think this is the reason why they limit daily quota.
How about just implementing 2 timers? One for the pooler and one for the update function? Basically you just need the timer for the update to be controlled. The pooler timer can then be fixed to 20 seconds
I'm using just one timer. https://github.com/eouia/MMM-AVStock/blob/master/node_helper.js#L50 See the https://github.com/eouia/MMM-AVStock/blob/master/node_helper.js#L39 also.
Ok. I've updated.
The free API limit is 500 calls per day. How is the call frequency organized in the module. If I understand correctly via the timer function. If the module calls the price every 13-15 seconds like in the config, the limit will be reached after 2 hours (125 min = 500 * 15 sec). Is that right? We'd need to have a timer for the pooling requests and then another frequency for further calls.