diff --git a/vnpy/gateway/ctp/ctp_gateway.py b/vnpy/gateway/ctp/ctp_gateway.py index f346a30d..50ae6c08 100644 --- a/vnpy/gateway/ctp/ctp_gateway.py +++ b/vnpy/gateway/ctp/ctp_gateway.py @@ -601,6 +601,10 @@ class CtpTdApi(TdApi): pricetick=data["PriceTick"], 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 if contract.product == Product.OPTION: diff --git a/vnpy/trader/object.py b/vnpy/trader/object.py index 01f5738b..5c1b2e32 100644 --- a/vnpy/trader/object.py +++ b/vnpy/trader/object.py @@ -252,6 +252,7 @@ class ContractData(BaseData): product: Product size: int pricetick: float + margin_rate: float = 0.1 # 保证金比率 min_volume: float = 1 # minimum trading volume of the contract stop_supported: bool = False # whether server supports stop order