Get Margin Ratio
This API is used to obtain the initial margin ratio, maintain the margin ratio and strengthen the margin ratio of stocks.
SDK Links
Python  | longport.openapi.TradeContext.margin_ratio | 
Rust  | longport::trade::TradeContext#margin_ratio | 
Go  | TradeContext.MarginRatio | 
Node.js  | TradeContext#marginRatio | 
Request 
| HTTP Method | GET | 
| HTTP URL | /v1/risk/margin-ratio | 
Parameters 
Content-Type: application/json; charset=utf-8
| Name | Type | Required | Description | 
|---|---|---|---|
| symbol | string | YES | Stock symbol, using the format ticker.region, for example: AAPL.US | 
Request Example 
python
from datetime import datetime
from longport.openapi import TradeContext, Config
config = Config.from_env()
ctx = TradeContext(config)
resp = ctx.margin_ratio("700.HK")
print(resp)Response 
Response Headers 
- Content-Type: application/json
 
Response Example 
json
{
  "code": 0,
  "data": {
    "im_factor": "0.1",
    "mm_factor": "0.1",
    "fm_factor": "0.1"
  }
}Response Status 
| Status | Description | Schema | 
|---|---|---|
| 200 | Success | margin_ratio_rsp | 
| 400 | Internal Error | None | 
Schemas 
margin_ratio_rsp 
| Name | Type | Required | Description | 
|---|---|---|---|
| im_factor | string | true | Initial margin ratio | 
| mm_factor | string | true | Maintain the initial margin ratio | 
| fm_factor | string | true | Forced close-out margin ratio |