Ejemplo n.º 1
0
    def selectColOrder(self, refresh=False):
        if not refresh:
            self.fund_win = Toplevel()
            self.fund_win.title("Fund Order")

            if not os.access(
                    self.MIS_cache_path + "/reports/product_rep.cache",
                    os.F_OK):
                m = MISCacheUpdater(self.MIS_cache_path)
                as_of_date = date.today()
                m.loadProductData(as_of_date)

            if self.fundman.cache_path != self.MIS_cache_path:
                self.fundman.setCachePath(self.MIS_cache_path)
                self.fundman.loadProductData()
            elif not self.fundman.loaded[1]:
                self.fundman.loadProductData()

        self.fund_win_frame = Frame(self.fund_win)
        self.entity_frame = Frame(self.fund_win_frame, bd=1, relief=RAISED)
        tmp_frame = Frame(self.entity_frame)
        title = Label(tmp_frame, text="Define the Column Order:")
        title.pack()
        tmp_frame.pack()

        self.prods = self.fundman.products
        self.disp_rank_values = {}

        final_prods = []
        for f in self.final_funds:
            final_prods.append(self.prods[f])

        final_prods = sorted(final_prods,
                             key=lambda product: product.disp_rank)

        for var in range(0, len(final_prods)):
            p = final_prods[var]
            tmp_frame = Frame(self.entity_frame)
            self.disp_rank_values[p.backstop_id] = StringVar()
            Label(tmp_frame, text=p.name).pack(side=LEFT)
            tmp_entry = Spinbox(
                tmp_frame,
                textvariable=self.disp_rank_values[p.backstop_id],
                command=self.saveDispRank,
                width=2,
                from_=0,
                to=(len(final_prods) + 1))
            self.disp_rank_values[p.backstop_id].set(var + 1)
            self.fundman.products[p.backstop_id].disp_rank = var + 1
            tmp_entry.pack(side=RIGHT)
            tmp_frame.pack(fill=X)

        self.entity_frame.pack(fill=X)
        Button(self.fund_win_frame,
               text="OK",
               command=self.setDispRank,
               width=10).pack(side=BOTTOM)
        self.fund_win_frame.pack(fill=BOTH, expand=1)

        self.resizeWindow(300, len(final_prods) * 22 + 50, self.fund_win)
Ejemplo n.º 2
0
 def createArchivedMISCache(self, as_of_date):
     path = self.mis_cache_path + "archived/" + as_of_date.strftime(
         "%Y-%m-%d") + "/"
     if not os.access(path, os.F_OK):
         os.makedirs(path)
     m_updater = MISCacheUpdater(path)
     m_updater.update(as_of_date)
Ejemplo n.º 3
0
 def updateMISCache(self):
     as_of_date = self.most_recent_valid_month
            
     tmp_path = self.mis_cache_path + "tmp"
     cur_path = self.mis_cache_path + "current"
     arch_path = self.mis_cache_path + "archived/" + as_of_date.strftime("%Y-%m-%d")
     
     if os.access(tmp_path,os.F_OK):
         shutil.rmtree(tmp_path)
     os.makedirs(tmp_path)
        
     tmp = MISCacheUpdater(tmp_path)
     tmp.update(as_of_date)
     
     if os.access(cur_path,os.F_OK):
         shutil.rmtree(cur_path)
     os.makedirs(cur_path) 
     
     if os.access(arch_path,os.F_OK):
         shutil.rmtree(arch_path)
     os.makedirs(arch_path)   
             
     cur = MISCacheUpdater(cur_path)
     cur.syncCache(tmp_path)
     
     cur = MISCacheUpdater(arch_path)
     cur.syncCache(tmp_path)
                     
     if os.access(tmp_path,os.F_OK):
         shutil.rmtree(tmp_path)
