MCPcopy Create free account
hub / github.com/QuantFans/quantdigger / sell

Method sell

quantdigger/kernel/engine/strategy.py:224–241  ·  view source on GitHub ↗

平仓。 :param str/int direction: 下单方向。多头 - 'long' / 1 ;空头 - 'short' / 2 :param float price: 价格。 :param int quantity: 数量。 :param str/int price_type: 下单价格类型。限价单 - 'lmt' / 1;市价单 - 'mkt' / 2

(self, direction, price, quantity, price_type='MKT', contract=None)

Source from the content-addressed store, hash-verified

222 ))
223
224 def sell(self, direction, price, quantity, price_type='MKT', contract=None):
225 """ 平仓。
226
227 :param str/int direction: 下单方向。多头 - 'long' / 1 ;空头 - 'short' / 2
228 :param float price: 价格。
229 :param int quantity: 数量。
230 :param str/int price_type: 下单价格类型。限价单 - 'lmt' / 1;市价单 - 'mkt' / 2
231 """
232 con = Contract(contract) if contract else self._main_contract
233 self._orders.append(Order(
234 self.datetime,
235 con,
236 PriceType.arg_to_type(price_type),
237 TradeSide.PING,
238 Direction.arg_to_type(direction),
239 float(price),
240 quantity
241 ))
242
243 def position(self, contract=None):
244 """ 当前仓位。

Callers 1

on_barMethod · 0.80

Calls 3

ContractClass · 0.90
OrderClass · 0.90
arg_to_typeMethod · 0.45

Tested by

no test coverage detected