Example #1
0
File: itto.go Project: 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
}
Example #2
0
File: itto.go Project: ikravets/ev
func (m *IttoMessageQuoteDelete) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	*m = IttoMessageQuoteDelete{
		IttoMessageCommon: decodeIttoMessage(data),
		BidOrigRefNumD:    packet.OrderIdFromUint32(binary.BigEndian.Uint32(data[5:9])),
		AskOrigRefNumD:    packet.OrderIdFromUint32(binary.BigEndian.Uint32(data[9:13])),
	}
	return nil
}
Example #3
0
File: itto.go Project: 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
}
Example #4
0
File: itto.go Project: ikravets/ev
func (m *IttoMessageOrderCancel) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	*m = IttoMessageOrderCancel{
		IttoMessageCommon: decodeIttoMessage(data),
		OrigRefNumD:       packet.OrderIdFromUint32(binary.BigEndian.Uint32(data[5:9])),
		Size:              int(binary.BigEndian.Uint32(data[9:13])),
	}
	return nil
}
Example #5
0
File: itto.go Project: ikravets/ev
func (m *IttoMessageSingleSideExecuted) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	*m = IttoMessageSingleSideExecuted{
		IttoMessageCommon: decodeIttoMessage(data),
		OrigRefNumD:       packet.OrderIdFromUint32(binary.BigEndian.Uint32(data[5:9])),
		Size:              int(binary.BigEndian.Uint32(data[9:13])),
		Cross:             binary.BigEndian.Uint32(data[13:17]),
		Match:             binary.BigEndian.Uint32(data[17:21]),
	}
	return nil
}
Example #6
0
File: itto.go Project: ikravets/ev
func (m *IttoMessageBlockSingleSideDelete) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	*m = IttoMessageBlockSingleSideDelete{
		IttoMessageCommon: decodeIttoMessage(data),
		Number:            int(binary.BigEndian.Uint16(data[5:9])),
	}
	m.RefNumDs = make([]packet.OrderId, m.Number)
	for i := 0; i < m.Number; i++ {
		off := 7 + 4*i
		m.RefNumDs[i] = packet.OrderIdFromUint32(binary.BigEndian.Uint32(data[off : off+4]))
	}
	return nil
}
Example #7
0
File: itto.go Project: 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
}
Example #8
0
File: itto.go Project: 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
}
Example #9
0
File: itto.go Project: 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
}