def __init__(self, username, password, heartbeat=3, session=None): BaseMessage.__init__(self, [ (Field.EncryptMethod, 0), (Field.HeartBtInt, heartbeat), (Field.ResetSeqNum, 'Y'), (Field.Username, username), (Field.Password, password) ], session) self.msg_type = Message.Types.Logon
def __init__(self, order_id, symbol, side, size, session=None): BaseMessage.__init__(self, [ (Field.ClOrdID, order_id), (Field.Symbol, symbol), (Field.Side, side), (Field.TransactTime, get_time()), (Field.OrderQty, size), (Field.OrdType, 1), (Field.TimeInForce, 3), ], session) self.msg_type = Message.Types.NewOrder
def __init__(self, request_id, symbol, unsubscribe=False, refresh=False, session=None): BaseMessage.__init__(self, [ (Field.MDReqID, request_id), (Field.SubscriptionRequestType, 2 if unsubscribe else 1), (Field.MarketDepth, 0 if refresh else 1), (Field.MDUpdateType, 1), (Field.NoRelatedSym, 1), (Field.Symbol, symbol), (Field.NoMDEntryTypes, 2), (Field.MDEntryType, 0), (Field.MDEntryType, 1), ], session) self.msg_type = Message.Types.MarketDataRequest
def __init__(self, text, session=None): BaseMessage.__init__(self, [(Field.TestReqID, text)], session) self.msg_type = Message.Types.Heartbeat
def __init__(self, session=None): BaseMessage.__init__(self, [], session) self.msg_type = Message.Types.Heartbeat