Ejemplo n.º 1
0
def addDailyData():
    print("Job Started ")
    rows = readConfigurations('config/inputConfig.csv')
    for row in rows:
        exchangeId, stockName, timeDelay, days, companyName = row[0:5]
        q = GoogleFinanceQuote(exchangeId, stockName, 0, 0)
        q.write_csv('dataset/{0}.csv'.format(exchangeId + '_' + companyName),
                    'a')
Ejemplo n.º 2
0
from nsepy import get_history
from InputConfig import readConfigurations
from datetime import date, timedelta


def downloadNseData(rows):
    print("Start Fetching data from NSE...")
    for row in rows:
        try:
            exchangeId, stockName, timeDelay, days, companyName = row[0:5]
            if (exchangeId == 'NSE'):
                endDate = date.today() - timedelta(days=1)
                startDate = endDate - timedelta(days=int(days))
                dataframe = get_history(symbol=stockName,
                                        start=startDate,
                                        end=endDate)
                dataframe.drop('Symbol', axis=1, inplace=True)
                dataframe.drop('Series', axis=1, inplace=True)
                dataframe.to_csv('dataset/{0}.csv'.format(exchangeId + '_' +
                                                          companyName),
                                 sep=',',
                                 encoding='utf-8')
        except:
            print("Error while downloding data")


# main executor
if __name__ == '__main__':
    rows = readConfigurations('config/inputConfig.csv')
    downloadNseData(rows)
    print("Process Completed...")