Details requested on rate limiting threshold for market data requests

I’m finding that my project is getting hit with the rate limiter quite often when using the getChart request. I was wondering if you could please provide more specifics around the thresholds here for market data? Is there a way to increase the limitations if needed?

1 Like

It’s actually really easy to appease the rate limiter when it comes to getChart, you just need to wait 'p-time' seconds, then retry the penalized request with all the same parameters in the body, plus 'p-ticket' as an additional body parameter. It’s usually only a 1 second penalty, then it will go back to a normal rate until you get hit again. I use code like this to account for it:

//excerpt from a Tradovate Socket implementation
function TradovateSocket() {

    //...

    this.subscribe = async function({url, body, subscription}) {
        const self = this
        
        let [response] = await self.send({url, body})

        if(response.d['p-ticket']) {
            await waitForMs(response.d['p-time']*1000)
            let [nextResponse] = await self.send({
                url, 
                body: { ...body, 'p-ticket': response.d['p-ticket'] }
            })
            response = nextResponse
        }

        const realtimeId = response?.d?.realtimeId
        
        console.log(realtimeId)

        //... return new Promise(...
    }

    //...
}
1 Like

Thanks Alexander, I have coded around it but it happens a lot and I was trying to understand what those limits are, and if they could be adjusted on a client basis.

1 Like