How to integrate FYERS API Bridge with front-end platforms?

How to integrate FYERS API Bridge with front-end platforms?

You can send Signals in FYERS API Bridge through an external program such as Amibroker/MT4/TradingView/Python/C# etc.

Understanding How Signals Work:

The FYERS API Bridge works based on “Signals”. A Signal is basically an indication (not decision) to Buy or Sell with specific conditions. The Bridge processes 4 types of Signals:

  • Long Entry (LE): Equivalent to fresh Buy for creating a Long position.
  • Long Exit (LX): Equivalent to Sell for reducing/square-off Long position.
  • Short Entry (SE): Equivalent to fresh Sell for creating Short position.
  • Short Exit (SX): Equivalent to Buy for reducing/square-off Short position.

For placing orders, the Bridge requires values either from Signal or from the Symbol Settings window. Any values given in Symbol Settings window over-ride the Signal values.

As per the above process diagram, the sequence of Signal processing is as follows:

  1. A signal is received in Bridge.
  2. Values are taken from Symbol Settings window by matching symbol given in Signal with “Input Symbol”.
  3. Signal Setting rules are applied from Application Settings -> Signal Settings.
  4. Risk Management rules are applied from Application Settings -> Global Risk Management.
  5. Order is sent to FYERS API.
Integration Specific Files

FYERS API Bridge connects with signal generation applications at three levels. Contact us for these integration specific files.

Easiest – Zero Programming Effort

TradingView: An external app TVConnector to fetch & process alerts

Intermediate – Programming via Scripts

Amibroker: AFL codes for adding to strategy, dll plugin files

MT4: Mq4, ex4 and mqh files

NinjaTrader: ninjascript files

Advanced – Socket Programming

Python/C#/Excel VBA: Code for socket connection

Note: Multiple Targets, Partial exits, custom position sizing, scalping, multi-leg execution etc. may be available via Bridge.

Signal Format & Coding Guide

FYERS API Bridge allows you to customize all values at each signal, such as quantity, or order type. You can program your own strategy to place orders with all custom values at each signal. For controlling order params via code, you should leave blank values in the Bridge under Symbol Settings. The mandatory values for each Symbol are marked with * under Symbol Settings.

The Signal format is:

ID,Type,Symbol,OrderType,TrigPrice,Price,Qty,InstrumentName,StrategyTag

• ID (mandatory): should be a unique id for each signal. If two signals are provided with the same id, the application may misbehave.

• Type (mandatory): can be either LE, LX, SE or SX.

• Symbol (mandatory): symbol name which will be matched to Input Symbol under Symbol Settings. If you want to send strike/expiry also through Amibroker, you can combine it in syntax “Symbol | Expiry | Strike | OptionType”

• OrderType (optional): can be Limit, Market, SLL or SLM. It can be combined for ProductType using “|”.

• TrigPrice (optional): should be 0 or Null for market/limit orders. If you want to send extra parameters for OCO order, you can combine it in syntax “TrigPrice | StopLoss | SquareOff | TrailingTicks”

• Price (optional): should be 0 or Null for market orders

• Qty (optional): Order Quantity

• InstrumentName (optional): It should be any of the following EQ|FUTIDX|FUTSTK|OPTIDX|OPTSTK|FUTCUR|FUTCOM

• StrategyTag (optional): It can be any string to identify which particular strategy is sending Signals

Coding Examples

All example Signal codes given below are sent using mostly blank columns in Bridge to place the order.

Example 1: Send Market Order in Equities to create Short position:

FYERS_Signal(“1”, “SE”,”SBIN”,”Market|MIS”,””,””,”100″,”EQ”,””);

Example 2: Send Stop Limit Order in Equities to create Short position:

FYERS_Signal(“1”, “SE”,”SBIN”,”SLL|MIS”,”302.50″,”302″,”100″,”EQ”,””);

Example 3: Send Stop Market Order in Equities to create Long position:

FYERS_Signal(“8”, “LE”,”SBIN”,”SLM|MIS”,”302″,”0″,”100″,”EQ”,”STG1″);

Example 4: Send Bracket Order in Equities for Long trade:

FYERS_Signal(“6″,”LE”,”SBIN”,”SLL|BO”,”302|1.5|3″,”302.10″,”100″,”EQ”,”STG1″);

Example 5: Send Limit Order in BankNifty Futures to create Short position:

FYERS_Signal(“6”, “LE”,”BANKNIFTY”,”Limit|NRML”,””,”28400″,”20″,”FUTIDX”,”STG1″);

Example 6: Send Limit Order in BankNifty Options to exit Long position:

FYERS_Signal(“6”, “LX”,”BANKNIFTY|28Nov2019|28400|CE”,”Limit|NRML”,””,”102.50″,”20″,”OPTIDX”,”STG1″);

Example 7: Send Market order in Currency Futures to exit Long position:

FYERS_Signal(“6”, “LX”,”EURINR|27Nov2019″,”Market|NRML”,””,”0″,”1000″,”FUTCUR”,”STG1″);

    • Related Articles

    • How to get started with FYERS API Bridge?

      You can request API Bridge to integrate with front-end platform simply by following step by step process. Request access to FYERS Trading API. (More information on Trading API click here) Subscribe to the API Bridge here. The subscription will get ...
    • What is the FYERS API Bridge?

      FYERS API Bridge is a lightweight and easy to use portable application. It can be integrated with the FYERS order management engine through our Trading API to place orders or requests from the front-end charting/Algo platform. For more information, ...
    • How do I sign up for FYERS API Bridge?

      FYERS API Bridge is a tool that allows you to connect your trading strategies with FYERS Trading API and execute orders on various platforms such as TradingView, Amibroker, MT4, Python, Excel, etc. To sign up for FYERS API Bridge, you need to: ...
    • How to integrate FYERS API Bridge Advanced Extension with TradingView?

      We have released FYERS API Bridge Advanced Extension for TradingView platform with few updates. Installation For the latest version of TradingView Extension, click Help from the top menu of FYERS APIBridge. Then go to Jump Start setup and follow ...
    • How to integrate FYERS API Bridge with Excel using VBA coding?

      FYERS API Bridge can be integrated with Excel and to Algo trade from Excel, you can code in VBA to for sending signals in FYERS API Bridge in excel. You need to create a TCP client as given below. Read this article to understand how FYERS API Bridge ...