Integrate your app with Upstox using TradeButton in Python Flask

Upstox offers tradebutton with the help of that we can customize our trades which will be in html+javascript it is entirely a semi automated tools which we even can use to place basket orders.

To avail this offer you should have an upstox account for that you can follow this url link to have an account in this you can have some great offers which you can avail in our case for algorithmic trading we can make use of 14 days free api and after that 1500/- rs per month low cost api compared to other brokers.

Let us move to working part of this trade button in this all you have to do is install flask and give a name as and follow the code below:

from flask import Flask,render_template


def market():
    return render_template('tradeupstox.html')
if __name__=='__main__':

So from the above we can see that a render template is there which says tradeupstox.html for that you need to create an folder as templates and save this html+javascript in that folder as follows:

<upstox-tradebutton trade button-name=one></upstox-tradebutton>
     <script type="text/javascript">
         var upstoxTradesConfig = {
             "button-name": {
                 "one": [{
                     "token": 2885,
                     "symbol": "RELIANCE",
                     "exchange": "NSE",
                     "series": "EQ",
                     "quantity": 1,
                     "side": "buy",
                     "complexity": "simple",
                     "orderType": "m",
                     "position": "i",
                     "tif": "day",
     <script type="text/javascript" src=""></script>

After paste of this code just run your python file and paste url in browser tab which will be a localhost:5000/m and click on the trade button after that if you want to place the order just click on place button and it will automatically place the order upstox platform to check that you can visit for more and proper instructions you can follow the above video.