NativeΒΆ

This protocol is used for shared-memory communication between gateways and clients (trading strategies).

The protocol serializes structs by reducing the operations required to encode/decode and also avoid unnecessary memory copying on the receiving side.

You can run a performance test on your own server

conda install -y --channel https://roq-trading.com/conda/stable \
    roq-client

roq-client-benchmark --benchmark_filter="BM_Codec_*"

You should then be able to see something like this

--------------------------------------------------------------------------------
Benchmark                                      Time             CPU   Iterations
--------------------------------------------------------------------------------
BM_Codec_Encode_DownloadBegin               14.6 ns         14.6 ns     46824360
BM_Codec_Decode_DownloadBegin               14.3 ns         14.3 ns     49146682
BM_Codec_Encode_DownloadEnd                 19.6 ns         19.6 ns     35309549
BM_Codec_Decode_DownloadEnd                 19.0 ns         19.0 ns     36947616
BM_Codec_Encode_MarketDataStatus            7.20 ns         7.20 ns     97186586
BM_Codec_Decode_MarketDataStatus            8.62 ns         8.62 ns     81216447
BM_Codec_Encode_OrderManagerStatus          18.4 ns         18.4 ns     37102246
BM_Codec_Decode_OrderManagerStatus          19.8 ns         19.8 ns     35346359
BM_Codec_Encode_ReferenceData                101 ns          101 ns      6960748
BM_Codec_Decode_ReferenceData               78.7 ns         78.7 ns      8887705
BM_Codec_Encode_MarketStatus                31.4 ns         31.4 ns     23093559
BM_Codec_Decode_MarketStatus                25.9 ns         25.9 ns     26986312
BM_Codec_Encode_TopOfBook                   47.7 ns         47.7 ns     14919015
BM_Codec_Decode_TopOfBook                   34.5 ns         34.5 ns     21832749
BM_Codec_Encode_MarketByPrice               62.1 ns         62.1 ns     11328279
BM_Codec_Decode_MarketByPrice               41.7 ns         41.7 ns     16910612
BM_Codec_Decode_MarketByPrice_Handler       48.4 ns         48.4 ns     14439182
BM_Codec_Encode_MarketByOrder               70.2 ns         70.2 ns     10071313
BM_Codec_Decode_MarketByOrder               41.9 ns         41.9 ns     16693869
BM_Codec_Decode_MarketByPrice_Handler       47.5 ns         47.5 ns     14672666
BM_Codec_Encode_TradeSummary                49.3 ns         49.3 ns     14420367
BM_Codec_Decode_TradeSummary                29.5 ns         29.5 ns     23716515
BM_Codec_Encode_StatisticsUpdate            49.4 ns         49.4 ns     14258287
BM_Codec_Decode_StatisticsUpdate            35.5 ns         35.5 ns     19734559
BM_Codec_Encode_CreateOrder                 83.4 ns         83.4 ns      8295994
BM_Codec_Decode_CreateOrder                 75.4 ns         75.4 ns      9228426
BM_Codec_Encode_ModifyOrder                 25.1 ns         25.1 ns     27823293
BM_Codec_Decode_ModifyOrder                 19.4 ns         19.4 ns     35913429
BM_Codec_Encode_CancelOrder                 19.0 ns         19.0 ns     37844197
BM_Codec_Decode_CancelOrder                 17.0 ns         17.0 ns     41906712
BM_Codec_Encode_OrderAck                    70.5 ns         70.5 ns      9753247
BM_Codec_Decode_OrderAck                    60.3 ns         60.3 ns     11667614
BM_Codec_Encode_OrderUpdate                 94.1 ns         94.1 ns      7539847
BM_Codec_Decode_OrderUpdate                 81.5 ns         81.5 ns      8418764
BM_Codec_Encode_TradeUpdate                  110 ns          110 ns      6289431
BM_Codec_Decode_TradeUpdate                 73.9 ns         73.9 ns      9486738
BM_Codec_Encode_PositionUpdate              58.2 ns         58.2 ns     12221855
BM_Codec_Decode_PositionUpdate              39.6 ns         39.6 ns     17914321
BM_Codec_Encode_FundsUpdate                 34.5 ns         34.5 ns     21412721

Note

The protocol is proprietary and will not be described any further here. Suffice to say that the protocol is used by the native C++ client API.