diff --git a/vnpy/gateway/bitfinex/bitfinex_gateway.py b/vnpy/gateway/bitfinex/bitfinex_gateway.py index c418813b..bcaab464 100644 --- a/vnpy/gateway/bitfinex/bitfinex_gateway.py +++ b/vnpy/gateway/bitfinex/bitfinex_gateway.py @@ -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) diff --git a/vnpy/gateway/huobi/huobi_gateway.py b/vnpy/gateway/huobi/huobi_gateway.py index c2bb2a5c..79de4023 100644 --- a/vnpy/gateway/huobi/huobi_gateway.py +++ b/vnpy/gateway/huobi/huobi_gateway.py @@ -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, ) diff --git a/vnpy/gateway/okex/okex_gateway.py b/vnpy/gateway/okex/okex_gateway.py index e959430e..184c6452 100644 --- a/vnpy/gateway/okex/okex_gateway.py +++ b/vnpy/gateway/okex/okex_gateway.py @@ -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) diff --git a/vnpy/trader/object.py b/vnpy/trader/object.py index b7ecd02e..734093cb 100644 --- a/vnpy/trader/object.py +++ b/vnpy/trader/object.py @@ -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 diff --git a/vnpy/trader/ui/widget.py b/vnpy/trader/ui/widget.py index e40da3c1..fa745825 100644 --- a/vnpy/trader/ui/widget.py +++ b/vnpy/trader/ui/widget.py @@ -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": "交易接口", }