dominiktraxl/pykrakenapi

Public call rate limiter consider first call is too fast

Closed this issue · 4 comments

Hi,

Like the title says, I think the last change causes pykrakenapi to consider that the first public call is too fast, even if it's the first one.

In a second thought, is it possible to keep the call rate limiter, public or private, but silence it so it doesn't "spam" the console ?

It works for me as expected. If I run this:

import krakenex, pykrakenapi
k = pykrakenapi.KrakenAPI(krakenex.API())
print(k.get_server_time())
print(k.get_server_time())

I get the first print out right away, the second one is delayed by the call-rate limiter:

(Timestamp('2020-06-01 09:25:47+0000', tz='UTC'), 1591003547)
public call frequency exceeded (seconds=0.269578) 
 sleeping for 5 seconds
(Timestamp('2020-06-01 09:25:53+0000', tz='UTC'), 1591003553)

Silencing the call-rate limiter is not possible at the moment, but it seems like a good idea to allow for that. I'll implement a verbose argument as soon as I get to it.

Well, I should have done something wrong. I went through all my code and placed prints just before all the call, either public or private, just to be sure, and after the first "Public call" print, I got

public call frequency exceeded (seconds=0.643) 
 sleeping for 5 seconds

without having a second "Public call" printed out.
Might it be an update that I didn't make ?

Could you please provide a minimal example, including a printout of the version

import pykrakenapi
print(pykrakenapi.__version__)
import pykrakenapi
import locale
import krakenex
from pykrakenapi import KrakenAPI

locale.setlocale(locale.LC_TIME, '')
krakenkey = "kraken.key"
api = krakenex.API()
api.load_key(krakenkey)
k = KrakenAPI(api)
print("Going to make a public call.")
trades = k.get_recent_trades("XXBTZEUR")
print("Made public call.")
print(pykrakenapi.__version__)
Going to make a public call.
public call frequency exceeded (seconds=0.0)
 sleeping for 5 seconds
Made public call.
0.1.7

It's my bad. I'm not up to date. We'll try this in 0.1.8.

Going to make a public call.
Made public call.
0.1.8

Alrighty ☹️