from breeze_connect import BreezeConnect
from datetime import datetime,date,time,timedelta
import pandas as pd
import numpy as np
import math
from credentials001 import *

breeze = BreezeConnect(api_key=api_key)
breeze.generate_session(api_secret=api_secret, session_token=session_token)

pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
pd.set_option('display.width', None)
pd.set_option('display.max_colwidth', None)


# stock = breeze.get_historical_data(interval="1minute",
#                                        from_date="2022-9-16T07:00:00.000Z",
#                                        to_date="2022-9-16T18:00:00.000Z",
#                                        stock_code="ITC",
#                                        exchange_code="NSE",
#                                        product_type="others")

stock = breeze.get_historical_data(interval="1minute", from_date="2022-9-19T09:00:00.000Z",
                                       to_date="2022-9-19T18:00:00.000Z", stock_code="CNXBAN", exchange_code="NFO",
                                       product_type="options",expiry_date="2022-09-22T18:00:00.000Z",
                                       right="call",strike_price=41200)
# print(stock)
df = pd.DataFrame(stock['Success'])
print(df)
df10 = df.iloc[:12]
# print(df10)
df15 = df.iloc[:17]
# print(df15)
# df13from = df.iloc[13:]
# print(df)
# max = df['high'].max()
# min = df['low'].min()
# print("For 10 mins:",df['high'].max(),df['low'].min(), df['open'][2],df['close'][11])
# print("For 10 mins:", df10['open'][1],df10['high'].max(),df10['low'].min(),df10['close'][11],df['close'].iloc[-1])
# print("For 15 mins:", df15['open'][1],df15['high'].max(),df15['low'].min(),df15['close'][16],df['close'].iloc[-1])
# print("For 15 mins:",df['high'].max(),df['low'].min(), df['open'][2],df['close'][16])

# if df['close'] > df10['high'].max():
#     print("Buy")

for index, row in df[14:].iterrows():
    print(df['close'].iloc[-1])
    # print("Previous close check:", df['close'].iloc[index-1:].max(), df10['high'].max())
    # print(df['close'].iloc[index-1:].max())
    if (df['close'].iloc[index-1:].max() < df10['high'].max()):
        print("Previous close check:",df['close'].iloc[index-1:].max(),df10['high'].max())
        if df['close'].iloc[-1] > df10['high'].max():
            print("Buy",df['close'].iloc[-1],df10['high'].max())
        else:
            break
    else:
        break

# for index, row in df[14:].iterrows():
#         if (df['close'].iloc[index-1] > df10['low'].min()):
#             if df['close'].iloc[-1] < df10['low'].min():
#                 print("Sell")
#             else:
#                 break
#         else:
#             break



# if df['close'].iloc[-1] > df10['high'].max():
#     print("Buy",df[13:])
# if df['close'].iloc[-1] < df10['low'].min():
#     print("Sell",df[13:])

 

 

By AskMahe.com

Hi, AskMahe.com is the Brainchild of Mahendran Paramasivan who is interested in bringing the latest technology to the common people and corporates. We are a team and we are providing supports on Technology and innovation as per industrial standard. We are supporting with the help of analysis we made on Technology and innovation to help corporate companies and individuals. We bring the latest updates of technology and innovation in front of the eyes of our readers, clients, and people. We have resources in Cloud computing, IoT, Edge Computing, Dew Computing, 5G, SAP, Web Designing, UI/ UX Design. Regards AskMahe Team askmahe.com