コード例 #1
0
    def testIsOrderMet(self):
        tc = TradingCenter()
        tick1 = Tick('time', 'open', 'high', 'low', 13.20, 'volume')
        order1 = Order(accountId=None,
                       side=Side.BUY,
                       symbol='symbol',
                       price=13.25,
                       share=10)
        order2 = Order(accountId=None,
                       side=Side.BUY,
                       symbol='symbol',
                       price=13.15,
                       share=10)
        order3 = Order(accountId=None,
                       side=Side.SELL,
                       symbol='symbol',
                       price=13.25,
                       share=10)
        order4 = Order(accountId=None,
                       side=Side.SELL,
                       symbol='symbol',
                       price=13.15,
                       share=10)

        self.assertEquals(True, tc.isOrderMet(tick1, order1))
        self.assertEquals(False, tc.isOrderMet(tick1, order2))
        self.assertEquals(False, tc.isOrderMet(tick1, order3))
        self.assertEquals(True, tc.isOrderMet(tick1, order4))
コード例 #2
0
    def testIsOrderMet(self):
        tc = TradingCenter()
        tick1 = Tick(datetime.now(), 30.0, 35.0, 13.20, 13.20, 100000)
        order1 = Order(accountId = None, side = Side.BUY, symbol = 'symbol', price = 13.25, share = 10)
        order2 = Order(accountId = None, side = Side.BUY, symbol = 'symbol', price = 13.15, share = 10)
        order3 = Order(accountId = None, side = Side.SELL, symbol = 'symbol', price = 13.25, share = 10)
        order4 = Order(accountId = None, side = Side.SELL, symbol = 'symbol', price = 13.15, share = 10)

        self.assertEquals(True, tc.isOrderMet(tick1, order1))
        self.assertEquals(False, tc.isOrderMet(tick1, order2))
        self.assertEquals(False, tc.isOrderMet(tick1, order3))
        self.assertEquals(True, tc.isOrderMet(tick1, order4))
コード例 #3
0
    def testIsOrderMet(self):
        tc = TradingCenter()
        tick1 = Tick('time', 'open', 'high', 'low', 13.20, 'volume')
        order1 = Order(accountId = None, side = Side.BUY, symbol = 'symbol', price = 13.25, share = 10)
        order2 = Order(accountId = None, side = Side.BUY, symbol = 'symbol', price = 13.15, share = 10)
        order3 = Order(accountId = None, side = Side.SELL, symbol = 'symbol', price = 13.25, share = 10)
        order4 = Order(accountId = None, side = Side.SELL, symbol = 'symbol', price = 13.15, share = 10)

        self.assertEquals(True, tc.isOrderMet(tick1, order1))
        self.assertEquals(False, tc.isOrderMet(tick1, order2))
        self.assertEquals(False, tc.isOrderMet(tick1, order3))
        self.assertEquals(True, tc.isOrderMet(tick1, order4))