-
Notifications
You must be signed in to change notification settings - Fork 1
/
ShortVolumePharser.py
43 lines (26 loc) · 1.1 KB
/
ShortVolumePharser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import os,shutil
from distutils.util import strtobool
import StockDataReader as SDR
if __name__ == "__main__":
ticker,inputFolder,outputFolder,override = SDR.GetConfigurationSettings("configShortVolume.txt")
outputFolder = SDR.MakeNewDirectory(outputFolder,override)
if(os.path.isdir(inputFolder)):
os.chdir(inputFolder)
else:
raise FileNotFoundError("InputFolder for data " + inputFolder + " not found! Can't continue!")
MonthFolderList = os.listdir() # get all the folders in the data folder
#Get all the Short volume data for each month
fileHeader = ""
TotalTickerLines = []
for folder in MonthFolderList:
if(os.path.isdir(folder)):
os.chdir(folder)
else:
continue
fileList = os.listdir()
fileHeader, tickerLines = SDR.ReadFilesForTicker(ticker,1,fileList)
TotalTickerLines.extend(tickerLines)
os.chdir('../')
os.chdir('../') #back to root folder
SDR.Output(outputFolder,fileHeader,TotalTickerLines)
print('\n' + "Finished for ticker " + ticker + '\n')