I am trying to calculate 50 EMA using TA-lib and upstox API, but it’s giving wrong calculations for Bank Nifty Feb month Futures chart. AT 26-2-2024 12:58 it’s calculating EMA50 as 46653 but in chart it was 46670
Any help?
using api: url = ‘https://api.upstox.com/v2/historical-candle/intraday/NSE_FO|71440/1minute’
I’m uncertain if charts utilize the same process as the TA library. Have you experimented with any other libraries to see if the outcomes are identical?
We may not be able to offer direct assistance for issues related to third-party libs. Upstox API support is more for problems encountered within the Upstox API platform. Should you encounter any discrepancies in the data provided, please bring them to our attention, and we will provide assistance.
Thanks for reply.
I have used pandas_ta library too, it’s calculating same value.
Now i am using index ‘https://api.upstox.com/v2/historical-candle/intraday/NSE_INDEX|Nifty Bank/1minute’ which returns EMA50 bit closer to value as drawn in chart, but not exact (8-10 additional points) E.g 28 Feb EMA 50 at 3:30pm was 46002 but both libraries returning 46011. can you share how do you calculate EMA/SMA.
The EMA/SMA values are not calculated explicitly; instead, they are determined by the trading chart libraries, such as TradingView or ChartIQ. The data is supplied to the chart through the same HTTP API. However, for intraday data, the current and one previous candle are directly referenced from the websocket, as it provides access to the most recent and the preceding candle.
I’m uncertain if these two candles making a difference in calculation, considering the HTTP API caches data for improved performance, which might introduce a millisecond delay. You might want to consider fetching the last two 1-minute candles directly from the websocket to see if it makes a difference.
@Pradeep_Jaiswar Can’t find this week’s expiry date and instrument key for BankNifty in NSE excel data. Please guide. After 3rd April 2024 , it’s 25 April 2024 expiry date.