PriceImpact#

tradingstrategy.priceimpact.PriceImpact class.

class PriceImpact[source]#

Bases: object

How much price impact a potential trade would have.

Because how Uniswap v2 like DEXes operate, liquidity provider and protocol fees are included within the price impact calculations. Depending on the example these fees are not included in the calculations.

This PriceImpact data also includes separate liquidity provider and protocol fees, as for trading companies these fees might be tax deductible.

TODO: These fees are not yet confirmed with a live exchange.

__init__(available_liquidity, price_impact, delivered, lp_fees_paid, protocol_fees_paid, cost_of_trade)#
Parameters
Return type

None

Methods

__init__(available_liquidity, price_impact, ...)

Attributes

available_liquidity

Liquidity that was used for the price impact calculation, as expressed US dollars of one sided liquidity, see XYLiquidity.

price_impact

How much % worse execution you get because due to in availability of the liquidity.

delivered

How much worth of tokens you actually get for trade amount, expressed as US dollar

lp_fees_paid

How much LP fees are paid in this transaction

protocol_fees_paid

How much protocol fees are paid in this transaction

cost_of_trade

How much the trade cost you totally (trade amount - delivered) This includes LP fees paid, protocol fees paid and any loss because of limited liquidity.

available_liquidity: USDollarAmount#

Liquidity that was used for the price impact calculation, as expressed US dollars of one sided liquidity, see XYLiquidity.

price_impact: float#

How much % worse execution you get because due to in availability of the liquidity.

delivered: USDollarAmount#

How much worth of tokens you actually get for trade amount, expressed as US dollar

lp_fees_paid: USDollarAmount#

How much LP fees are paid in this transaction

protocol_fees_paid: USDollarAmount#

How much protocol fees are paid in this transaction

cost_of_trade: USDollarAmount#

How much the trade cost you totally (trade amount - delivered) This includes LP fees paid, protocol fees paid and any loss because of limited liquidity. This does not include gas fees (tx fees) for the network.

__init__(available_liquidity, price_impact, delivered, lp_fees_paid, protocol_fees_paid, cost_of_trade)#
Parameters
Return type

None