Skip to main content

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 MethodGET
HTTP URL/v1/risk/margin-ratio

Parameters

Content-Type: application/json; charset=utf-8

NameTypeRequiredDescription
symbolstringYESStock symbol, using the format ticker.region, for example: AAPL.US

Request Example

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

{
"code": 0,
"data": {
"im_factor": "0.1",
"mm_factor": "0.1",
"fm_factor": "0.1"
}
}

Response Status

StatusDescriptionSchema
200Successmargin_ratio_rsp
400Internal ErrorNone

Schemas

margin_ratio_rsp

NameTypeRequiredDescription
im_factorstringtrueInitial margin ratio
mm_factorstringtrueMaintain the initial margin ratio
fm_factorstringtrueForced close-out margin ratio