straddlesell_code
straddlesell_code
# import logging
import pyotp
#enable dbug to see request and responses
# logging.basicConfig(level=logging.DEBUG)
#credentials
# Open the file in read mode
with open('C:\\Users\\Kishan\\Desktop\\Python works\\ShoonyaAPI\\credentials.txt',
'r') as f:
lines = f.readlines() # Read the file and process the data
import re
sd = api.searchscrip('NFO', 'NIFTY')
sd = (sd['values'])
for Symbol in sd:
(Symbol['tsym'])
For_token = sym+ExpDate+TYPE+str(Strike)
#df = pd.DataFrame(opc["values"])
#print(df)
#print(df['strprc'])
#print(df['strprc'].dtype)
#df['strprc'] = df['strprc'].astype(float)
CE_SYMBOL = sym+ExpDate+'C'+str(Strike)
PE_SYMBOL = sym+ExpDate+'P'+str(Strike)
print(CE_SYMBOL,PE_SYMBOL)
#print(Strike)
#import csv
TB = api.get_trade_book()
TB
#pd.DataFrame(ret)
#pd.DataFrame(ret).to_csv('output.csv',index=True)
CE_fillprice = float(CE_fillprice)
PE_fillprice = float(PE_fillprice)
SL_CE = float(format(round(CE_fillprice * 0.9 / 0.05) * 0.05,'.2f'))
SL_PE = float(format(round(PE_fillprice * 0.9 / 0.05) * 0.05,'.2f'))
SLT_CE = format(round(SL_CE * 1.03 / 0.05) * 0.05,'.2f')
SLT_PE = format(round(SL_PE * 1.03 / 0.05) * 0.05,'.2f')
print(SL_PE,SLT_PE)
print(SL_CE,SLT_CE )
OB = api.get_order_book()
OB
OB = api.get_order_book()
OB = api.get_order_book()
print(open_orders) # this will print the list of norenorderno values for completed
orders
open_orders_C = open_orders