Click or drag to resize

Fyers Connection

Fyers is a leading broker, based in India. This section describes how to connect to the Fyers API.

In our constant endeavour to enhance the API ecosystem we have released a C# wrapper of the Fyers API. For more details please refer to our GitHub page.


Please make sure you meet the below requirements to connect to Fyers.

Configuring Fyers Connection

Please follow the below steps to setup the Fyers Connection.

  • In the "Main View" goto Connection > Add Edit Connection
  • In the Add Edit connection view click on the Add button
  • In the "New Connection View" select 'Fyers' as the Connection Type and set the settings as
    • Name - Append a suitable name of the connection in the Name textBox
    • Master download interval - Append a suitable master symbol download interval. If you append 0 (zero), then ArthaChitra will download the master symbol each time you connect to the API.
  • Click on the Close button and exit the Add Edit connection view

Now you will be able to connect to the newly created Fyers Connection from:

  • In Main View menu bar goto Connection > Available Connections > {name of the Fyers connection}
  • In the Fyers OAuth View append your Fyers login credentials
  • When logging for the first time you will be asked to provide required permission to our app "ArthaChitra""
Fyers Connection
Fyers Login Screen

Before connecting to Fyers Connection please refer to the below scenarios for a proper understanding on how ArthaChitra works with the Fyers Connection. Please do note the below list is not exhaustive. There may be scenarios in addition to what listed below

  • The Fyers API has a throttling policy. Please click here to know more about it.
  • For FnO scrips ArthaChitra handles the order quantity in terms of number of contracts and NOT in lot size. For example if you are placing an order to buy 1 lot of Nifty futures then append the quantity as 1 (one) instead of 75 (seventy five) which is the current lot size. Similarly the FnO quantity is displayed in terms of number of contracts across the views.
  • The Fyers Connection downloads the master instruments which can be around 10MB in size. This can take some time depending on your net speed. The interval at which the same will be downloaded depends on the “Master download interval” connection settings.
  • The Fyers API does not supports OCO tags (for Cash and Margin ProductType). Thus if you submit any OCO order the OCO simulation will be evaluated locally. If you get disconnected the OCO orders will not canceled automatically.
  • Fyers API supports multiple order placement upto 10 (ten) orders simultaneously. In case you place more than 10 orders via the Basket Order View then ArthaChitra will slice the basket in batches of 10 orders.
  • Main View menu bar 'New > Orders > Cancel All Orders' will cancel all Cash and Margin orders. OCO/BO and CO orders will not be canceled.
  • Fyers connection supports OCO Order Template, Cover Order Templates and Multi-Level Bracket Order Templates. If you assign any order template while submitting an order please make sure to assign the Product Type as mentioned below:

    Order Template

    Product Type


    OCO Order Template (Bracket orders)


    Native Bracket orders as supported by broker

    Cover Order Templates


    Native Cover orders as supported by broker

    Multi-Level Bracket Order Templates


    INTRADAY orders are placed. Additional margin may be required for stop/targets.

    OCO Simulation is held locally. If there is delay in receiving the order notification (from the API) the OCO simulation may fail or get delayed.

    If you get disconnected and one order gets filled you have to manually cancel the other order.

  • Fyers OCO/BO orders does not supports Trailing stop orders
  • ArthaChitra does not supports spread orders or multi leg orders.
  • The Quantity field in the modify order API call takes the Remaining order quantity as the parameter. This may led to a race condition and can result in overfill. Users are adviced to double check the order status while modifying the order quantity.
  • As of now the Fyers Connection does not supports automated strategies.
  • The Fyers API supports only Limit and Market orders for cover (CO) entry orders
  • Canceling the stop or target order of a bracket order (BO) or cover order (CO) will close the position.
  • Bracket orders (BO) and Cover orders (CO) are generated dynamically. As such the orders will be displayed in the views (Main View, Chart etc) only after ArthaChitra receives the order postback notification from the OMS.
  • In case the order status is not automatically updated, please refresh the order status by following the below steps
    • In Main View > Orders tab, select the necessary order
    • Right click on the selected order
    • In the context menu click on the option "Refresh order status"
  • The Holdings tab (in Main View) displays the actual holding values as returned by the Fyers API.
  • The Fyers API does not provides the trade or position updates via the sockets.
  • Fyers connection does not supports Reverse position commands
  • If you try closing a position it will use the API's Exit Position by Id request. Position will be cloes as per Instrument and product type (only Cash and Margin product types are supported).
  • You must first cancel working orders before pressing the Close postion command
  • If your logs return the below response then it denotes that the Fyers system/server is unavailable at that point of time. In such scenario please try sending your requests once the Fyers system/server is available for trading
        <head><title>502 Bad Gateway</title></head>
            <center><h1>502 Bad Gateway</h1></center>
  • When you submit an order, there may be times, the Fyers API may send an invalid response.

    03May21 11:47:30, Connection, FyersDataFeed.OnJson : FyersAPI.OrderResponse: {"s": "error", "code": -202, "message": "Connection error. Please try again", "id": ""}

    However in actual, the order may be accepted by Fyers. In such scenario, ArthaChitra will create the order on the fly as and when it receives the order postback. However you will also witness the originally submitted order in Rejected/Pending state in the Main View > Orders tab or in the Charts/DOM etc.

  • ArthaChitra will disconnect if the socket receives a 'not authentication' message. This happens when you login to your Fyers account from another source (Fyers Web for example)

    {"s": "error", "101": "", "102": "ERR : _verifyTokenHash-> Unknown. ERR : _verifyTokenHash-> Line:1036 Exception:HTTP 401: Unauthorized", "code": -1600, "message": "Could not authenticate the user "}

  • While loggin to Fyers, if you receive the message "Your password has expired and must be changed before you can log on" then please change the password from Fyers Web etc and then try login from ArthaChitra
    Fyers Password Change
  • The Fyers API provides Minute and Daily data for 100 days and 1 year respectively.
  • User can stream real-time data for upto 100 scrip
See Also

Other Resources