import datetime
import pandas as pd
import math
import numpy as np
import os
stockticker='birlamoney'
timestamp1=str(int(datetime.datetime(2011,6,16).timestamp()))
timestamp2=str(int(datetime.datetime(2021,6,16).timestamp()))
time_interval="1d"
#time_interval="1wk"
#time_interval="1mo"
stock_events='history'
#stock_events='div'
#stock_events='split'
locator='https://query1.finance.yahoo.com/v7/finance/download/'\
- stockticker +'.NS?period1=' + timestamp1 + '&period2=' + timestamp2 + '&interval=' + time_interval + '&events=' + stock_events
print(locator)
print(timestamp1,timestamp2)
ticker_data= pd.read_csv(locator)
ticker_data.head()
df = pd.DataFrame(ticker_data)
df
df.to_csv(r'C:\Users\Kirti\Desktop\phd_2021\stock_dataset\birla.csv')
price= pd.read_csv(r'C:\Users\Kirti\Desktop\phd_2021\stock_dataset\birla.csv', index_col=0)
price
data_path = 'C:/Users/Kirti/Desktop/phd_2021/stock_dataset'
#close_df=pd.DataFrame()
#for data_path in range(1,10):
for i in os.listdir(data_path):
print('scripts',i)
ind_scripts=i
ind_scripts
multi_stocks = pd.concat(
map(pd.read_csv,['C:/Users/Kirti/Desktop/phd_2021/stock_dataset/WIPRO.csv', 'C:/Users/Kirti/Desktop/phd_2021/stock_dataset/birla.csv','C:/Users/Kirti/Desktop/phd_2021/stock_dataset/INFY.csv']), ignore_index=True)
print(multi_stocks)
wanted to combine all csv files together with their ticker name on the top and want to make seperate csv file s of closing price and volume