Ejemplo n.º 4
0
 def selectColOrder(self,refresh=False):
     if not refresh:
         self.fund_win = Toplevel()
         self.fund_win.title("Fund Order")
     
         if not os.access(self.MIS_cache_path + "/reports/product_rep.cache",os.F_OK):
             m = MISCacheUpdater(self.MIS_cache_path)
             as_of_date = date.today()
             m.loadProductData(as_of_date)
     
         if self.fundman.cache_path != self.MIS_cache_path:
             self.fundman.setCachePath(self.MIS_cache_path)
             self.fundman.loadProductData()
         elif not self.fundman.loaded[1]:
             self.fundman.loadProductData()
     
     self.fund_win_frame = Frame(self.fund_win)        
     self.entity_frame = Frame(self.fund_win_frame,bd=1,relief=RAISED)
     tmp_frame = Frame(self.entity_frame)
     title = Label(tmp_frame,text="Define the Column Order:")
     title.pack()
     tmp_frame.pack()             
             
     self.prods = self.fundman.products
     self.disp_rank_values = {}
     
     final_prods = []
     for f in self.final_funds:
         final_prods.append(self.prods[f])
     
     final_prods = sorted(final_prods,key=lambda product: product.disp_rank)
     
     for var in range(0,len(final_prods)):
         p = final_prods[var]
         tmp_frame = Frame(self.entity_frame)
         self.disp_rank_values[p.backstop_id] = StringVar()
         Label(tmp_frame,text=p.name).pack(side=LEFT)
         tmp_entry = Spinbox(tmp_frame,textvariable=self.disp_rank_values[p.backstop_id],command=self.saveDispRank,width=2,from_=0, to=(len(final_prods)+1))
         self.disp_rank_values[p.backstop_id].set(var+1)
         self.fundman.products[p.backstop_id].disp_rank = var+1
         tmp_entry.pack(side=RIGHT)
         tmp_frame.pack(fill=X)
     
     self.entity_frame.pack(fill=X)
     Button(self.fund_win_frame, text="OK", command=self.setDispRank, width=10).pack(side=BOTTOM)
     self.fund_win_frame.pack(fill=BOTH,expand=1)
     
     self.resizeWindow(300, len(final_prods)*22 + 50, self.fund_win)
Ejemplo n.º 5
0
    def selectFinalFunds(self):
        self.fund_win = Toplevel()
        self.fund_win.title("Final Funds")

        self.entity_frame = Frame(self.fund_win, bd=1, relief=RAISED)
        tmp_frame = Frame(self.entity_frame)

        title = Label(tmp_frame, text="Specify the \"Final Funds\":")
        title.pack()
        tmp_frame.pack()

        if not os.access(self.MIS_cache_path + "/reports/product_rep.cache",
                         os.F_OK):
            m = MISCacheUpdater(self.MIS_cache_path)
            as_of_date = datetime.strptime(self.as_of_date_entry.get(),
                                           "%m/%d/%Y")
            m.loadProductData(as_of_date)

        if self.fundman.cache_path != self.MIS_cache_path:
            self.fundman.setCachePath(self.MIS_cache_path)
            self.fundman.loadProductData()
        elif not self.fundman.loaded[1]:
            self.fundman.loadProductData()

        self.prods = self.fundman.products
        self.checkbox_values = {}

        for p_id in sorted(self.prods.keys()):
            p = self.prods[p_id]
            tmp_frame = Frame(self.entity_frame)
            self.checkbox_values[p_id] = IntVar()
            tmp_checkbox = Checkbutton(tmp_frame,
                                       text=p.name,
                                       variable=self.checkbox_values[p_id])
            if p_id in [
                    370761, 370775, 762605, 762635, 370751, 370753, 370755,
                    370745, 370759
            ]:
                tmp_checkbox.select()
            tmp_checkbox.pack(side=LEFT)
            tmp_frame.pack(fill=X)

        self.entity_frame.pack(fill=X)
        Button(self.fund_win, text="OK", command=self.saveFinalFunds,
               width=10).pack(side=BOTTOM)

        self.resizeWindow(300, len(self.prods.keys()) * 22 + 50, self.fund_win)
Ejemplo n.º 6
0
    def selectPassThroughFunds(self):
        self.fund_win = Toplevel()
        self.fund_win.title("Pass-Through Funds")

        self.entity_frame = Frame(self.fund_win, bd=1, relief=RAISED)
        tmp_frame = Frame(self.entity_frame)

        title = Label(tmp_frame, text="Verify the \"Pass-Through Funds\":")
        title.pack()
        tmp_frame.pack()

        if not os.access(self.MIS_cache_path + "/reports/product_rep.cache",
                         os.F_OK):
            m = MISCacheUpdater(self.MIS_cache_path)
            as_of_date = date.today()
            m.loadProductData(as_of_date)

        if self.fundman.cache_path != self.MIS_cache_path:
            self.fundman.setCachePath(self.MIS_cache_path)
            self.fundman.loadProductData()
        elif not self.fundman.loaded[1]:
            self.fundman.loadProductData()

        self.prods = self.fundman.products
        self.checkbox_values = {}

        for p_id in sorted(self.prods.keys()):
            p = self.prods[p_id]
            tmp_frame = Frame(self.entity_frame)
            self.checkbox_values[p_id] = IntVar()
            tmp_checkbox = Checkbutton(tmp_frame,
                                       text=p.name,
                                       variable=self.checkbox_values[p_id])
            if p_id in self.pass_through_funds:
                tmp_checkbox.select()
            tmp_checkbox.pack(side=LEFT)
            tmp_frame.pack(fill=X)

        self.entity_frame.pack(fill=X)
        Button(self.fund_win,
               text="OK",
               command=self.savePassThroughFunds,
               width=10).pack(side=BOTTOM)

        self.resizeWindow(300, len(self.prods.keys()) * 22 + 50, self.fund_win)
