Latency with spot order market

Hi, I have developed a trading bot on python, which is based on a strategy written in pinescript. The pyton bot connects to Binance via API key and places market orders on the spot market following the logic of the code and using Heikin ashi candles. The problem is that it has a latency of just over 2s per operation. It also has a price difference between backtesting my pinescript strategy on tradingview, and orders placed on Binance, of around 2% on average. I know that it is partly due to the calculation of the heikin ashi candles but I would like to reduce this percentage to the minimum possible. Could implementing a websocket instead of REST API be a solution? Are there other solutions? Has anyone already found themselves in a similar situation and found a solution? Thank you

How did you find the 2s latency? what kind of data are you fetching?

A developer on fiverr told me this. How can I check what kind data i’m fetching?

You need to research that on your own. Try to understand what endpoints you’re using and consult the API documentation Binance API Documentation to see if those endpoints can be replaced by Websocket streams to reduce the latency.

please can you answer?

Someone can help me?