What is the Reason for deprecating CMD field in API response

I rec’d Notice Board - FYERS this link that simply says Action Required: cmd Field in API to be Deprecated

I would like to hear proper reasoning behind this move.

I have been a long time user, active forum member and have been assisting in API feedback as well.

I use both Data and Order socket streams and APIs since V2, having seen a lot of development too. In a few words, quote API is not streaming and therefore current minute data is very useful, I still use it when Data socket issues arise. Removing it renders quote API as a lame endpoint.

FYI

Updated on 27th February 2024: The deadline for deprecating the ‘cmd’ field has been extended to 28th March 2024. The 1st deadline was 1st March 2024.

Hi @chirag , This change is part of our internal enhancements. We will be shortly sharing the required work around to continue receiving the same OHLCV response for the current minute post cmd field deprecation post March 28th. will keep you posted on this.

If I am understanding correctly regarding what you are looking for, @chirag you can poll History API to get minute level OHLCV data in case of Socket failure. I believe it gives current live data only.

@chirag, please use this logic:
alternative solution for cmd post deprecate,

please use the following approach to get current minute partial candle.

Sample python Code

  1 from fyers_apiv3 import fyersModel
  2 from datetime import datetime
  3
  4 client_id = "XXXXXX"
  5 access_token = "eyJ0eXXXXXXXX2c5-Y3RgS8wR14g"
  6
  7 fyers = fyersModel.FyersModel(client_id=client_id, token=access_token, log_path="/home/ec2-user/logs")
  8
  9 now = int(datetime.timestamp(datetime.now()))
 10 print(now)
 11 now -= now % 60
 12 from_time = str(now)
 13
 14 data = {
 15     "symbol":"NSE:USDINR24MARFUT",
 16     "resolution":"1",
 17     "date_format":"0",
 18     "range_from":from_time,
 19     "range_to":from_time,
 20     "cont_flag":"1"
 21 }
 22
 23 response = fyers.history(data=data)
 24 print(response)

Note : Please test it well before final deprecate data, before going live.

Reach out any concern.

@nsuyash11-m18 @kishore_krishna

This will not work efficiently because Quote API supports 50 symbols simultaneously, so one can in lesser number of requests within API limit achieve data fetch.

I have been here long enough to understand many things, infact when Pankaj Fyers staff was active here, I am of the opinion of NOT using the history API for RTD. Kindly read my old posts.

The Quote API in its current format would actually serve as a near RTD solution for those not implementing the heavier WS method.

The CMD is also part of many other broker api endpoints.

We will be shortly sharing the required work around to continue receiving the same OHLCV response for the current minute post cmd field deprecation post March 28th. will keep you posted on this.

I am more interested in knowing what you have here?

from fyers_apiv3 import fyersModel

from datetime import datetime

client_id = “XXXXXX”

access_token = “eyJ0eXXXXXXXX2c5-Y3RgS8wR14g”

fyers = fyersModel.FyersModel(client_id=client_id, token=access_token, log_path=“/home/ec2-user/logs”)

now = int(datetime.timestamp(datetime.now()))

now -= now % 60

from_time = str(now)

for symbol in {“NSE:ACC-EQ”, “NSE:SBIN-EQ”}:

data = {

    "symbol":symbol,

    "resolution":"1",

    "date_format":"0",

    "range_from":from_time,

    "range_to":from_time,

    "cont_flag":"1"

}

response = fyers.history(data=data)

print("Symbol :", symbol, "Data :", response)

Please use this for multiple symbols

The code you pasted is still history api

That is one http request per symbol right?

how is that so? you are iterating here

for symbol in {“NSE:ACC-EQ”, “NSE:SBIN-EQ”}:

so for 150 symbols, there will 150 calls to history

@kishore_krishna awaiting reply, for last post.

It is clear you are iterating over list of symbols, yet you are insisting on single http request.

This is serious deviation which will break all code and yet I see no urgency from Fyers side.

@shruthi_shetty is there anyone from Dev side who can address these queries reliably? I am not getting any response from Kishore.

@chirag, sure. I will share your concern with the concerned team to provide you with better assistance.

Hi @chirag,

We have taken your issue into consideration and discussed it internally. The method you are currently following to plot charts using cmd values is not intended for the purpose, and we have to discontinue the same since seconds charts are rolled out and the current minute is no longer the smallest timeframe. You can subscribe to our quotes data socket API’s to receive continuous tick data (LTP), and you can use the same for plotting candles. Any issues regarding the data sockets will be fixed and will be ensured you are not facing any issues receiving data from the same

.

Thanks for the reply, as i wrote above, I’ve branched my code to adapt to non-CMD response and that requires to store Volume and track it. Also, the High/Low needs to be monitored for spikes and make candles accordingly.

I will test it and share,

but even having or not having seconds chart seems not relevant to the issue. If for example, i am polling once a minute to ensure API limit is not hit, CMD serves the purpose. You cant use Quote API for seconds charts, it needs websocket stream only. anyway, i leave it here although every scenario should be considered. Quote API serves two purposes, backup when WS is down and an alternate light-weight near realtime data API for app when internet is limited etc