zetamarkets / sdk

SDK for accessing the Zeta program
Other
85 stars 29 forks source link

Allow overrides in unrealised PnL calcs #218

Closed filipzeta closed 1 year ago

filipzeta commented 1 year ago

On FE you can be shown a positive PnL, but then actually lose money when you go to close that position due to

  1. Taker fees
  2. Orderbook spread

This PR accounts for those to hopefully show a more accurate PnL number. FE will feed the webserver's orderbook toplevel into calculateUnrealizedPnl instead of using the mark price

filipzeta commented 1 year ago

Some local verification. I'm in a long SOL-PERP position of 4 lots.

image image