Fyers

Fyers

  • API Docs
  • Demo

›Order Placement

Order Placement

  • Order Placement Branded buttons
  • Order Placement - Custom Buttons

Hosted Pages

  • How to host a page?
  • Orders
  • Positions
  • Funds
  • Holdings
  • Trades

Appendix

  • Parameters
  • Methods

Order Placement Branded buttons

The FYERS API Connect SDK is similar to a payment gateway. It allows you to integrate a button into your website / app which will open a different pop-up which takes care of:

  • User login authentication
  • Order placement input validations
  • Order window checks as per the exchange guidelines
  • Order placement to the API
  • Display of success / error responses to the user
  • Retry option to the user incase of failure
  • Redirect the user to the original page from where the flow was initiated

Once the flow is initiated, your website / app can start a FYERS API session as well using the user token.

Install Plugin

You need to include the FYERS API Connect JS script in your website / app.

  • This needs to be included inside the
  • Preferably just before closing the body tag
  • This needs to be included just once in your web page
<script src="https://api-connect-docs.fyers.in/fyers-lib.js"></script>

Buy Order

You can use the custom to show branded FYERS API Connect buttons that will initiate a buy order for the user.

You can provide all the necessary information at the time of initiating the HTML and associating it with the buy button.

<!--A button to initiate a buy--!>
<fyers-button data-fyers="API_KEY" 
data-symbol="NSE:SBIN-EQ"
data-product="INTRADAY"
data-quantity=1
data-price=102 
data-order_type="LIMIT"
data-transaction_type="BUY">
</fyers-button>

Sell Order

You can use the custom to show branded FYERS API Connect buttons that will initiate a sell order for the user.

You can provide all the necessary information at the time of initiating the HTML and associating it with the sell button

<!--A button to initiate a buy--!>
<fyers-button data-fyers="API_KEY" 
data-symbol="NSE:SBIN-EQ"
data-product="INTRADAY"
data-quantity=1
data-price=102 
data-order_type="LIMIT"
data-transaction_type="SELL">
</fyers-button>

Basket Order

You can use the custom to show the branded FYERS API Connect button that will initiate a basket order for the user.

You can provide a list of orders, both buy and sell, at the time of initiating the HTML and associating it with the basket order button.

Upon clicking the button, the user will be able to view the entire list of orders which are associated with the button and can execute all the orders with a single click.

<!--A custom button--!>
<button id="custom-button">Buy 2 stocks</button>

<script>
   
    Fyers.ready(function(){

    var fyers = new Fyers("API_KEY")
    
    //add basket of stocks,you can add upto 10 stocks
        fyers.add({
            
            "symbol": "NSE:RELIANCE-EQ",
            "quantity": 4,
            "order_type": "LIMIT",
            "transaction_type": "BUY",
            "product":"INTRADAY",
            "disclosed_quantity":0,
            "price":200
            
        });
       
        fyers.add({
            
            "symbol": "NSE:SBIN-EQ",
            "quantity": 3,
            "order_type": "LIMIT",
            "transaction_type": "BUY",
            "product":"INTRADAY",
            "disclosed_quantity":0,
            "price":100
            
        });
      
       

        //optional
        fyers.finished(function(status, request_token) {
        alert("Finished. Status is " + status);
    
        })
        // link stocks to this custom button
          fyers.link("#custom-button");
      
    })
 </script>

Order Placement - Custom Buttons →
  • Install Plugin
  • Buy Order
  • Sell Order
  • Basket Order