OneDeltaLivePricing#
API documentation for tradeexecutor.ethereum.one_delta.one_delta_live_pricing.OneDeltaLivePricing Python class in Trading Strategy framework.
- class OneDeltaLivePricing[source]#
Bases:
EthereumPricingModel
1delta live pricing.
- __init__(web3, pair_universe, routing_model, very_small_amount=Decimal('0.10'), epsilon=0.001)[source]#
- Parameters:
web3 (Web3) –
pair_universe (PandasPairUniverse) –
routing_model (OneDeltaRouting) –
very_small_amount (float) –
epsilon (float | None) –
Methods
__init__
(web3, pair_universe, routing_model)check_supported_quote_token
(pair)get_buy_price
(ts, pair, reserve)Get live price on Uniswap.
get_mid_price
(ts, pair)Get the mid price from Uniswap pool.
get_pair_fee
(ts, pair)Estimate the trading/LP fees for a trading pair.
get_pair_for_id
(internal_id)Look up a trading pair.
get_quote_token_tvl
(timestamp, pair)Get the raw TVL of a trading pair.
get_sell_price
(ts, pair, quantity)Get live price on Uniswap.
get_uniswap
(target_pair)Helper function to speed up Uniswap v2 or v3 deployment resolution.
get_usd_tvl
(timestamp, pair)Get the TVL of a trading pair.
quantize_base_quantity
(pair, quantity[, ...])Convert any base token quantity to the native token units by its ERC-20 decimals.
set_trading_fee_override
(trading_fee_override)Set the trading fee override.
validate_mid_price_for_buy
(lp_fee, price, ...)Validate the mid price calculation for a buy trade.
validate_mid_price_for_sell
(lp_fee, ...)Validate the mid price calculation for a sell trade.
- __init__(web3, pair_universe, routing_model, very_small_amount=Decimal('0.10'), epsilon=0.001)[source]#
- Parameters:
web3 (Web3) –
pair_universe (PandasPairUniverse) –
routing_model (OneDeltaRouting) –
very_small_amount (float) –
epsilon (float | None) –
- get_uniswap(target_pair)[source]#
Helper function to speed up Uniswap v2 or v3 deployment resolution.
- Parameters:
target_pair (TradingPairIdentifier) –
- get_sell_price(ts, pair, quantity)[source]#
Get live price on Uniswap.
- Parameters:
ts (datetime) –
pair (TradingPairIdentifier) –
- Return type: