QuoteTokenTVLSizeRiskModel#
API documentation for tradeexecutor.strategy.tvl_size_risk.QuoteTokenTVLSizeRiskModel Python class in Trading Strategy framework.
- class QuoteTokenTVLSizeRiskModel[source]#
Bases:
BaseTVLSizeRiskModel
Estimate the trade size based on raw quote tokens.
Directly query onchain value for the available liquidity in quote token, but slow as we need to use onchain data source
Imppossible to spoof
May not give accurate values
Not finished
- __init__(pair_universe, routing_model, pricing_model, per_trade_cap=1.0, per_position_cap=1.0)[source]#
- Parameters:
per_trade_cap (float) – Maximum US dollar value of a single trade, or unlimited.
pair_universe (PandasPairUniverse) –
routing_model (RoutingModel) –
pricing_model (PricingModel) –
per_position_cap (float) –
Methods
__init__
(pair_universe, routing_model, ...)- param per_trade_cap:
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.
get_usd_conversion_rate
(timestamp, path)For multi-legged trades, get the USD conversion rate of the last leg.
- __init__(pair_universe, routing_model, pricing_model, per_trade_cap=1.0, per_position_cap=1.0)[source]#
- Parameters:
per_trade_cap (float) – Maximum US dollar value of a single trade, or unlimited.
pair_universe (PandasPairUniverse) –
routing_model (RoutingModel) –
pricing_model (PricingModel) –
per_position_cap (float) –
- get_tvl(timestamp, pair)[source]#
Read the TVL from the underlying pricing model.
- Parameters:
timestamp (datetime) –
pair (TradingPairIdentifier) –
- Return type:
- get_usd_conversion_rate(timestamp, path)[source]#
For multi-legged trades, get the USD conversion rate of the last leg.
E.g. when trading USD->ETH->BTC get the USD/ETH price and then we get BTC/USD price by multiplying ETH/BTC price with this.
- Parameters:
timestamp (datetime) –
path (list[tradeexecutor.state.identifier.TradingPairIdentifier]) –
- Return type: