Example #1
0
def get_equity_price(symbol):
    scrip_id = symbol.upper()
    n = Nse()
    data = n.get_scrip_data(scrip_id)
    price, lastUpdateTime = n.get_data_for_key(data, 'lastPrice')
    print("Current LTP for {} is {} at time {} ".format(
        scrip_id, price, lastUpdateTime))
Example #2
0
def get_open_price_equity(symbol):
    scrip_id = symbol.upper()
    n = Nse()
    data = n.get_scrip_data(scrip_id)
    price, lastUpdateTime = n.get_data_for_key(data, 'open')
    print("Open Price for {} is {} at time {} ".format(scrip_id, price,
                                                       lastUpdateTime))
Example #3
0
    #     for j in range(i,len(mn)):
    #         x = mn[i][0],mn[j][0]
    #         y = mn[i][1],mn[j][1];
    #         c+=1
    #         print(c)
    #         plt.plot(x,y)

    plt.xlabel("date")
    plt.ylabel("price")
    plt.title(STOCK)
    plt.xticks(x, rotation='vertical')
    # Pad margins so that markers don't get clipped by the axes
    plt.margins(0.2)
    plt.show()
    plt.plot(maxdate, maxY)
    df.plot(x='CH_TIMESTAMP', y='CH_CLOSING_PRICE')


db = Nse()
fno = nse.Nse()
fno_lot = fno.get_fno_lot_sizes(as_json=False)
fno_list = list(fno_lot.keys())

global df, historic_data, x, y, mapping, mn, mx, maxY, minY, mindate, maxdate, closingPrice, STOCK
for stk in fno_list:
    try:
        print("processing ... " + stk)
        getMaxMin(stk, True)
    except:
        print(stk)
Example #4
0
def is_market_open():

    n = Nse()
    market_status = n.get_market_status()
    print("Market is {} currently ".format(market_status))
Example #5
0
def get_day_high_low(symbol):
    scrip_id = symbol.upper()
    n = Nse()
    data = n.get_scrip_data(scrip_id)
    low, high = n.get_day_high_low(data)
    print(" Days Low is {} and Days High is {} ".format(low, high))
Example #6
0

def changeLastRunDate(lastRunDate):
    fh = open("lastRundate.txt", "w")
    fh.write(lastRunDate)
    fh.close()


def getLastRunDate():
    filename = 'lastRundate.txt'
    fh = open(filename, "r")
    return fh.read()


if __name__ == '__main__':
    nse = Nse()
    count = 0
    lastRunDate = getLastRunDate()
    while (count <= 10000):
        time.sleep(20)
        if count == 0:
            nse.download_bhavcopy(lastRunDate)
            print('lastRunDate is', lastRunDate)
        else:
            previousDate = getPreviousDate(lastRunDate)
            nse.download_bhavcopy(previousDate)
            lastRunDate = previousDate
            print('lastRunDate is', lastRunDate)
        count = count + 1
        changeLastRunDate(lastRunDate)