示例#1
0
文件: pitch.go 项目: ikravets/ev
func (m *PitchMessageTrade) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	*m = PitchMessageTrade{
		PitchMessageCommon: decodePitchMessage(data),
		OrderId:            packet.OrderIdFromUint64(binary.LittleEndian.Uint64(data[6:14])),
		Side:               packet.MarketSideFromByte(data[14]),
	}
	switch m.Type {
	case PitchMessageTypeTradeShort:
		m.Size = uint32(binary.LittleEndian.Uint16(data[15:17]))
		m.Symbol = parseSymbol(data[17:23])
		m.Price = packet.PriceFrom2Dec(int(binary.LittleEndian.Uint16(data[23:25])))
		m.ExecutionId = binary.LittleEndian.Uint64(data[25:33])
	case PitchMessageTypeTradeLong:
		m.Size = binary.LittleEndian.Uint32(data[15:19])
		m.Symbol = parseSymbol(data[19:25])
		m.Price = packet.PriceFrom4Dec(int(binary.LittleEndian.Uint64(data[25:33])))
		m.ExecutionId = binary.LittleEndian.Uint64(data[33:41])
	case PitchMessageTypeTradeExpanded:
		m.Size = binary.LittleEndian.Uint32(data[15:19])
		m.Symbol = parseSymbol(data[19:27])
		m.Price = packet.PriceFrom4Dec(int(binary.LittleEndian.Uint64(data[27:35])))
		m.ExecutionId = binary.LittleEndian.Uint64(data[35:43])
	}
	return nil
}
示例#2
0
文件: itto.go 项目: ikravets/ev
func (m *IttoMessageQuoteReplace) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	*m = IttoMessageQuoteReplace{
		IttoMessageCommon: decodeIttoMessage(data),
		Bid: ReplaceOrderSide{
			OrigRefNumD: packet.OrderIdFromUint32(binary.BigEndian.Uint32(data[5:9])),
			OrderSide:   OrderSide{Side: packet.MarketSideBid, RefNumD: packet.OrderIdFromUint32(binary.BigEndian.Uint32(data[9:13]))},
		},
		Ask: ReplaceOrderSide{
			OrigRefNumD: packet.OrderIdFromUint32(binary.BigEndian.Uint32(data[13:17])),
			OrderSide:   OrderSide{Side: packet.MarketSideAsk, RefNumD: packet.OrderIdFromUint32(binary.BigEndian.Uint32(data[17:21]))},
		},
	}
	if m.Type.IsShort() {
		m.Bid.Price = packet.PriceFrom2Dec(int(binary.BigEndian.Uint16(data[21:23])))
		m.Bid.Size = int(binary.BigEndian.Uint16(data[23:25]))
		m.Ask.Price = packet.PriceFrom2Dec(int(binary.BigEndian.Uint16(data[25:27])))
		m.Ask.Size = int(binary.BigEndian.Uint16(data[27:29]))
	} else {
		m.Bid.Price = packet.PriceFrom4Dec(int(binary.BigEndian.Uint32(data[21:25])))
		m.Bid.Size = int(binary.BigEndian.Uint32(data[25:29]))
		m.Ask.Price = packet.PriceFrom4Dec(int(binary.BigEndian.Uint32(data[29:33])))
		m.Ask.Size = int(binary.BigEndian.Uint32(data[33:37]))
	}
	return nil
}
示例#3
0
文件: pitch.go 项目: ikravets/ev
func (m *PitchMessageAddOrder) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	*m = PitchMessageAddOrder{
		PitchMessageCommon: decodePitchMessage(data),
		OrderId:            packet.OrderIdFromUint64(binary.LittleEndian.Uint64(data[6:14])),
		Side:               packet.MarketSideFromByte(data[14]),
	}
	switch m.Type {
	case PitchMessageTypeAddOrderShort:
		m.Size = uint32(binary.LittleEndian.Uint16(data[15:17]))
		m.Symbol = parseSymbol(data[17:23])
		m.Price = packet.PriceFrom2Dec(int(binary.LittleEndian.Uint16(data[23:25])))
		m.Flags = data[25]
	case PitchMessageTypeAddOrderLong:
		m.Size = binary.LittleEndian.Uint32(data[15:19])
		m.Symbol = parseSymbol(data[19:25])
		m.Price = packet.PriceFrom4Dec(int(binary.LittleEndian.Uint64(data[25:33])))
		m.Flags = data[33]
	case PitchMessageTypeAddOrderExpanded:
		m.Size = binary.LittleEndian.Uint32(data[15:19])
		m.Symbol = parseSymbol(data[19:27])
		m.Price = packet.PriceFrom4Dec(int(binary.LittleEndian.Uint64(data[27:35])))
		m.Flags = data[35]
		copy(m.ParticipantId[:], data[36:40])
	}
	return nil
}
示例#4
0
文件: pitch.go 项目: ikravets/ev
func (m *PitchMessageAuctionUpdate) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	*m = PitchMessageAuctionUpdate{
		PitchMessageCommon: decodePitchMessage(data),
		Symbol:             parseSymbol(data[6:14]),
		AuctionType:        data[14],
		ReferencePrice:     packet.PriceFrom4Dec(int(binary.LittleEndian.Uint64(data[15:23]))),
		BuySize:            binary.LittleEndian.Uint32(data[23:27]),
		SellSize:           binary.LittleEndian.Uint32(data[27:31]),
		IndicativePrice:    packet.PriceFrom4Dec(int(binary.LittleEndian.Uint64(data[31:39]))),
		AuctionOnlyPrice:   packet.PriceFrom4Dec(int(binary.LittleEndian.Uint64(data[39:47]))),
	}
	return nil
}
示例#5
0
文件: pitch.go 项目: ikravets/ev
func (m *PitchMessageAuctionSummary) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	*m = PitchMessageAuctionSummary{
		PitchMessageCommon: decodePitchMessage(data),
		Symbol:             parseSymbol(data[6:14]),
		AuctionType:        data[14],
		Price:              packet.PriceFrom4Dec(int(binary.LittleEndian.Uint64(data[15:23]))),
		Size:               binary.LittleEndian.Uint32(data[23:27]),
	}
	return nil
}
示例#6
0
文件: itto.go 项目: ikravets/ev
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
}
示例#7
0
文件: itto.go 项目: ikravets/ev
func (m *IttoMessageSingleSideUpdate) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	*m = IttoMessageSingleSideUpdate{
		IttoMessageCommon: decodeIttoMessage(data),
		OrderSide: OrderSide{
			RefNumD: packet.OrderIdFromUint32(binary.BigEndian.Uint32(data[5:9])),
			Price:   packet.PriceFrom4Dec(int(binary.BigEndian.Uint32(data[10:14]))),
			Size:    int(binary.BigEndian.Uint32(data[14:18])),
		},
		Reason: data[9],
	}
	return nil
}
示例#8
0
文件: tom.go 项目: ikravets/ev
func (m *TomMessageTradeCancel) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	*m = TomMessageTradeCancel{TomMessageTrade: TomMessageTrade{
		TomMessageCommon: decodeTomMessage(data),
		ProductId:        parseProductId(data[5:9]),
		TradeId:          binary.LittleEndian.Uint32(data[9:13]),
		Correction:       data[13],
		Price:            packet.PriceFrom4Dec(int(binary.LittleEndian.Uint32(data[14:18]))),
		Size:             int(binary.LittleEndian.Uint32(data[18:22])),
		TradeCondition:   data[22],
	}}
	return nil
}
示例#9
0
文件: pitch.go 项目: ikravets/ev
func (m *PitchMessageOrderExecutedAtPriceSize) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	*m = PitchMessageOrderExecutedAtPriceSize{
		PitchMessageOrderExecuted: PitchMessageOrderExecuted{
			PitchMessageCommon: decodePitchMessage(data),
			OrderId:            packet.OrderIdFromUint64(binary.LittleEndian.Uint64(data[6:14])),
			Size:               binary.LittleEndian.Uint32(data[14:18]),
			ExecutionId:        binary.LittleEndian.Uint64(data[22:30]),
		},
		RemainingSize: binary.LittleEndian.Uint32(data[18:22]),
		Price:         packet.PriceFrom4Dec(int(binary.LittleEndian.Uint64(data[30:38]))),
	}
	return nil
}
示例#10
0
文件: itto.go 项目: ikravets/ev
func (m *IttoMessageSingleSideExecutedWithPrice) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	*m = IttoMessageSingleSideExecutedWithPrice{
		IttoMessageSingleSideExecuted: IttoMessageSingleSideExecuted{
			IttoMessageCommon: decodeIttoMessage(data),
			OrigRefNumD:       packet.OrderIdFromUint32(binary.BigEndian.Uint32(data[5:9])),
			Cross:             binary.BigEndian.Uint32(data[9:13]),
			Match:             binary.BigEndian.Uint32(data[13:17]),
			Size:              int(binary.BigEndian.Uint32(data[22:26])),
		},
		Printable: data[17],
		Price:     packet.PriceFrom4Dec(int(binary.BigEndian.Uint32(data[18:22]))),
	}
	return nil
}
示例#11
0
文件: itto.go 项目: ikravets/ev
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
}
示例#12
0
文件: itto.go 项目: ikravets/ev
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
}
示例#13
0
文件: pitch.go 项目: ikravets/ev
func (m *PitchMessageModifyOrder) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	*m = PitchMessageModifyOrder{
		PitchMessageCommon: decodePitchMessage(data),
		OrderId:            packet.OrderIdFromUint64(binary.LittleEndian.Uint64(data[6:14])),
	}
	switch m.Type {
	case PitchMessageTypeModifyOrderLong:
		m.Size = binary.LittleEndian.Uint32(data[14:18])
		m.Price = packet.PriceFrom4Dec(int(binary.LittleEndian.Uint64(data[18:26])))
		m.Flags = data[26]
	case PitchMessageTypeModifyOrderShort:
		m.Size = uint32(binary.LittleEndian.Uint16(data[14:16]))
		m.Price = packet.PriceFrom2Dec(int(binary.LittleEndian.Uint16(data[16:18])))
		m.Flags = data[18]
	}
	return nil
}
示例#14
0
文件: itto.go 项目: ikravets/ev
func (m *IttoMessageSingleSideReplace) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	*m = IttoMessageSingleSideReplace{
		IttoMessageCommon: decodeIttoMessage(data),
		ReplaceOrderSide: ReplaceOrderSide{
			OrigRefNumD: packet.OrderIdFromUint32(binary.BigEndian.Uint32(data[5:9])),
			OrderSide:   OrderSide{RefNumD: packet.OrderIdFromUint32(binary.BigEndian.Uint32(data[9:13]))},
		},
	}
	if m.Type.IsShort() {
		m.Price = packet.PriceFrom2Dec(int(binary.BigEndian.Uint16(data[13:15])))
		m.Size = int(binary.BigEndian.Uint16(data[15:17]))
	} else {
		m.Price = packet.PriceFrom4Dec(int(binary.BigEndian.Uint32(data[13:17])))
		m.Size = int(binary.BigEndian.Uint32(data[17:21]))
	}
	return nil
}
示例#15
0
文件: itto.go 项目: ikravets/ev
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
}
示例#16
0
文件: tom.go 项目: ikravets/ev
func (m *TomMessageLiquiditySeeking) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	*m = TomMessageLiquiditySeeking{
		TomMessageCommon: decodeTomMessage(data),
		ProductId:        parseProductId(data[5:9]),
		EventType:        data[9],
		EventId:          binary.LittleEndian.Uint32(data[10:14]),
		Price:            packet.PriceFrom4Dec(int(binary.LittleEndian.Uint32(data[14:18]))),
		Side:             packet.MarketSideFromByte(data[18]),
		Quantity: [4]uint32{
			binary.LittleEndian.Uint32(data[19:23]),
			binary.LittleEndian.Uint32(data[23:27]),
			binary.LittleEndian.Uint32(data[27:31]),
			binary.LittleEndian.Uint32(data[31:35]),
		},
		AttributableId: [4]byte{data[35], data[36], data[37], data[38]},
		//Reserved:       data[39:43],
	}
	return nil
}
示例#17
0
文件: tom.go 项目: ikravets/ev
func (m *TomMessageSeriesUpdate) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	*m = TomMessageSeriesUpdate{
		TomMessageCommon:   decodeTomMessage(data),
		ProductId:          parseProductId(data[5:9]),
		UnderlyingSymbol:   string(data[9:20]),
		SecuritySymbol:     string(data[20:26]),
		Expiration:         string(data[26:34]),
		StrikePrice:        packet.PriceFrom4Dec(int(binary.LittleEndian.Uint32(data[34:38]))),
		CallOrPut:          data[38],
		OpeningTime:        string(data[39:47]),
		ClosingTime:        string(data[47:55]),
		Restricted:         data[55],
		LongTerm:           data[56],
		Active:             data[57],
		MbboIncrement:      data[58],
		LiquidityIncrement: data[59],
		UnderlyingMarket:   data[60],
		PriorityQuoteWidth: int(binary.LittleEndian.Uint32(data[61:65])),
		//Reserved:           data[65:73],
	}
	return nil
}
示例#18
0
文件: tom.go 项目: ikravets/ev
func (s *TomSide) parseTomSideWide(data []byte) {
	s.Price = packet.PriceFrom4Dec(int(binary.LittleEndian.Uint32(data[0:4])))
	s.Size = int(binary.LittleEndian.Uint32(data[4:8]))
	s.PriorityCustomerSize = int(binary.LittleEndian.Uint32(data[8:12]))
	s.Condition = data[12]
}