Ejemplo n.º 7
0
 def selectPassThroughFunds(self):
     self.fund_win = Toplevel()
     self.fund_win.title("Pass-Through Funds")
     
     self.entity_frame = Frame(self.fund_win,bd=1,relief=RAISED)
     tmp_frame = Frame(self.entity_frame)
     
     title = Label(tmp_frame,text="Verify the \"Pass-Through Funds\":")
     title.pack()
     tmp_frame.pack()
     
     if not os.access(self.MIS_cache_path + "/reports/product_rep.cache",os.F_OK):
         m = MISCacheUpdater(self.MIS_cache_path)
         as_of_date = date.today()
         m.loadProductData(as_of_date)
     
     if self.fundman.cache_path != self.MIS_cache_path:
         self.fundman.setCachePath(self.MIS_cache_path)
         self.fundman.loadProductData()
     elif not self.fundman.loaded[1]:
         self.fundman.loadProductData() 
             
     self.prods = self.fundman.products
     self.checkbox_values = {}
     
     for p_id in sorted(self.prods.keys()):
         p = self.prods[p_id]
         tmp_frame = Frame(self.entity_frame)
         self.checkbox_values[p_id] = IntVar()
         tmp_checkbox = Checkbutton(tmp_frame,text = p.name,variable=self.checkbox_values[p_id])
         if p_id in self.pass_through_funds:
             tmp_checkbox.select()
         tmp_checkbox.pack(side=LEFT)
         tmp_frame.pack(fill=X)
     
     self.entity_frame.pack(fill=X)
     Button(self.fund_win, text="OK", command=self.savePassThroughFunds, width=10).pack(side=BOTTOM)
     
     self.resizeWindow(300, len(self.prods.keys())*22 + 50, self.fund_win)
Ejemplo n.º 8
0
 def selectFinalFunds(self):
     self.fund_win = Toplevel()
     self.fund_win.title("Final Funds")
     
     self.entity_frame = Frame(self.fund_win,bd=1,relief=RAISED)
     tmp_frame = Frame(self.entity_frame)
     
     title = Label(tmp_frame,text="Specify the \"Final Funds\":")
     title.pack()
     tmp_frame.pack()
     
     if not os.access(self.MIS_cache_path + "/reports/product_rep.cache",os.F_OK):
         m = MISCacheUpdater(self.MIS_cache_path)
         as_of_date = datetime.strptime(self.as_of_date_entry.get(),"%m/%d/%Y")
         m.loadProductData(as_of_date)
     
     if self.fundman.cache_path != self.MIS_cache_path:
         self.fundman.setCachePath(self.MIS_cache_path)
         self.fundman.loadProductData()
     elif not self.fundman.loaded[1]:
         self.fundman.loadProductData() 
             
     self.prods = self.fundman.products
     self.checkbox_values = {}
     
     for p_id in sorted(self.prods.keys()):
         p = self.prods[p_id]
         tmp_frame = Frame(self.entity_frame)
         self.checkbox_values[p_id] = IntVar()
         tmp_checkbox = Checkbutton(tmp_frame,text = p.name,variable=self.checkbox_values[p_id])
         if p_id in [370761,370775,762605,762635,370751,370753,370755,370745,370759]:
             tmp_checkbox.select()
         tmp_checkbox.pack(side=LEFT)
         tmp_frame.pack(fill=X)
     
     self.entity_frame.pack(fill=X)
     Button(self.fund_win, text="OK", command=self.saveFinalFunds,width=10).pack(side=BOTTOM)
     
     self.resizeWindow(300, len(self.prods.keys())*22 + 50, self.fund_win)
Ejemplo n.º 9
0
    def downloadCache(self, as_of_date):
        self.pg.cur_sub_proc_total = 7.27

        m = MISCacheUpdater(self.MIS_cache_path, self.pg)
        self.downloadThread = FundManagerCacheDownloadThread(m, as_of_date)
        self.downloadThread.start()

        for var in range(1, 12):
            while self.downloadThread.status == var and not self.early_terminate:
                self.root.update()
                try:
                    self.pg.redisplay()
                except SystemExit:
                    self.downloadThread.terminate()
                    self.early_terminate = True
                time.sleep(.1)
        if self.early_terminate:
            del self.downloadThread
            del m
Ejemplo n.º 10
0
    def updateMISCache(self):
        as_of_date = self.most_recent_valid_month

        tmp_path = self.mis_cache_path + "tmp"
        cur_path = self.mis_cache_path + "current"
        arch_path = self.mis_cache_path + "archived/" + as_of_date.strftime(
            "%Y-%m-%d")

        if os.access(tmp_path, os.F_OK):
            shutil.rmtree(tmp_path)
        os.makedirs(tmp_path)

        tmp = MISCacheUpdater(tmp_path)
        tmp.update(as_of_date)

        if os.access(cur_path, os.F_OK):
            shutil.rmtree(cur_path)
        os.makedirs(cur_path)

        if os.access(arch_path, os.F_OK):
            shutil.rmtree(arch_path)
        os.makedirs(arch_path)

        cur = MISCacheUpdater(cur_path)
        cur.syncCache(tmp_path)

        cur = MISCacheUpdater(arch_path)
        cur.syncCache(tmp_path)

        if os.access(tmp_path, os.F_OK):
            shutil.rmtree(tmp_path)
Ejemplo n.º 11
0
 def repairArchivedMISCache(self, as_of_date):
     path = self.mis_cache_path + "archived/" + as_of_date.strftime(
         "%Y-%m-%d") + "/"
     f = FundManager(path)
     while True:
         error = f.checkCache()
         if not error[0]:
             m_updater = MISCacheUpdater(path)
             for e in error[1]:
                 print e[0], "--- missing", e[1]
                 if e[1] == "product_rep":
                     m_updater.loadProductData(as_of_date)
                 elif e[1] == "fund_rep":
                     m_updater.loadFundData(as_of_date)
                 elif e[1] == "meeting":
                     m_updater.loadMeetingsData(as_of_date, e[0])
                 elif e[1] == "exposure":
                     m_updater.loadExposureData(as_of_date, e[0])
                 elif e[1] == "aum":
                     m_updater.loadAumData(as_of_date, e[0])
                 elif e[1] == "return":
                     m_updater.loadReturnsData(as_of_date, e[0])
                 elif e[1] == "stats":
                     m_updater.loadStatisticsData(as_of_date, e[0])
                 elif e[1] == "transactions":
                     m_updater.loadInternalTransactionData(as_of_date, e[0])
                 elif e[1] == "holding":
                     m_updater.loadHoldingsData(as_of_date, e[0])
                 elif e[1] == "trans_rep":
                     m_updater.loadTransactionData(as_of_date)
                 elif e[1] == "people_org_rep":
                     m_updater.loadContactsData(as_of_date)
         else:
             break
Ejemplo n.º 12
0
 def createArchivedMISCache(self,as_of_date):
     path = self.mis_cache_path + "archived/" + as_of_date.strftime("%Y-%m-%d") + "/"
     if not os.access(path,os.F_OK):
         os.makedirs(path)
     m_updater = MISCacheUpdater(path)
     m_updater.update(as_of_date)
Ejemplo n.º 13
0
 def repairArchivedMISCache(self,as_of_date):
     path = self.mis_cache_path + "archived/" + as_of_date.strftime("%Y-%m-%d") + "/"
     f = FundManager(path)
     while True:
         error = f.checkCache()
         if not error[0]:
             m_updater = MISCacheUpdater(path)
             for e in error[1]:
                 print e[0], "--- missing", e[1]
                 if e[1] == "product_rep":
                     m_updater.loadProductData(as_of_date)
                 elif e[1] == "fund_rep":
                     m_updater.loadFundData(as_of_date)  
                 elif e[1] == "meeting":
                     m_updater.loadMeetingsData(as_of_date,e[0])
                 elif e[1] == "exposure":
                     m_updater.loadExposureData(as_of_date,e[0])
                 elif e[1] == "aum":
                     m_updater.loadAumData(as_of_date,e[0])
                 elif e[1] == "return":
                     m_updater.loadReturnsData(as_of_date,e[0])
                 elif e[1] == "stats":
                     m_updater.loadStatisticsData(as_of_date,e[0])
                 elif e[1] == "transactions":
                     m_updater.loadInternalTransactionData(as_of_date,e[0])
                 elif e[1] == "holding":
                     m_updater.loadHoldingsData(as_of_date,e[0])
                 elif e[1] == "trans_rep":
                     m_updater.loadTransactionData(as_of_date)
                 elif e[1] == "people_org_rep":
                     m_updater.loadContactsData(as_of_date)
         else:
             break