[增强] 增加期货合约保证金比率
This commit is contained in:
parent
2cca2aab9c
commit
baea2a48e1
@ -601,6 +601,10 @@ class CtpTdApi(TdApi):
|
|||||||
pricetick=data["PriceTick"],
|
pricetick=data["PriceTick"],
|
||||||
gateway_name=self.gateway_name
|
gateway_name=self.gateway_name
|
||||||
)
|
)
|
||||||
|
# 保证金费率
|
||||||
|
contract.margin_rate = max(data.get('LongMarginRatio', 0), data.get('ShortMarginRatio', 0))
|
||||||
|
if contract.margin_rate == 0:
|
||||||
|
contract.margin_rate = 0.1
|
||||||
|
|
||||||
# For option only
|
# For option only
|
||||||
if contract.product == Product.OPTION:
|
if contract.product == Product.OPTION:
|
||||||
|
@ -252,6 +252,7 @@ class ContractData(BaseData):
|
|||||||
product: Product
|
product: Product
|
||||||
size: int
|
size: int
|
||||||
pricetick: float
|
pricetick: float
|
||||||
|
margin_rate: float = 0.1 # 保证金比率
|
||||||
|
|
||||||
min_volume: float = 1 # minimum trading volume of the contract
|
min_volume: float = 1 # minimum trading volume of the contract
|
||||||
stop_supported: bool = False # whether server supports stop order
|
stop_supported: bool = False # whether server supports stop order
|
||||||
|
Loading…
Reference in New Issue
Block a user