April 2019
Intermediate to advanced
426 pages
11h 13m
English
The Order class in the following code represents a single order sent by the strategy to the server. Each order contains a timestamp, the symbol, quantity, and a flag indicating a buy or sell order. In the following examples, we will be using market orders only, and is_market_order is expected to be True. Other order types, such as limit and stop orders, may be implemented if desired. Once an order is filled, the order is further updated with the filled price, time, and quantity. Write this class as given in the following code:
class Order(object): def __init__(self, timestamp, symbol, qty, is_buy, is_market_order, price=0 ): self.timestamp = timestamp self.symbol = symbol self.qty = qty self.price = price self.is_buy ...
Read now
Unlock full access