USDTVLSizeRiskModel#
API documentation for tradeexecutor.strategy.tvl_size_risk.USDTVLSizeRiskModel Python class in Trading Strategy framework.
- class USDTVLSizeRiskModel[source]#
Bases:
BaseTVLSizeRiskModel
Estimate the trade size based historical USD TVL values.
Fast as we have preprocessed data available
Some tokens may spoof this value and give unrealistic sizes
- __init__(pricing_model, per_trade_cap=1.0, per_position_cap=1.0, missing_tvl_placeholder_usd=None)[source]#
Create size-risk model.
- Parameters:
pricing_model (PricingModel) – Pricing model is used to read TVL data (historical/real time)
per_trade_cap (float) – How many % of pool TVL on trade can be
per_position_cap (float) – How many % of pool TVL on trade can be
missing_tvl_placeholder_usd (float) –
- Parma missing_tvl_placeholder_usd:
If we do not have TVL data available, use this value as a fixed US value placeholder.
E.g. set to 250_000 to assume all unknown pools to have 250k TVL at any point of time.
Methods
__init__
(pricing_model[, per_trade_cap, ...])Create size-risk model.
get_acceptable_size_for_buy
(timestamp, pair, ...)get_acceptable_size_for_position
(timestamp, ...)What this the maximum position amount.
get_acceptable_size_for_sell
(timestamp, ...)get_pair_cap
(pair, sizing_type)Get cap for an individual trade for a pair.
get_tvl
(timestamp, pair)Read the TVL from the underlying pricing model.
- __init__(pricing_model, per_trade_cap=1.0, per_position_cap=1.0, missing_tvl_placeholder_usd=None)[source]#
Create size-risk model.
- Parameters:
pricing_model (PricingModel) – Pricing model is used to read TVL data (historical/real time)
per_trade_cap (float) – How many % of pool TVL on trade can be
per_position_cap (float) – How many % of pool TVL on trade can be
missing_tvl_placeholder_usd (float) –
- Parma missing_tvl_placeholder_usd:
If we do not have TVL data available, use this value as a fixed US value placeholder.
E.g. set to 250_000 to assume all unknown pools to have 250k TVL at any point of time.