Abstract Class Reference

class aio_trader.AbstractBroker.AbstractBroker

Bases: ABC

Base 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

abstract 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: ABC

Base 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

abstract async close()

Close the websocket connection and allow for graceful shutdown

abstract 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)

Decorator that retries a function or method with exponential backoff in case of exceptions.

Retry terminates if response code is 403: Session Expired

Parameters:
  • max_retries (float) – The maximum number of retry attempts. Default 50

  • base_wait – The initial delay in seconds before the first retry. Default 2

  • max_wait_time (float) – The maximum delay in seconds between retries. Default 60

Usage:

@retry(max_retries=5, base_wait=2, max_wait=60)
async def your_function_or_method(*args, **kwargs):
    # Your function or method logic goes here
    pass