func (m *IttoMessageOptionOpen) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { *m = IttoMessageOptionOpen{ IttoMessageCommon: decodeIttoMessage(data), OId: packet.OptionIdFromUint32(binary.BigEndian.Uint32(data[5:9])), OpenState: data[9], } return nil }
func (m *IttoMessageOptionsTrade) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { *m = IttoMessageOptionsTrade{ IttoMessageCommon: decodeIttoMessage(data), Side: packet.MarketSideFromByte(data[5]), OId: packet.OptionIdFromUint32(binary.BigEndian.Uint32(data[6:10])), Cross: binary.BigEndian.Uint32(data[10:14]), Match: binary.BigEndian.Uint32(data[14:18]), Price: packet.PriceFrom4Dec(int(binary.BigEndian.Uint32(data[18:22]))), Size: int(binary.BigEndian.Uint32(data[22:26])), } return nil }
func (m *IttoMessageOptionsCrossTrade) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { *m = IttoMessageOptionsCrossTrade{ IttoMessageOptionsTrade: IttoMessageOptionsTrade{ IttoMessageCommon: decodeIttoMessage(data), OId: packet.OptionIdFromUint32(binary.BigEndian.Uint32(data[5:9])), Cross: binary.BigEndian.Uint32(data[9:13]), Match: binary.BigEndian.Uint32(data[13:17]), Price: packet.PriceFrom4Dec(int(binary.BigEndian.Uint32(data[18:22]))), Size: int(binary.BigEndian.Uint32(data[22:26])), }, CrossType: data[17], } return nil }
func (m *IttoMessageNoii) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { *m = IttoMessageNoii{ IttoMessageCommon: decodeIttoMessage(data), AuctionId: binary.BigEndian.Uint32(data[5:9]), AuctionType: data[9], Size: binary.BigEndian.Uint32(data[10:14]), Imbalance: OrderSide{ Side: packet.MarketSideFromByte(data[14]), Price: packet.PriceFrom4Dec(int(binary.BigEndian.Uint32(data[19:23]))), Size: int(binary.BigEndian.Uint32(data[23:27])), }, OId: packet.OptionIdFromUint32(binary.BigEndian.Uint32(data[15:19])), } return nil }
func (m *IttoMessageOptionDirectory) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { *m = IttoMessageOptionDirectory{ IttoMessageCommon: decodeIttoMessage(data), OId: packet.OptionIdFromUint32(binary.BigEndian.Uint32(data[5:9])), Symbol: string(data[9:15]), Expiration: time.Date(2000+int(data[15]), time.Month(data[16]), int(data[17]), 0, 0, 0, 0, time.Local), StrikePrice: int(binary.BigEndian.Uint32(data[18:22])), OType: data[22], Source: data[23], UnderlyingSymbol: string(data[24:37]), ClosingType: data[37], Tradable: data[38], MPV: data[39], } return nil }
func (m *IttoMessageAddOrder) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { *m = IttoMessageAddOrder{ IttoMessageCommon: decodeIttoMessage(data), OrderSide: OrderSide{ RefNumD: packet.OrderIdFromUint32(binary.BigEndian.Uint32(data[5:9])), Side: packet.MarketSideFromByte(data[9]), }, OId: packet.OptionIdFromUint32(binary.BigEndian.Uint32(data[10:14])), } if m.Type.IsShort() { m.Price = packet.PriceFrom2Dec(int(binary.BigEndian.Uint16(data[14:16]))) m.Size = int(binary.BigEndian.Uint16(data[16:18])) } else { m.Price = packet.PriceFrom4Dec(int(binary.BigEndian.Uint32(data[14:18]))) m.Size = int(binary.BigEndian.Uint32(data[18:22])) } return nil }
func (m *IttoMessageAddQuote) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { *m = IttoMessageAddQuote{ IttoMessageCommon: decodeIttoMessage(data), Bid: OrderSide{Side: packet.MarketSideBid, RefNumD: packet.OrderIdFromUint32(binary.BigEndian.Uint32(data[5:9]))}, Ask: OrderSide{Side: packet.MarketSideAsk, RefNumD: packet.OrderIdFromUint32(binary.BigEndian.Uint32(data[9:13]))}, OId: packet.OptionIdFromUint32(binary.BigEndian.Uint32(data[13:17])), } if m.Type.IsShort() { m.Bid.Price = packet.PriceFrom2Dec(int(binary.BigEndian.Uint16(data[17:19]))) m.Bid.Size = int(binary.BigEndian.Uint16(data[19:21])) m.Ask.Price = packet.PriceFrom2Dec(int(binary.BigEndian.Uint16(data[21:23]))) m.Ask.Size = int(binary.BigEndian.Uint16(data[23:25])) } else { m.Bid.Price = packet.PriceFrom4Dec(int(binary.BigEndian.Uint32(data[17:21]))) m.Bid.Size = int(binary.BigEndian.Uint32(data[21:25])) m.Ask.Price = packet.PriceFrom4Dec(int(binary.BigEndian.Uint32(data[25:29]))) m.Ask.Size = int(binary.BigEndian.Uint32(data[29:33])) } return nil }
func parseProductId(data []byte) packet.OptionId { errs.Check(len(data) >= 4) return packet.OptionIdFromUint32(binary.LittleEndian.Uint32(data)) }