Market data subscription

Hi,

I have a websocket client that I use for all my exchange market data. It is a c++ client based on websocketscpp. 'after the initial connection is established I am sending the following JSON over websocket connection, where id is always unique (uuid), Im suspecting one of two things.

  1. There is a problem with my mis/non use of access token

OR

  1. The JSON subscription message below is wrong.

“id”:“45646546”, symbol”:“GOOG”}

#live.tradovateapi.com for Live only functionality.
#demo.tradovateapi.com for simulation engine.
#md.tradovateapi.com and for a market data feed.

are available. I am only paper trading (in DEV) so Im connecting to demo.tradovateapi.com

• I can successfully issue my request for token using username, secret , cid etc. This is done via a CURL using a C++ request and the response gives me an accessToken, marketAccessToke as well as these other JSON fields

,“hasLive”:false,“outdatedTaC”:false,“hasFunded”:false,“hasMarketData”:true,“outdatedSentimentPolicy”:true}

• Then I can successfully establish a connection to wss://demo.tradovateapi.com/v1/websocket

$ ./client wss://demo.tradovateapi.com/v1/websocket/md/subscribeQuote

Successfully connected to:
wss://demo.tradovateapi.com/v1/websocket/md/subscribeQuote
Running websocket: wss://demo.tradovateapi.com/v1/websocket/md/subscribeQuote
[2024-09-29 19:17:09] [connect] Successful connection
[2024-09-29 19:17:09] [connect] WebSocket Connection 34.117.68.229:443 v-2 “WebSocket++/0.8.2” /v1/websocket/md/subscribeQuote 101

Note: I do not use the accessToken or mdAccessToken to connect. I think this is the source of error but I’m not sure.

However I know the wss connection is ok because I get a response back;

Connection is opened ok as my CURL callback receives o” . Note after this I get nothing back, no heartbeats, no “server disconnecting session” etc. (i.e. I get no ‘h’, ‘a’ or ‘c’ messages back from tradovate)

• I then try to subscribe to GOOG with websockets (websocketscpp). I send the follow over the websocket connection opened above (same client process that obtained the tokens)

{“id”:“0231242342232”,“method”:“subscribe”,“symbol”:“GOOG”}

I also try with just symbol and id (always uuid)
{“id”:“45646546”, symbol”:“GOOG”}
However I cannot subscribe! Nothing is coming back I know today is Sunday and market is closed but this is consistently failing. Can you see the fault?

./client wss://md.tradovateapi.com/v1/websocket/md/subscribeQuote
g++ -I. -I/home/gjw/websocketpp -std=c++2a -o client websockets.cpp main.cpp -lssl -lcrypto -lcurl -ljsoncpp -lpthread -lwebsockets
gjw@LUNA056:~/tradovate_abundance/GRAHAMS$ ./client wss://demo.tradovateapi.com/v1/websocket/md/SubscribeQuote
Received:
{“accessToken”:“XXXXXXXXXXXXXXXXXXXXXXXXX”,“mdAccessToken”:“YYYYYYYYYYYYYYY”,“expirationTime”:“2024-09-29T18:31:05.785Z”,“userStatus”:“Active”,“userId”:2854187,“name”:“Google:102927092604715150178”,“hasLive”:false,“outdatedTaC”:false,“hasFunded”:false,“hasMarketData”:true,“outdatedSentimentPolicy”:true}

Running websocket: wss://demo.tradovateapi.com/v1/websocket/md/subscribeQuote
[2024-09-29 19:17:09] [connect] Successful connection
[2024-09-29 19:17:09] [connect] WebSocket Connection 34.117.68.229:443 v-2 “WebSocket++/0.8.2” /v1/websocket/md/subscribeQuote 101

Received: o
--------------------------> GREAT - got control character ‘o’ back from tradovate

Sending following subscription symbol message: {“id”:“023991242342232”,“symbol”:“GOOG”}
Sent OK!
[2024-09-29 19:17:12] [frame_header] Dispatching write containing 1 message(s) containing 6 header bytes and 40 payload bytes
[2024-09-29 19:17:12] [frame_header] Header Bytes:
[0] (6) 81 A8 29 2D BC B2

[2024-09-29 19:17:12] [frame_payload] Payload Bytes:
[0] (40) [1] R
¬ ¬
^KBА fj

[2024-09-29 19:17:13] [control] Control frame received with opcode 8
[2024-09-29 19:17:13] [frame_header] Dispatching write containing 1 message(s) containing 6 header bytes and 5 payload bytes
[2024-09-29 19:17:13] [frame_header] Header Bytes:
[0] (6) 88 85 63 61 15 65

[2024-09-29 19:17:13] [frame_payload] Payload Bytes:
[0] (5) [8] 60 89 57 1C 06

[2024-09-29 19:17:13] [info] asio async_read_at_least error: asio.ssl.stream:1 (stream truncated)
[2024-09-29 19:17:13] [error] handle_read_frame error: websocketpp.transport:2 (Underlying Transport Error)
[2024-09-29 19:17:13] [info] asio async_write error: asio.ssl:337690831 (protocol is shutdown)
[2024-09-29 19:17:13] [fatal] handle_write_frame error: websocketpp.transport:2 (Underlying Transport Error)
^C