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

Always allow updating a call order to higher collateral ratio #583

Closed
abitmore opened this issue Jan 17, 2018 · 2 comments
Closed

Always allow updating a call order to higher collateral ratio #583

abitmore opened this issue Jan 17, 2018 · 2 comments

Comments

@abitmore
Copy link
Member

Current behavior: if a call order's collateral ratio is below MCR but it's not filled immediately due to no enough buy orders, it will hang there. The owner can adjust its collateral ratio only if to close the position, or the new ratio is above MCR, or the call order get completely filled (margin called). While this prevents the owner from maliciously reducing collateral ratio (to increase possibility of black swan event), it also prevents the owner from slightly increasing the collateral ratio (to decrease possibility of black swan event). IMHO the latter should be allowed.

Code:

      // check to see if the order needs to be margin called now, but don't allow black swans and require there to be
      // limit orders available that could be used to fill the order.
      if( d.check_call_orders( *_debt_asset, false ) )
      {
         const auto call_obj  = d.find(call_order_id);
         // if we filled at least one call order, we are OK if we totally filled.
         GRAPHENE_ASSERT(
            !call_obj,
            call_order_update_unfilled_margin_call,
            "Updating call order would trigger a margin call that cannot be fully filled",
            ("a", ~call_obj->call_price )("b", _bitasset_data->current_feed.settlement_price)
            );
      }
      else
      {
         const auto call_obj  = d.find(call_order_id);
         FC_ASSERT( call_obj, "no margin call was executed and yet the call object was deleted" );
         //edump( (~call_obj->call_price) ("<")( _bitasset_data->current_feed.settlement_price) );
         // We didn't fill any call orders.  This may be because we
         // aren't in margin call territory, or it may be because there
         // were no matching orders.  In the latter case, we throw.
         GRAPHENE_ASSERT(
            ~call_obj->call_price < _bitasset_data->current_feed.settlement_price,
            call_order_update_unfilled_margin_call,
            "Updating call order would trigger a margin call that cannot be fully filled",
            ("a", ~call_obj->call_price )("b", _bitasset_data->current_feed.settlement_price)
            );
      }
   }

I think this is a bug so don't need a BSIP to fix it.

@abitmore abitmore added this to the 201803 - Consensus Changing Release milestone Jan 17, 2018
@pmconrad
Copy link
Contributor

Makes sense.

@abitmore
Copy link
Member Author

PR #655 merged. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants