BacktestSimplePricingModel#
tradeexecutor.backtest.backtest_pricing.BacktestSimplePricingModel class.
- class BacktestSimplePricingModel[source]#
Bases:
PricingModel
Look the price without any liquidity data or price impact.
Use naive closing price.
- __init__(candle_universe, routing_model, candle_timepoint_kind='close', very_small_amount=Decimal('0.10'))[source]#
- Parameters
candle_universe (GroupedCandleUniverse) –
routing_model (RoutingModel) –
Methods
__init__
(candle_universe, routing_model[, ...])check_supported_quote_token
(pair)get_buy_price
(ts, pair, reserve)Get the sell price for an asset.
get_pair_for_id
(internal_id)Look up a trading pair.
get_sell_price
(ts, pair, quantity)Get the sell price for an asset.
quantize_base_quantity
(pair, quantity[, ...])Convert any base token quantity to the native token units by its ERC-20 decimals.
- __init__(candle_universe, routing_model, candle_timepoint_kind='close', very_small_amount=Decimal('0.10'))[source]#
- Parameters
candle_universe (GroupedCandleUniverse) –
routing_model (RoutingModel) –
- get_pair_for_id(internal_id)[source]#
Look up a trading pair.
Useful if a strategy is only dealing with pair integer ids.
- Parameters
internal_id (int) –
- Return type
- get_sell_price(ts, pair, quantity)[source]#
Get the sell price for an asset.
- Parameters
ts (datetime) – When to get the price. Used in backtesting. Live models may ignore.
pair (TradingPairIdentifier) – Trading pair we are intereted in
quantity (Optional[Decimal]) – If the sel quantity is known, get the price with price impact.
- Return type
- get_buy_price(ts, pair, reserve)[source]#
Get the sell price for an asset.
- Parameters
ts (datetime) – When to get the price. Used in backtesting. Live models may ignore.
pair (TradingPairIdentifier) – Trading pair we are intereted in
reserve (Optional[Decimal]) – If the buy token quantity quantity is known, get the buy price with price impact.
- Return type
- quantize_base_quantity(pair, quantity, rounding='ROUND_DOWN')[source]#
Convert any base token quantity to the native token units by its ERC-20 decimals.
- Parameters
pair (TradingPairIdentifier) –
quantity (Decimal) –
- Return type