terra-revival / backtest

Python backtesting engine for USTC or any Terra Classic Stable Algos
Other
6 stars 2 forks source link

Implement the buyback/tax logic #37

Open Kyjaque opened 1 year ago

Kyjaque commented 1 year ago

The final specs of the taxing/buybacks of a CEX

ExecutionPrice < PegPrice or (ExecutionPrice > PegPrice and PegPrice = 1) => T = Abs(PegPrice - ExecutionPrice) (1 - ArbitrageCoefficient) TaxPercentage = 2 T / PegPrice TaxTotal = TaxPercentage * ValueInXXX

ExecutionPrice > PegPrice and PegPrice < 1 => TaxTotal = 0

notes:

ArbitrageCoefficient is used when PegPrice = 1 to allow profit for traders, so volume does not dries up TaxPercentage is capped at 1.0 (we tax 100% at 50% price difference and not more) Sell side receives Value of XXX - TotalTax

Buy side receives Volume of USTC

LUNC "account" receives TaxTotal (1 - CexTaxCoefficient) CEX receives TaxTotal CexTaxCoeffiecient

Kyjaque commented 1 year ago

image