FreqtradePricingModel#
API documentation for tradeexecutor.strategy.freqtrade.freqtrade_pricing.FreqtradePricingModel Python class in Trading Strategy framework.
- class FreqtradePricingModel[source]#
Bases:
PricingModelPrice Freqtrade positions by querying Freqtrade REST API.
Freqtrade positions track capital allocation to a Freqtrade bot instance. Pricing is always 1.0 (1:1 ratio with reserve currency like USDT).
- __init__(freqtrade_clients)[source]#
Initialize pricing model.
- Args:
freqtrade_clients: Dict mapping freqtrade_id -> FreqtradeClient
- Parameters:
freqtrade_clients (dict[str, tradeexecutor.strategy.freqtrade.freqtrade_client.FreqtradeClient]) –
Methods
__init__(freqtrade_clients)Initialize pricing model.
calculate_trade_adjusted_slippage_tolerance(...)Get slippage for a given trading pair, for a given trade.
get_buy_price(ts, pair, reserve)Get price for depositing to Freqtrade.
get_mid_price(ts, pair)Get mid price (always 1.0 for Freqtrade).
get_pair_fee(ts, pair)Get trading fee for the pair.
get_quote_token_tvl(timestamp, pair)Get the raw TVL of a trading pair.
get_sell_price(ts, pair, quantity)Get price for withdrawing from Freqtrade.
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.
- __init__(freqtrade_clients)[source]#
Initialize pricing model.
- Args:
freqtrade_clients: Dict mapping freqtrade_id -> FreqtradeClient
- Parameters:
freqtrade_clients (dict[str, tradeexecutor.strategy.freqtrade.freqtrade_client.FreqtradeClient]) –
- get_buy_price(ts, pair, reserve)[source]#
Get price for depositing to Freqtrade.
When depositing to Freqtrade, 1 USDT = 1 USDT (1:1 ratio).
- Args:
ts: Timestamp pair: Freqtrade trading pair reserve: Amount of reserve currency being deposited
- Returns:
TradePricing with price=1.0
- Parameters:
ts (datetime) –
pair (TradingPairIdentifier) –
- Return type:
- get_sell_price(ts, pair, quantity)[source]#
Get price for withdrawing from Freqtrade.
When withdrawing from Freqtrade, 1 tracked USDT = 1 USDT withdrawn.
- Args:
ts: Timestamp pair: Freqtrade trading pair quantity: Amount of tracked units being withdrawn
- Returns:
TradePricing with price=1.0
- Parameters:
ts (datetime) –
pair (TradingPairIdentifier) –
- Return type:
- get_mid_price(ts, pair)[source]#
Get mid price (always 1.0 for Freqtrade).
- Args:
ts: Timestamp pair: Freqtrade trading pair
- Returns:
Mid price (always 1.0)
- Parameters:
ts (datetime) –
pair (TradingPairIdentifier) –
- Return type: