Skip to content
This repository has been archived by the owner on Feb 21, 2019. It is now read-only.

Margin call orders: call price should change accordingly when partially called #1535

Open
abitmore opened this issue May 7, 2015 · 0 comments

Comments

@abitmore
Copy link
Member

abitmore commented May 7, 2015

With 0.9.x market engine, test case:

  • When feed price is 1 BTA/BTS, Alice shorts 5000 BTA at feed price,
    • BTA owed is 5000 BTA
    • collateral is 10000 + 5000 = 15000 BTS
    • collateral rate is 15000 * 1 / 5000 = 300%
    • call price is 2 * 5000 / 15000 = 0.67 BTA/BTS
  • When feed price drop to 0.6 BTA/BTS
    • collateral rate drop to 15000 * 0.6 / 5000 = 180%
  • Alice's order get margin called partially, for example 3000 BTA is covered
    • BTS paid from collateral is 3000 / 0.6 = 5000 BTS
    • BTA owed is updated to 5000 - 3000 = 2000 BTA
    • remain collateral is 15000 - 5000 = 10000 BTS
    • collateral rate is 10000 * 0.6 / 2000 = 300%
    • call price should change to 2 * 2000 / 10000 = 0.4 BTA/BTS, and the order shouldn't be called again soon (it's unchanged in 0.9.0/0.9.1 thus is possible to be called again in next block)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant