Formula

Funding

  1. fundingRate = (markPrice-IndexPrice)/24

    +ve → Long will pay -ve → Short will pay

  2. averageValue = (markPrice+IndexPrice)/2

  3. percentage = (fundingRate / avgValue) * 10

  4. distributing funding perPositionRate = fundingPayment/totalPosition*100 positionSize * perPositionRate

Price Impact ,Long , Short

Open long

old per usd = Vmm usd / Vmm xtz

x=(k / vmm usd + position size)- vmm xtz

new per usd = position size / x

price impact =((new per usd - old per usd ) * 100) / (old per usd ))

Close Long

old per xtz= vmm xtz / vmm usd

x= vmm usd - (k/ Vmm xtz + Closing Position (In XTZ))

new per xtz= closing position xtz / x

price impact =((new per xtz - old per xtz) * 100) / (old per xtz))

Open Short

old per xtz= vmm xtz/ vmm usd

x=(k / (vmm usd - position in usd))-vmm xtz

new per xtz= x / position

price impact = (new per xtz - old per xtz)*100/ old per xtz

Close Short

old per usd = vmm usd / vmm xtz

x=(k/ (vmm xtz - Closing position in xtz ))-vmm usd

new per usd = x / xtz(closing position)

price impact = (new per usd - old per usd)*100/ old per usd

Expected Close Price

Expected close price = market price - ( Price Impact / 100 )

Update VMM

k = constant (x * y = k ) x = usd , y = xtz

Open Long

vmm usd = vmm usd+ Position * Leverage

vmm xtz = VMM Xtz - x ( Refer above section to calculate x)

Closing Long

vmm usd= vmm usd - x

vmm xtz = vmm xtz + closing position

Open Short

vmm usd = vmm USD - position * Leverage

vmm xtz = Vmm xtz + x

Close Short

vmm xtz = vmm xtz - Closing Position

vmm usd = vmm usd + x

Last updated