Skip to content

Commit

Permalink
feat: Rewording position reduction to have actual desired behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
TomMcL committed Nov 14, 2023
1 parent 2110116 commit a2e780e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions protocol/0019-MCAL-margin_calculator.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ $$
\text{margin to remove} = \text{theoretical account balance} \cdot \frac{|\text{total size of new trades}|}{|\text{entire position prior to trade}|}
$$
Conceretely, this should resolve to:
$$
\text{margin to remove} = (\text{balance before} + \text{position before} \cdot (\text{new trade VWAP} - \text{mark price})) \cdot \frac{|\text{total size of new trades}|}{|\text{entire position prior to trade}|}
$$
Note: This requires a calculation of the position's margin at trade time.
### Changing Sides
Expand Down

0 comments on commit a2e780e

Please sign in to comment.