Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using network's trade price as mark price #2050

Closed
wants to merge 3 commits into from

Conversation

witgaw
Copy link
Contributor

@witgaw witgaw commented Nov 9, 2023

Allow using network's trade price as mark price + ACs

davidsiska-vega
davidsiska-vega previously approved these changes Nov 9, 2023
@witgaw witgaw force-pushed the extend-liquidation-spec branch 2 times, most recently from c313fc3 to 45c0dfd Compare November 14, 2023 16:30
@@ -85,6 +88,8 @@ is closest to reproducing the legacy setup where party would get liquidated imme

Different liquidation strategies with different parameters might be proposed in the future, hence implementation should allow for easy substitution of strategies.

Note that network's trade is treated as any other trade in a sense that its price can be used as the mark price.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these trades can define the mark price, then surely they must also factor in to price monitoring, so we probably will want to add an AC along those lines

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Factor in as in feed into the engine when it determines the reference price?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if we didn't do that, we could see the mark price move up/down, but the price bounds would be based on the last non-network initiated trade. In practice, the impact should be fairly minimal, but still, where we would previously have a mark price of 1,000 with min/max bounds 950-1,050, we could now have a mark price of 1,010 with the same price bounds.

The issue here is that price monitoring expects us to pass in the prices of all trades, to check the bounds and then trigger price auction if they exceed the bounds. Once the price auction is triggered, trading would essentially end up getting disabled, so if the network order results in 5 trades, the second of which trips a price auction, should we still push the other trades through, or should we roll back the subsequent trades somehow - after all, that's what we should do if we decide to treat these trades exactly like any other trade.

Currently, after we reduce/zero out the network, we do perform a MTM settlement only applied to the parties that traded with the network, but if the trades can determine the mark price, I suspect that this no longer applies (we should just set the last traded price, and we'll MTM all the updated positions as part of the next MTM settlement)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summarising from Slack:

  • network trade's are meant to be IOC, so no risk of triggering an auction,
  • there's not meant to be any special flow for those trades, so no special MTM, they will update last traded price like any other trade, and if that happens to be the price used for next mark-to-market then that's fine too.

If you believe existing ACs are incorrect or more are needed then please suggest a code change or add your commits.

@witgaw witgaw force-pushed the extend-liquidation-spec branch 2 times, most recently from 0881c14 to e61f73c Compare November 15, 2023 11:23
@witgaw witgaw force-pushed the extend-liquidation-spec branch from e61f73c to bef1dc8 Compare November 15, 2023 11:31
@witgaw witgaw closed this Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants