Check Replay Session
### 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
}
})
}
}
```
Authentication
AuthorizationBearer
Bearer authentication of the form Bearer <token>, where token is your auth token.
Request
This endpoint expects an object.
startTimestamp
Response
CheckReplaySessionResponse
checkStatus
Ineligible, OK, StartTimestampAdjusted
Allowed values:
startTimestamp

