diff --git a/zipline/finance/trading.py b/zipline/finance/trading.py index 80098ff2..a4bb177c 100644 --- a/zipline/finance/trading.py +++ b/zipline/finance/trading.py @@ -116,10 +116,12 @@ class OrderDataSource(qmsg.DataSource): order_dt = None count = 0 while True: - (rlist, wlist, xlist) = select([self.order_socket], - [], - [self.order_socket], - timeout=self.heartbeat_timeout/1000) #select timeout is in sec + (rlist, wlist, xlist) = select( + [self.order_socket], + [], + [self.order_socket], + timeout=self.heartbeat_timeout/1000 + ) #no more orders, should this be an error condition? if len(rlist) == 0 or len(xlist) > 0: diff --git a/zipline/test/test_finance.py b/zipline/test/test_finance.py index f8a7e7e2..a1825d43 100644 --- a/zipline/test/test_finance.py +++ b/zipline/test/test_finance.py @@ -30,6 +30,8 @@ class FinanceTestCase(TestCase): self.treasury_curves ) + self.allocator = AddressAllocator(8) + def test_trade_feed_protocol(self): @@ -133,8 +135,7 @@ class FinanceTestCase(TestCase): # -------------- # Allocate sockets for the simulator components - allocator = AddressAllocator(8) - sockets = allocator.lease(8) + sockets = self.allocator.lease(8) addresses = { 'sync_address' : sockets[0], @@ -207,8 +208,7 @@ class FinanceTestCase(TestCase): # -------------- # Allocate sockets for the simulator components - allocator = AddressAllocator(8) - sockets = allocator.lease(8) + sockets = self.allocator.lease(8) addresses = { 'sync_address' : sockets[0],