Merge pull request #1611 from vnpy/dev-min_volume
[Add]min_volume for ContractData
This commit is contained in:
commit
d4d8e6a0f8
@ -212,6 +212,7 @@ class BitfinexRestApi(RestClient):
|
||||
product=Product.SPOT,
|
||||
size=1,
|
||||
pricetick=1 / pow(10, d["price_precision"]),
|
||||
min_volume=float(d["minimum_order_size"]),
|
||||
gateway_name=self.gateway_name,
|
||||
)
|
||||
self.gateway.on_contract(contract)
|
||||
|
@ -374,14 +374,15 @@ class HuobiRestApi(RestClient):
|
||||
quote_currency = d["quote-currency"]
|
||||
name = f"{base_currency.upper()}/{quote_currency.upper()}"
|
||||
pricetick = 1 / pow(10, d["price-precision"])
|
||||
size = 1 / pow(10, d["amount-precision"])
|
||||
|
||||
min_volume = 1 / pow(10, d["amount-precision"])
|
||||
|
||||
contract = ContractData(
|
||||
symbol=d["symbol"],
|
||||
exchange=Exchange.HUOBI,
|
||||
name=name,
|
||||
pricetick=pricetick,
|
||||
size=size,
|
||||
size=1,
|
||||
min_volume=min_volume,
|
||||
product=Product.SPOT,
|
||||
gateway_name=self.gateway_name,
|
||||
)
|
||||
|
@ -316,6 +316,7 @@ class OkexRestApi(RestClient):
|
||||
product=Product.SPOT,
|
||||
size=1,
|
||||
pricetick=float(instrument_data["tick_size"]),
|
||||
min_volume=float(instrument_data["min_size"]),
|
||||
gateway_name=self.gateway_name
|
||||
)
|
||||
self.gateway.on_contract(contract)
|
||||
|
@ -233,6 +233,7 @@ class ContractData(BaseData):
|
||||
size: int
|
||||
pricetick: float
|
||||
|
||||
min_volume: float = 1 # minimum trading volume of the contract
|
||||
stop_supported: bool = False # whether server supports stop order
|
||||
net_position: bool = False # whether gateway uses net position volume
|
||||
|
||||
|
@ -550,11 +550,11 @@ class ConnectDialog(QtWidgets.QDialog):
|
||||
else:
|
||||
field_value = field_type(widget.text())
|
||||
setting[field_name] = field_value
|
||||
|
||||
|
||||
save_json(self.filename, setting)
|
||||
|
||||
|
||||
self.main_engine.connect(setting, self.gateway_name)
|
||||
|
||||
|
||||
self.accept()
|
||||
|
||||
|
||||
@ -893,6 +893,7 @@ class ContractManager(QtWidgets.QWidget):
|
||||
"product": "合约分类",
|
||||
"size": "合约乘数",
|
||||
"pricetick": "价格跳动",
|
||||
"min_volume": "最小委托量",
|
||||
"gateway_name": "交易接口",
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user