Client

class tradingstrategy.client.Client

An API client for querying the Capitalgram candle server.

This client will download and manage cached datasets.

__init__(env: tradingstrategy.environment.base.Environment, transport: tradingstrategy.transport.cache.CachedHTTPTransport)

Do not call constructor directly, but use one of create methods.

fetch_pair_universe() pyarrow.lib.Table

Fetch pair universe from local cache or the candle server.

The compressed file size is around 5 megabytes.

fetch_exchange_universe() tradingstrategy.exchange.ExchangeUniverse

Fetch list of all exchanges form the dataset server.

fetch_all_candles(bucket: tradingstrategy.timebucket.TimeBucket) pyarrow.lib.Table

Get cached blob of candle data of a certain candle width.

The returned data can be between several hundreds of megabytes to several gigabytes and is cached locally.

The returned data is saved in PyArrow Parquet format.

For more information see tradingstrategy.candle.Candle.

fetch_all_liquidity_samples(bucket: tradingstrategy.timebucket.TimeBucket) pyarrow.lib.Table

Get cached blob of liquidity events of a certain time window.

The returned data can be between several hundreds of megabytes to several gigabytes and is cached locally.

The returned data is saved in PyArrow Parquet format.

For more information see tradingstrategy.liquidity.XYLiquidity.

fetch_chain_status(chain_id: tradingstrategy.chain.ChainId) dict

Get live information about how a certain blockchain indexing and candle creation is doing.

classmethod preflight_check()

Checks that everything is in ok to run the notebook

classmethod setup_notebook()

Setup diagram rendering and such.

Force high DPI output for all images.

classmethod create_jupyter_client(cache_path: Optional[str] = None, api_key: Optional[str] = None) tradingstrategy.client.Client

Create a new API client.

Parameters

cache_path – Where downloaded datasets are stored. Defaults to ~/.cache.

classmethod create_test_client(cache_path=None) tradingstrategy.client.Client

Create a new Capitalgram clienet to be used with automated test suites.

Reads the API key from the environment variable CAPITALGRAM_API_KEY. A temporary folder is used as a cache path.