Skip to content
Tradable Quantity and Margin

Simulate Margin Change After Order

When the Client closes a stock or single-leg option position (selling a long position or buying back a short position), after the Client enters a quantity, simulates the impact of the order on account margin and returns the initial and maintenance margin before and after the trade, and whether this close would trigger a margin call. The Broker App can show the margin change in the amount details: highlight it as a warning when after_im_margin is higher than before_im_margin. When margin_call is true, before submission tell the Client that this close increases margin and triggers a margin call, and let the Client confirm or cancel. Do not call this endpoint for opening trades, multi-leg orders, or a quantity of 0.

When you call this endpoint through WhaleCore requestService(), set requiresTradeToken to true.

GEThttps://api.lbkrs.com/v1/orders/simulate_asset_calculation

Parameters

counter_idstringqueryRequired

Security ID (counter_id) of a stock or single-leg option

submit_pricestringqueryRequired

Order price in the trading currency. For market-type and trailing stop orders, pass the latest price

settlement_currencystringqueryRequired

Settlement currency, such as USD or HKD. Use an item of channel_infos.settlement_currency returned by Get Order Configuration

actionintegerqueryRequired

Order side:

  • 1 - Buy
  • 2 - Sell

12

marketstringqueryRequired

Market code of the security, such as US or HK

quantitystringqueryRequired

Order quantity. It must be greater than 0

order_idstringquery

Original order ID when amending an order. Omit it for a new order

Responses

HTTP 200The request succeeded. The response body contains the result of the “Simulate Margin Change After Order” operation.
Standard response envelopecodemessagedata
dataobjectdata structure
marginInfoobject

Simulated margin information

Child attributes
before_im_marginstring

Initial margin before the trade

after_im_marginstring

Initial margin after the trade

before_mm_marginstring

Maintenance margin before the trade

after_mm_marginstring

Maintenance margin after the trade

margin_callboolean

Whether this close would trigger a margin call

Whale Docs