Initialize Clock

### Set the inital date and time for a market replay session. Using a WebSocket connected to the Tradovate Market Replay URL, we can start a Market Replay Session which will simulate a given timeframe as if it were happening live. Each replay session creates a new replay account which gets discarded at the end of the replay session. ```js const URL = 'wss://replay.tradovateapi.com/v1/websocket' const myMarketReplaySocket = new WebSocket(URL) //simple WebSocket authorization procedure myMarketReplaySocket.onOpen = function onOpen() { myMarketReplaySocket.send(`authorize\n0\n\n${accessToken}`) }) const requestBody = { startTimestamp: new Date('2018-04-30').toJSON(), speed: 100, //100%, range is from 0-400% initialBalance: 50000 //account balance for replay session } myMarketReplaySocket.send(`replay/initializeclock\n1\n\n${JSON.stringify(requestBody)}`) myMarketReplaySocket.addEventListener('message', msg => { const datas = JSON.parse(msg.data.slice(1)) if(datas) { datas.forEach(({i, d}) => { if(i && i === 1) { //sent id is 1, response id will be 1 console.log(d) //=> { ok: true } } }) } }) ```

Authentication

AuthorizationBearer

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

Request

This endpoint expects an object.
startTimestampstringRequiredformat: "date-time"
speedintegerRequired0-400
initialBalancedoubleOptional

Response

SimpleResponse
okboolean
errorTextstring or null<=8192 characters

Non-empty if the request failed