Algo Trading. How to place stop loss on NIFTY? Fyers , Python

Placing stop loss 

lossType=risk.get()

if(lossType==1):

            if(checkBank()):

                exitOrder()

                break

        elif(lossType==2):

            if((ltp-float(avgPrice.get()))<(-int(spin2.get()))):

                exitOrder()

                break

def checkBank():

    data = {"symbols":"NSE:NIFTY50-INDEX"}

    out=fyers.quotes(data)

    ltp=out["d"][0]["v"]["lp"]

    if((strikeName.get().endswith("CE"))and(ltp<=int(spin1.get()))):

        return 1

    elif((strikeName.get().endswith("PE"))and(ltp>=int(spin1.get()))):

        return 1 




Comments

Popular posts from this blog

Create Option Chain using PYTHON.

How to Place Order in Zerodha using Python

How to place order in zerodha when RSI crosses below 30? Algo Trading Python