For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Support Center
OverviewAPIResources
OverviewAPIResources
  • REST API Endpoints
      • POSTChange Speed
      • POSTCheck Replay Session
      • POSTInitialize Clock
Support Center
LogoLogo
REST API EndpointsPrices

Check Replay Session

POST
https://demo.tradovateapi.com/v1/replay/checkreplaysession
POST
/v1/replay/checkreplaysession
1const url = 'https://demo.tradovateapi.com/v1/replay/checkreplaysession';
2const options = {
3 method: 'POST',
4 headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
5 body: '{"startTimestamp":"2024-01-15T09:30:00Z"}'
6};
7
8try {
9 const response = await fetch(url, options);
10 const data = await response.json();
11 console.log(data);
12} catch (error) {
13 console.error(error);
14}
200Successful
1{
2 "checkStatus": "Ineligible",
3 "startTimestamp": "2024-01-15T09:30:00Z"
4}
### Before beginning a Market Replay session, call this endpoint to check that the given timeframe is valid within the scope of the user's entitlements. You should use this endpoint from a WebSocket hooked up to the Market Replay URL. ```js const URL = 'wss://replay.tradovateapi.com/v1/websocket' const myMarketReplaySocket = new WebSocket(URL) //simple WebSocket authorization procedure myMarketReplaySocket.onopen = function() { myMarketReplaySocket.send(`authorize\n0\n\n${accessToken}`) }) //JSON string for midnight April 30th 2018 const startTimestamp = new Date('2018-04-30').toJSON() myMarketReplaySocket.send(`replay/checkreplaysession\n1\n\n${JSON.stringify({startTimestamp})}`) //listen for response myMarketReplaySocket.addEventListener('message', msg => { const datas = JSON.parse(msg.data.slice(1)) //chop off leading 'frame' char //datas looks like this [{s: 200, i: 1, d: { checkStatus: 'OK' } }] if(datas) { datas.forEach(({i, d}) => { if(i && i === 1) { //id of our sent message is 1, response's `i` field will be 1. console.log(d) //=> { checkStatus: 'OK' } //if the status is OK we can send the initializeClock message } }) } } ```
Was this page helpful?
Previous

Initialize Clock

Next
Built with

Before beginning a Market Replay session, call this endpoint to check that the given timeframe is valid within the scope of the user’s entitlements.

You should use this endpoint from a WebSocket hooked up to the Market Replay URL.

1const URL = 'wss://replay.tradovateapi.com/v1/websocket'
2
3const myMarketReplaySocket = new WebSocket(URL)
4
5//simple WebSocket authorization procedure
6myMarketReplaySocket.onopen = function() {
7 myMarketReplaySocket.send(`authorize\n0\n\n${accessToken}`)
8})
9
10//JSON string for midnight April 30th 2018
11const startTimestamp = new Date('2018-04-30').toJSON()
12myMarketReplaySocket.send(`replay/checkreplaysession\n1\n\n${JSON.stringify({startTimestamp})}`)
13
14//listen for response
15myMarketReplaySocket.addEventListener('message', msg => {
16 const datas = JSON.parse(msg.data.slice(1)) //chop off leading 'frame' char
17 //datas looks like this [{s: 200, i: 1, d: { checkStatus: 'OK' } }]
18 if(datas) {
19 datas.forEach(({i, d}) => {
20 if(i && i === 1) { //id of our sent message is 1, response's `i` field will be 1.
21 console.log(d) //=> { checkStatus: 'OK' }
22 //if the status is OK we can send the initializeClock message
23 }
24 })
25 }
26}

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.
startTimestampdatetimeRequired

Response

CheckReplaySessionResponse
checkStatusenum
Ineligible, OK, StartTimestampAdjusted
Allowed values:
startTimestampdatetime