fixed bug in client

This commit is contained in:
fawce
2012-03-04 11:58:10 -05:00
parent 48fa33de68
commit 1cd66a091d
2 changed files with 7 additions and 7 deletions
+3 -4
View File
@@ -49,16 +49,15 @@ class RandomEquityTrades(TradeDataSource):
volume = random.randrange(100,10000,100)
event = zp.namedict({
'source_id' : self.get_id,
"type" : zp.DATASOURCE_TYPE.ORDER,
#'source_id' : self.get_id,
"type" : zp.DATASOURCE_TYPE.TRADE,
"sid" : self.sid,
"price" : self.price,
"volume" : volume,
"dt" : self.trade_start + (self.minute * self.incr),
})
message = zp.DATASOURCE_FRAME(event)
self.send(message)
self.send(event)
self.incr += 1
+4 -3
View File
@@ -1,5 +1,6 @@
import zipline.util as qutil
import zipline.messaging as qmsg
import zipline.protocol as zp
from zipline.protocol import CONTROL_PROTOCOL, COMPONENT_TYPE
from zipline.finance.trading import TradeSimulationClient
@@ -45,7 +46,7 @@ class TestClient(qmsg.Component):
event = self.unframe(msg)
# deserialization error
except zp.InvalidFrame as exc:
except zp.INVALID_MERGE_FRAME as exc:
return self.signal_exception(exc)
if self.prev_dt != None:
@@ -61,8 +62,8 @@ class TestClient(qmsg.Component):
if self.received_count % 100 == 0:
qutil.LOGGER.info("received {n} messages".format(n=self.received_count))
def unframe(self, msg):
return zp.MERGE_UNFRARME(msg)
def unframe(self, msg):
return zp.MERGE_UNFRAME(msg)
class TestTradingClient(TradeSimulationClient):