コード例 #1
0
class OrderGenerator:
    def __init__(self, min_ask, max_ask, min_bid, max_bid):
        self.price_gen = PriceGenerator(min_ask, max_ask, min_bid, max_bid)
        self.size_gen = OrderSizeGenerator()
        self.type_gen = OrderTypeGenerator()
        self.cond_gen = OrderConditionsGenerator()

    def generateOrder(self, orderid):
        order_size = self.size_gen.generateOrderSize()
        order_type = self.type_gen.generateOrderType()
        order_conditions = self.cond_gen.generateOrderConditions()
        if order_conditions == OrderConditions.Market:
            order_price = -1
        else: #TODO AHHHH
            if order_type is OrderType.Buy:
                order_price = self.price_gen.generateBidPrice()
            else:
                order_price = self.price_gen.generateAskPrice()
        order = Order(order_type, order_price, order_size, order_conditions, orderid)
        return order
コード例 #2
0
 def __init__(self, min_ask, max_ask, min_bid, max_bid):
     self.price_gen = PriceGenerator(min_ask, max_ask, min_bid, max_bid)
     self.size_gen = OrderSizeGenerator()
     self.type_gen = OrderTypeGenerator()
     self.cond_gen = OrderConditionsGenerator()