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

Class Order

quantdigger/kernel/datastruct.py:204–251  ·  view source on GitHub ↗

订单 :ivar id: 成交编号 :vartype id: :class:`OrderID` :ivar contract: 合约。 :vartype contract: :class:`Contract` :ivar direction: 多空方向。 :vartype direction: :class:`Direction` :ivar price: 成交价格。 :vartype price: float :ivar quantit

Source from the content-addressed store, hash-verified

202
203
204class Order(object):
205 """ 订单
206
207 :ivar id: 成交编号
208 :vartype id: :class:`OrderID`
209
210 :ivar contract: 合约。
211 :vartype contract: :class:`Contract`
212
213 :ivar direction: 多空方向。
214 :vartype direction: :class:`Direction`
215
216 :ivar price: 成交价格。
217 :vartype price: float
218
219 :ivar quantity: 成交数量。
220 :vartype quantity: float
221
222 :ivar side: 开平仓标志。
223 :vartype side: :class:`TradeSide`
224
225 :ivar datetime: 成交时间
226 :vartype datetime: :class:`datetime`
227
228 :ivar price_type: 下单类型。
229 :vartype price_type: :class:`PriceType`
230 """
231 def __init__(self, dt, contract, type_, side, direction, price, quantity):
232 self.id = OrderID.next_order_id()
233 self.contract = contract
234 self.direction = direction
235 self.price = price
236 self.quantity = quantity
237 self.side = side
238 self.datetime = dt
239 self.price_type = type_
240
241 def print_order(self):
242 #print "Order: Symbol=%s, Type=%s, Quantity=%s, Direction=%s" % \
243 #(self.symbol, self.order_type, self.quantity, self.direction)
244 pass
245
246 def __hash__(self):
247 if hasattr(self, '_hash'):
248 return self._hash
249 else:
250 self._hash = hash(self.id)
251 return self._hash
252
253
254class Contract(object):

Callers 2

buyMethod · 0.90
sellMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected