-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFillWt.py
34 lines (29 loc) · 1.14 KB
/
FillWt.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
import datetime as dt
import time
from dateutil.relativedelta import *
import os, os.path
# import local python
import PortSelect_app.CAPMdata as cd
from PortSelect_app.CAPMdata import FinDB, PortSelectTbl, get_Index_StockList
from PortSelect_app.CAPMapi import getBestWeightingDB
## set up global variables
FillDaysCount = 3
plist = cd.get_portName_List()
print("Request to select best stock weightings for : {}".format(plist))
curpath = os.path.abspath(__file__)
curdir = os.path.abspath(os.path.join(curpath, os.pardir))
pardir = os.path.abspath(os.path.join(curdir, os.pardir))
datapath = os.path.join(pardir, "Data")
print("Data folder is {}".format(datapath))
print("Create DataBase")
mydb = FinDB(curdir)
print("Create Table")
psTbl = PortSelectTbl(mydb)
for pn in plist:
stklist = get_Index_StockList(pn)
dlist = psTbl.getMissingDate(pn, stklist[0])
# print("Hdate={}, pdate={} for {}".format(hdate, pdate, pn))
for i in range(0, FillDaysCount):
print("getBestWeightingDB of {} list on {}".format(pn, dlist[i]))
rlist = getBestWeightingDB(mydb, pn, True, 'EEF.png', False, dlist[i])
psTbl.Add(pn, dlist[i], rlist)