ICICI Breeze : Simple Moving Average (Education Purpose Only)

def smatest():
    from breeze_connect import BreezeConnect
    from datetime import datetime,date,time,timedelta
    import pandas as pd
    import numpy as np

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

    # bnhistory = breeze.get_historical_data(interval="1minute", from_date="2022-08-08T07:00:00.000Z",
    #                                        to_date="2022-08-08T18:00:00.000Z", stock_code="CNXBAN", exchange_code="NFO",
    #                                        product_type="options",expiry_date="2022-08-11T18:00:00.000Z",
    #                                        right="call",strike_price=38600)
    bnhistory = breeze.get_historical_data(interval="1minute",from_date="2022-8-1T07:00:00.000Z",to_date="2022-8-8T18:00:00.000Z",stock_code="TCS",
    #                            ,
    #                            expiry_date="2021-11-25T07:00:00.000Z",
    #                            right="others",
    #                            strike_price="0")

    sma = pd.DataFrame(bnhistory['Success'])
    # print(sma)
    sma['sma_20'] = sma['close'].rolling(10).mean()
    low = sma['low'].iloc[-1]
    lowp = sma['low'].iloc[-2]
    high = sma['high'].iloc[-1]
    highp = sma['high'].iloc[-2]
    sma20 = sma['sma_20'].iloc[-1]
    sma20p = sma['sma_20'].iloc[-2]
    # print(sma20,sma20p,low,lowp,high,highp)

    if sma20 < pd.to_numeric(low) and sma20p > pd.to_numeric(lowp):
    if sma20 > pd.to_numeric(high) and sma20p < pd.to_numeric(highp):

    # Author  : Mahendran Paramasivan


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