XYLiquidity#
tradingstrategy.liquidity.XYLiquidity Python class in Trading Strategy framework.
- class XYLiquidity[source]#
Bases:
object
Data structure that presents liquidity status in bonding curve pool.
This data structure is for naive x*y=k AMM pool. Liquidity is not the part of the normal technical analysis, so the dataset server has separate datasets for it.
Liquidity is expressed as US dollar value of the quote token of the pool. For example if the pool is 50 $FOO in reserve0 and 50 $USDC in reserve1, the liquidity of the pool would be expressed as 50 USD.
Liquidity events, like candles, have open, high, low and close values, depending on which time of the candle they were sampled.
- __init__(pair_id, timestamp, exchange_rate, open, close, high, low, adds, removes, syncs, add_volume, start_block, end_block)#
Methods
__init__
(pair_id, timestamp, exchange_rate, ...)from_dict
(kvs, *[, infer_missing])from_json
(s, *[, parse_float, parse_int, ...])schema
(*[, infer_missing, only, exclude, ...])Return emptry Pandas dataframe presenting liquidity sample.
to_dict
([encode_json])to_json
(*[, skipkeys, ensure_ascii, ...])to_pyarrow_schema
([small_candles])Construct schema for writing Parquet filess for these candles.
Attributes
Primary key to identity the trading pair Use pair universe to map this to chain id and a smart contract address
Open timestamp for this time bucket.
USD exchange rate of the quote token used to convert to dollar amounts in this time bucket.
Liquidity absolute values in the pool in different time points.
Liquidity absolute values in the pool in different time points
Liquidity absolute values in the pool in different time points
Liquidity absolute values in the pool in different time points
Number of liquidity supplied events for pool
Number of liquidity removed events for the pool
Number of total events affecting liquidity during the time window.
How much new liquidity was removed, in the terms of the quote token converted to US dollar
Blockchain tracking information
Blockchain tracking information
- pair_id: int#
Primary key to identity the trading pair Use pair universe to map this to chain id and a smart contract address
- exchange_rate: float#
USD exchange rate of the quote token used to convert to dollar amounts in this time bucket.
Note that currently any USD stablecoin (USDC, DAI) is assumed to be 1:1 and the candle server cannot handle exchange rate difference among stablecoins.
The rate is taken at the beginning of the 1 minute time bucket. For other time buckets, the exchange rate is the simple average for the duration of the bucket.
- open: float#
Liquidity absolute values in the pool in different time points. Note - for minute candles - if the candle contains only one event (mint, burn, sync) the open liquidity value is the value AFTER this event. The dataset server does not track the closing value of the previous liquidity event. This applies for minute candles only.
- syncs: int#
Number of total events affecting liquidity during the time window. This is adds, removes AND swaps AND sync().
- add_volume: float#
How much new liquidity was removed, in the terms of the quote token converted to US dollar
- classmethod to_pyarrow_schema(small_candles=False)[source]#
Construct schema for writing Parquet filess for these candles.
- Parameters:
small_candles – Use even smaller word sizes for frequent (1m) candles.
- Return type:
Schema
- classmethod to_dataframe()[source]#
Return emptry Pandas dataframe presenting liquidity sample.
- Return type:
- __init__(pair_id, timestamp, exchange_rate, open, close, high, low, adds, removes, syncs, add_volume, start_block, end_block)#