I am not using that example program.
Debugging further, I see that I can subscribe to marketdata and I can also call certain API endpoints
[contract/find
2
name=MESM2]
++Sent raw: b"\x81\x9a\xbd\x90bd\xde\xff\x0c\x10\xcf\xf1\x01\x10\x92\xf6\x0b\n\xd9\x9aPn\xd3\xf1\x0f\x01\x80\xdd'7\xf0\xa2"
++Sent decoded: fin=1 opcode=1 data=b'contract/find\n2\nname=MESM2'
++Rcv raw: b'\x81~\x00\x84a[{"s":200,"i":2,"d":{"id":2553027,"name":"MESM2","contractMaturityId":45114,"status":"DefinitionChecked","providerTickSize":0.25}}]'
++Rcv decoded: fin=1 opcode=1 data=b'a[{"s":200,"i":2,"d":{"id":2553027,"name":"MESM2","contractMaturityId":45114,"status":"DefinitionChecked","providerTickSize":0.25}}]'
MD -- SUBSCRIBE MARKET DATA
md/subscribeQuote
1
{"symbol":2553027}
++Sent raw: b'\x81\xa7g\x85\x0e\xcb\n\xe1!\xb8\x12\xe7}\xa8\x15\xecl\xae6\xf0a\xbf\x02\x8f?\xc1m\xfe,\xb8\x1e\xe8l\xa4\x0b\xa74\xf9R\xb0=\xfbU\xb2s'
++Sent decoded: fin=1 opcode=1 data=b'md/subscribeQuote\n1\n\n{"symbol":2553027}'
MD -- ACTIVE SYMBOL [2553027]
++Rcv raw: b'\x81Ca[{"s":200,"i":1,"d":{"mode":"RealTime","subscriptionId":2553027}}]'
++Rcv decoded: fin=1 opcode=1 data=b'a[{"s":200,"i":1,"d":{"mode":"RealTime","subscriptionId":2553027}}]'
++Rcv raw: b'\x81~\x01\x9aa[{"e":"md","d":{"quotes":[{"id":2553027,"timestamp":"2022-03-17T17:00:13.698Z","contractId":2553027,"entries":{"Bid":{"price":4372.0,"size":27},"Offer":{"price":4372.25,"size":9},"Trade":{"price":4372.25,"size":2},"OpeningPrice":{"price":4360.75},"SettlementPrice":{"price":4349.5},"TotalTradeVolume":{"size":659127},"OpenInterest":{"size":61938},"HighPrice":{"price":4374.0},"LowPrice":{"price":4320.5}}}]}}]'
++Rcv decoded: fin=1 opcode=1 data=b'a[{"e":"md","d":{"quotes":[{"id":2553027,"timestamp":"2022-03-17T17:00:13.698Z","contractId":2553027,"entries":{"Bid":{"price":4372.0,"size":27},"Offer":{"price":4372.25,"size":9},"Trade":{"price":4372.25,"size":2},"OpeningPrice":{"price":4360.75},"SettlementPrice":{"price":4349.5},"TotalTradeVolume":{"size":659127},"OpenInterest":{"size":61938},"HighPrice":{"price":4374.0},"LowPrice":{"price":4320.5}}}]}}]'
MD -- SUBSCRIBE MARKET DATA
++Rcv decoded: fin=1 opcode=1 data=b'a[{"e":"md","d":{"quotes":[{"id":2553027,"timestamp":"2022-03-17T17:00:13.715Z","contractId":2553027,"entries":{"Bid":{"price":4372.0,"size":27},"Offer":{"price":4372.25,"size":4},"Trade":{"price":4372.25,"size":1},"OpeningPrice":{"price":4360.75},"SettlementPrice":{"price":4349.5},"TotalTradeVolume":{"size":659128},"OpenInterest":{"size":61938},"HighPrice":{"price":4374.0},"LowPrice":{"price":4320.5}}}]}}]'
++Rcv raw: b'\x81Ca[{"s":200,"i":2,"d":{"mode":"RealTime","subscriptionId":2553027}}]'
++Rcv decoded: fin=1 opcode=1 data=b'a[{"s":200,"i":2,"d":{"mode":"RealTime","subscriptionId":2553027}}]'
++Rcv raw: b'\x81~\x01\x9aa[{"e":"md","d":{"quotes":[{"id":2553027,"timestamp":"2022-03-17T17:00:13.811Z","contractId":2553027,"entries":{"Bid":{"price":4372.0,"size":27},"Offer":{"price":4372.25,"size":2},"Trade":{"price":4372.25,"size":1},"OpeningPrice":{"price":4360.75},"SettlementPrice":{"price":4349.5},"TotalTradeVolume":{"size":659128},"OpenInterest":{"size":61938},"HighPrice":{"price":4374.0},"LowPrice":{"price":4320.5}}}]}}]'
++Rcv decoded: fin=1 opcode=1 data=b'a[{"e":"md","d":{"quotes":[{"id":2553027,"timestamp":"2022-03-17T17:00:13.811Z","contractId":2553027,"entries":{"Bid":{"price":4372.0,"size":27},"Offer":{"price":4372.25,"size":2},"Trade":{"price":4372.25,"size":1},"OpeningPrice":{"price":4360.75},"SettlementPrice":{"price":4349.5},"TotalTradeVolume":{"size":659128},"OpenInterest":{"size":61938},"HighPrice":{"price":4374.0},"LowPrice":{"price":4320.5}}}]}}]'
++Rcv raw: b'\x81~\x01\x9aa[{"e":"md","d":{"quotes":[{"id":2553027,"timestamp":"2022-03-17T17:00:13.885Z","contractId":2553027,"entries":{"Bid":{"price":4372.0,"size":35},"Offer":{"price":4372.5,"size":40},"Trade":{"price":4372.25,"size":1},"OpeningPrice":{"price":4360.75},"SettlementPrice":{"price":4349.5},"TotalTradeVolume":{"size":659128},"OpenInterest":{"size":61938},"HighPrice":{"price":4374.0},"LowPrice":{"price":4320.5}}}]}}]'
++Rcv decoded: fin=1 opcode=1 data=b'a[{"e":"md","d":{"quotes":[{"id":2553027,"timestamp":"2022-03-17T17:00:13.885Z","contractId":2553027,"entries":{"Bid":{"price":4372.0,"size":35},"Offer":{"price":4372.5,"size":40},"Trade":{"price":4372.25,"size":1},"OpeningPrice":{"price":4360.75},"SettlementPrice":{"price":4349.5},"TotalTradeVolume":{"size":659128},"OpenInterest":{"size":61938},"HighPrice":{"price":4374.0},"LowPrice":{"price":4320.5}}}]}}]'
++Rcv raw: b'\x81~\x01\x9aa[{"e":"md","d":{"quotes":[{"id":2553027,"timestamp":"2022-03-17T17:00:13.885Z","contractId":2553027,"entries":{"Bid":{"price":4372.0,"size":35},"Offer":{"price":4372.5,"size":40},"Trade":{"price":4372.25,"size":1},"OpeningPrice":{"price":4360.75},"SettlementPrice":{"price":4349.5},"TotalTradeVolume":{"size":659138},"OpenInterest":{"size":61938},"HighPrice":{"price":4374.0},"LowPrice":{"price":4320.5}}}]}}]'
++Rcv decoded: fin=1 opcode=1 data=b'a[{"e":"md","d":{"quotes":[{"id":2553027,"timestamp":"2022-03-17T17:00:13.885Z","contractId":2553027,"entries":{"Bid":{"price":4372.0,"size":35},"Offer":{"price":4372.5,"size":40},"Trade":{"price":4372.25,"size":1},"OpeningPrice":{"price":4360.75},"SettlementPrice":{"price":4349.5},"TotalTradeVolume":{"size":659138},"OpenInterest":{"size":61938},"HighPrice":{"price":4374.0},"LowPrice":{"price":4320.5}}}]}}]'
++Rcv raw: b'\x81~\x01\x9aa[{"e":"md","d":{"quotes":[{"id":2553027,"timestamp":"2022-03-17T17:00:13.935Z","contractId":2553027,"entries":{"Bid":{"price":4372.0,"size":32},"Offer":{"price":4372.25,"size":8},"Trade":{"price":4372.25,"size":1},"OpeningPrice":{"price":4360.75},"SettlementPrice":{"price":4349.5},"TotalTradeVolume":{"size":659138},"OpenInterest":{"size":61938},"HighPrice":{"price":4374.0},"LowPrice":{"price":4320.5}}}]}}]'
I also looked at the backend of the tradovate website and saw a curl example, there’s a deviceId string here, I tried that but the application still gets 401 errors when trying to place orders.
curl -X POST "https://demo-api.tradovate.com/v1/auth/accesstokenrequest" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d "{ \
\"name\": \"username\", \
\"password\": \"YourPassword\", \
\"appId\": \"name\", \
\"appVersion\": \"0.0.0\", \
\"deviceId\": \"[THERE'S a DEVICEID STRING HERE\", \
\"cid\": \"000\", \
\"sec\": \"YourSecret\" \
}"
application permissions:
contract library: read_only,
account_info: full_access,
alerts: full_access,
Orders: full_access,
user info: full_access,
market data: read_only,
positions: read_only,
account risk settings:
full access,
chat: denied
I can call certain api functions but no order functions, i can subscribe and get marketdata stream, also i don’t use demo-api urls or websockets, I use the ones referenced above.
–edit-- adding sample call to place order
API -- LAST COMMAND FAILED
[order/placeorder
3
{"accountSpec":"username","accountId":xxx,"action":"Buy","timeInForce":"Day","symbol":2553027,"orderQty":2,"orderType":"Limit","price":4367.5,"isAutomated":true}]
[{'s': 401, 'i': 3, 'd': 'Access is denied'}]
@Alexander, any idea what could be wrong here?