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

Class FillEvent

quantdigger/kernel/engine/event.py:71–134  ·  view source on GitHub ↗

委托成交事件。

Source from the content-addressed store, hash-verified

69
70
71class FillEvent(object):
72 """ 委托成交事件。 """
73 def __init__(self, transaction):
74 self.type = Event.FILL
75 self.transaction = transaction
76 #"""
77 #Encapsulates the notion of a Filled Order, as returned
78 #from a brokerage. Stores the quantity of an instrument
79 #actually filled and at what price. In addition, stores
80 #the commission of the trade from the brokerage.
81 #"""
82
83 #def __init__(self, timeindex, symbol, exchange, quantity,
84 #direction, fill_cost, commission=None):
85 #"""
86 #Initialises the FillEvent object. Sets the symbol, exchange,
87 #quantity, direction, cost of fill and an optional
88 #commission.
89
90 #If commission is not provided, the Fill object will
91 #calculate it based on the trade size and Interactive
92 #Brokers fees.
93
94 #Parameters:
95 #timeindex - The bar-resolution when the order was filled.
96 #symbol - The instrument which was filled.
97 #exchange - The exchange where the order was filled.
98 #quantity - The filled quantity.
99 #direction - The direction of fill ('BUY' or 'SELL')
100 #fill_cost - The holdings value in dollars.
101 #commission - An optional commission sent from IB.
102 #"""
103
104 #self.type = Event.FILL
105 #self.timeindex = timeindex
106 #self.symbol = symbol
107 #self.exchange = exchange
108 #self.quantity = quantity
109 #self.direction = direction
110 #self.fill_cost = fill_cost
111
112 ## Calculate commission
113 #if commission is None:
114 #self.commission = self.calculate_ib_commission()
115 #else:
116 #self.commission = commission
117
118 #def calculate_ib_commission(self):
119 #"""
120 #Calculates the fees of trading based on an Interactive
121 #Brokers fee structure for API, in USD.
122
123 #This does not include exchange or ECN fees.
124
125 #Based on "US API Directed Orders":
126 #https://www.interactivebrokers.com/en/index.php?f=commission&p=stocks2
127 #"""
128 #full_cost = 1.3

Callers 1

make_marketMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected