vegaprotocol / specs

Specs, designs and requirements 🦔
MIT License
7 stars 2 forks source link

As a trader I can see what margin my positions incur so that I can manage my available capital. #40

Closed ashleyvega closed 4 years ago

ashleyvega commented 4 years ago

In GitLab by @tamlyn10 on Jul 19, 2018, 06:36

null

ashleyvega commented 4 years ago

In GitLab by @tamlyn10 on Jul 19, 2018, 06:38

Every net position on an order book will have a collateral / margin requirement. This is a combination of

  1. The Unrealised P&L (or Mark to Market) of the position (see glossary).

This Unrealised P&L will also be displayed alongside a trader's open positions as per another card.

  1. The forward risk component which is calculated by the Risk Model.

The risk model will return two quantities/factors (one for long positions and the other for short positions). Let's call them the risk factor long and the risk factor short.

Each trader's net position value (mark price volume min contract size ) is multiplied by the appropriate factor to calculate the forward risk

For example, if a trader has a long 5 position and the long factor = 0.04, the forward risk component of their margin equals 0.04 5 mark price volume minimum contract size (see Glossary).

ashleyvega commented 4 years ago

In GitLab by @tamlyn10 on Jul 19, 2018, 06:52

Acceptance Criteria:

ashleyvega commented 4 years ago

In GitLab by @tamlyn10 on Jul 19, 2018, 06:58

@davidsiska-vega and @barnabee is the above process how you see it working? (I'll add more detail about how that risk model runs in parallel)

ashleyvega commented 4 years ago

In GitLab by @barnabee on Jul 24, 2018, 11:41

Looks about right

ashleyvega commented 4 years ago

In GitLab by @davidsiska-vega on Jul 24, 2018, 15:22

Hi Tamlyn,

Two comments. 1) I am not convinced that every margin for every product will neatly factorise into P&L + forward risk (especially if we ever want to consider non-zero interest rate). But happy to go with it so far as it works well for forwards. 2) The second acceptance criteria is not correct as far as I am concerned. Consider three portfolios A, B, C. In A I have a long forward (with corresponding margin on 0.1). In portfolio B I have a short contract with a corresponding margin of 0.2. In portfolio C I have a long and short which offset each other so the margin ought to be 0. But your acceptance criteria indicates it would be 0.3.

Instead the total margin should be: we calculate the overall P&L and the overall netted number of longs or shorts; and then the overall margin is: the overall P&L + mark price volume minimum contract size number of units (risk factor for long or short as appropriate).

Cheers, David

ashleyvega commented 4 years ago

In GitLab by @tamlyn10 on Jul 25, 2018, 16:25

Hi David,

Regarding point 2, I've edited the acceptance criteria to better capture what I meant. Please let me know if you now agree. Thank you!

ashleyvega commented 4 years ago

In GitLab by @davidsiska-vega on Jul 25, 2018, 16:36

Looks good now!

I think previously I was reading both 1st and 2nd acceptance criteria different to how they were intended.

ashleyvega commented 4 years ago

In GitLab by @tamlyn10 on Jul 25, 2018, 17:33

Yes, I hadn't written them well. Thank you!

ashleyvega commented 4 years ago

In GitLab by @edd on Sep 24, 2018, 15:32

closed