[Add]min_volume for ContractData

This commit is contained in:
vn.py 2019-04-18 15:50:45 +08:00
parent afff26a91f
commit 81a0bc5f19
5 changed files with 11 additions and 6 deletions

View File

@ -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)

View File

@ -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,
)

View File

@ -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)

View File

@ -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

View File

@ -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": "交易接口",
}