How to integrate FYERS API Bridge with Python?

How to integrate FYERS API Bridge with Python?

Integrating Python with FYERS API Bridge is extremely easy. You just need to execute the following Python v3 code for placing orders. If you need further help, do not hesitate to contact us at [email protected].

import socket
# client code to connect with API bridge
HOST = '127.0.0.1'  # The server's hostname or IP address
PORT = 56789    # The port used by the server

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    s.connect((HOST, PORT))
    #ID,Type,Symbol,OrderType,TrigPrice,Price,Qty,InstrumentName,StrategyTag"
    # Symbol = Symbol | Expiry | Strike | OptionType
    # TrigPrice = TrigPrice | StopLoss | SquareOff | TrailingTicks
    # StrategyTag = StrategyTag | Port

    #s.sendall(b"8,LE,SBIN,M,1,180,1,EQ,STG11")
    #s.sendall(b"8,SE,RELIANCE,L,1,180,1,EQ,STG11")
   # s.sendall(b"8,SE,HDFC,L,1,1200,100,EQ,STG11")
    #s.sendall(b"8,SE,INFY|30MAY2019|130|PE,L,1,2000,50,OPTSTK,STG11")
    s.sendall(b"8,LE,MARUTI,L,1,180,1,EQ,STG11")

    data = s.recv(1024)

print('Received', repr(data))
    • Related Articles

    • 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 ...
    • 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 MT4/MT5 platform?

      FYERS API Bridge can be integrated with MT4/MT5 platform to send signals. Step 1 – Copy and paste chart trader.mqh, chart trader.ex4 in expert folder path -open MT4->FILES-> open data folder->MQL4->Experts Step 2 – Copy and paste Algotrading.mqh in ...
    • 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, ...