How to implement msgpack deserialized with Timestamp #1130
Open
Description
With C++ 11 https://github.com/msgpack/msgpack-c.git branch:cpp_master
std::cout << message << std::endl;
msgpack::object_handle oh = msgpack::unpack(message.data(), message.size());
msgpack::object deserialized = oh.get();
std::cout << deserialized << std::endl;
Tick tick;
deserialized.convert(tick);
std::cout << "Received Tick: "
<< "exchange=" << tick.exchange
<< ", code=" << tick.code
<< ", timestamp=" << tick.timestamp.seconds << "." << tick.timestamp.nanoseconds
<< ", close=" << tick.close
<< ", volume=" << tick.volume
<< std::endl;
I sent the msgpack packet with python in
{'exchange': 'TFE', 'code': 'TXFR1', 'timestamp': Timestamp(seconds=1718040379, nanoseconds=767436000), 'close': 21000.0, 'volume': 1.0, 'tick_Type': 0, 'simtrade': 1}
And I can receive msg payload in C++ as
{"method":"Publish","exchange":"TFE","code":"TXFR1","timestamp":"EXT(type:-1,size:8)","close":21000,"volume":1,"tick_Type":0,"simtrade":1}
And How to deserialized with the ext. type with Timestamp.
I use origin msgpack support msgpack.Timestamp to encode the packet
Metadata
Assignees
Labels
No labels