The client
with Qelso() as client:) to close its connections when you’re done. AsyncQelso is the same client for asyncio.
The methods
Each endpoint has a method named after it, and the endpoints that page or stream have two more.
The same pattern covers every endpoint: series, events, lifecycle, candles, statistics, books, best bid and ask, and book changes. Parameters keep the API’s names. Times can be strings, dates, epoch milliseconds or
datetime objects; a datetime without a timezone is taken as UTC.
Pages
limit is the page size: the larger the page, the fewer the requests.
Streams
A stream returns a whole window in one request. If the connection breaks, the SDK resumes after the last row it received, so no row is repeated or skipped. Once rows are flowing, a request that fails is tried again after 1, 2, 4 … up to 30 seconds (or as long asRetry-After asks), so an outage is waited out; max_resumes (10 by default) counts failures in a row, and any new row resets it.
save(path) writes to path.part and renames it only when the stream has ended normally. If the stream fails anyway, the .part file keeps what arrived, and save(path, resume=True) on a new stream with the same parameters carries on from its last row. stream.resume_after gives the after= to continue from.
DataFrames
to_pandas() works on every pager and stream. Times become UTC timestamps, and columns follow the API’s field order. Books come in long form, one row per price level: t, last_change, side, level (0 is the best), price, size.
Errors and retries
All of them are
qelso.QelsoError. The client retries rate limits (after Retry-After), temporary outages and network errors, up to max_retries times (3 by default). It never retries a used-up quota or a query that ran over its time limit.
Every response has response_meta: its request ID, the units it cost and your remaining rate limit.
Async
New fields and values
v2 changes only by addition. The SDK reads fields and values added later without breaking your code: new fields appear in each model’smodel_extra, and new venues, datasets or error codes come through as plain strings.