TradePricing#

tradeexecutor.strategy.pricing_model.TradePricing Python class in Trading Strategy framework.

class TradePricing[source]#

Bases: object

Describe price results for a price query.

  • Each price result is tied to quantiy/amount

  • Each price result gets a split that describes liquidity provider fees

A helper class to deal with problems of accounting and estimation of prices on Uniswap like exchange.

__init__(price, mid_price, lp_fee=None, pair_fee=None, market_feed_delay=None, side=None)#
Parameters:
Return type:

None

Methods

__init__(price, mid_price[, lp_fee, ...])

Attributes

price

The price we expect this transaction to clear.

mid_price

The "fair" market price during the transaction.

lp_fee

How much liquidity provider fees we are going to pay on this trade.

pair_fee

What was the LP fee % used as the base of the calculations.

market_feed_delay

How old price data we used for this estimate

side

Is this buy or sell trade.

price: float#

The price we expect this transaction to clear.

This price has LP fees already deducted away from it. It may or may not include price impact if liquidity data was available for the pricing model.

mid_price: float#

The “fair” market price during the transaction.

This is the mid price - no LP fees, price impact, etc. included.

lp_fee: Optional[float]#

How much liquidity provider fees we are going to pay on this trade.

Set to None if data is not available.

pair_fee: Optional[float]#

What was the LP fee % used as the base of the calculations.

market_feed_delay: Optional[timedelta]#

How old price data we used for this estimate

side: Optional[bool]#

Is this buy or sell trade.

True for buy. False for sell. None for Unknown.

__init__(price, mid_price, lp_fee=None, pair_fee=None, market_feed_delay=None, side=None)#
Parameters:
Return type:

None