Abstract Class Reference¶
- class aio_trader.AbstractBroker.AbstractBroker¶
Bases:
ABCBase class for all Broker classes
- async __aenter__()¶
On entering async context manager
- async __aexit__(*_)¶
On exiting async context manager
- _initialise_session(headers: dict, throttlers: List[Throttler])¶
Start a aiohttp.ClientSession and assign a default throttler
- abstractmethod async authorize(**kwargs)¶
Authorize the user
- async close()¶
Close the Requests session
- __weakref__¶
list of weak references to the object
- class aio_trader.AbstractFeeder.AbstractFeeder¶
Bases:
ABCBase class for all Market Feeds
- async __aenter__()¶
On entering async context manager
- async __aexit__(*_)¶
On exiting async context manager
- __init__() None¶
- _initialise_session()¶
Start a aiohttp.ClientSession
- abstractmethod async close()¶
Close the websocket connection and allow for graceful shutdown
- abstractmethod async connect()¶
Connect to websocket and handle incoming messages
- __weakref__¶
list of weak references to the object
- aio_trader.AbstractFeeder.retry(max_retries=5, base_wait=2, max_wait=60, reset_retry_after=30)¶
Decorator that retries an async function or method using exponential backoff when network-related exceptions occur.
Retries are attempted up to max_retries times, with the delay between retries growing exponentially based on base_wait, capped at max_wait.
If a connection remains stable for longer than reset_retry_after seconds (i.e., the time since the last successful call exceeds this threshold), the retry counter is reset to zero.
Retrying stops immediately on certain errors (e.g., client response errors), and the wrapped instance is closed before exiting.
- Parameters:
max_retries (int) – Maximum number of retry attempts before giving up. Default is 5.
base_wait (float) – Initial delay in seconds before the first retry. Each subsequent retry doubles this value. Default is 2.
max_wait (float) – Maximum delay in seconds between retries. Default is 60.
reset_retry_after (float) – Time in seconds after which a stable connection resets the retry counter. Default is 30.
Usage:
@retry(max_retries=5, base_wait=2, max_wait=60, reset_retry_after=30) async def your_function_or_method(*args, **kwargs): # Your function or method logic goes here pass