vegaprotocol / specs

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

Position Resolution when insufficient order book volume. #513

Closed tamlyn10 closed 1 year ago

tamlyn10 commented 3 years ago

In our position resolution spec, we say:

When there's insufficient volume on the order-book to close out a distressed position no action should be taken: the position remains open and any amounts in trader's margin account should stay there. Same principle should apply if upon next margin recalculation the position is still distressed.

We had to put this in because we didn't have liquidity monitoring or auctions but I think this is problematic for a few reasons:

  1. It's not clear from the way it's worded but since position resolution happens in a batch (all distressed traders are closed out together) this implies we don't partially reduce the credit risk in the market with the order book volume. Either all distressed traders are closed out or none.
  2. If we get to this position where we have distressed traders aren't able to be closed out on the order book, it means the liquidity monitoring parameters aren't set such that the market is put into a liquidity auction prior to this situation. Which means that there is increased risk of insurance pool usage during MTM and ultimately, socialised losses.
  3. Depending on the tau level set in the risk model, it may mean the effective-tau is > risk-model-tau which means the statistical "tuning" of the system is off (this mostly affects the insurance pool and the probability of socialised loss).

Proposed alternative approaches:

  1. Put the market into a liquidity monitoring auction in this instance to allow the lowest cost liquidation liquidity to be sourced. We'd need to think about what order type the network submits, what the call period is, exit conditions could just be as per normal exit from a liquidity monitoring auction I think.
  2. We use the order book volume to unwind the most distressed traders (in order), therefore leaving those with more "margin room" to wait until next margin calculation.
  3. We auto-boost the liquidity provider's order volume to cover the exit demand.

Other ideas? cc @davidsiska-vega @barnabee @witgaw

Note, I don't think this is a priority in the short term.

barnabee commented 3 years ago

I think option 3 is a no go because of the potential surprising impact of boosting it on the LPs risk/inventory.

I also agree with you that this isn't a priority short term and think we should avoid making a decision on this until we have data from testnet including liquidity monitoring.

The option not listed is to enforce a minimum target stake scaling factor that makes the scenario impossible. I think (though memory is rusty so may be wrong) that if target stake scaling factor is at least 1 then, as everything gets multiplied by the risk factor, you'd always be able to cover the max OI in the window (which is at least equal to the current OI) or you'd be in an auction anyway, so I am not sure that this scenario requires special logic. But let's see.

tamlyn10 commented 3 years ago

Yeah, I deliberately didn't include the option you mentioned because:

  1. We have long talked about trying to find another way to estimate target stake that doesn't use OI (personally, I don't think this is a good idea, but that's for another ticket / discussion).
  2. I'm not sure we can guarantee the volume is covered by setting the target_stake_scaling_factor to >1, because the taraget stake may be low as a result of the mark price dropping or the rf being low due to other parameters. target_stake = mark_price x max_oi x target_stake_scaling_factor x rf

Regarding my option 3 I agree it's not great.. but, market makers of last resort are a mechanism we could play with more and lots of ways to work that in. Definitely not worth complicating stuff now tho, of course.

davidsiska-vega commented 3 years ago

We should probably change the mechanism to "closeout as much as the order book allows and confiscate the margin".

This will tip the market into liquidity auction (because it will eat any limit orders that LP commitment is pegged to). Once the auction ends we go back to reevaluate the margin position of that party: most likely the margin balance will be zero (of course MTM in another market can provide balance) so we repeat "closeout as much as the order book allows and confiscate the margin".

If the MTM inflow into general from another market was big enough then perhaps the party gets to keep the rest of their position - fine, I can live with that.