예제 #1
0
 def setPositionDict(self, fromDate, toDate, setLastMarketData):
     from engine.engine import Engine
     today = datetime.now().date()
     self.startPositionDict = Engine.buildPositions(date(1900, 1, 1), fromDate, False)
     if len(self.startPositionDict) == 0:
         logging.warning("Empty start position dict")
     self.finalPositionDict = Engine.buildPositions(date(1900, 1, 1), toDate, setLastMarketData)
     if len(self.finalPositionDict) == 0:
         logging.warning("Empty final position dict")
예제 #2
0
 def refreshAll(self, fromDate, toDate):
     progressBar = QtGui.QProgressDialog("Progress", "Stop", 0, 10)
     progressBar.setLabelText("BUILD POSITION")
     progressBar.setValue(1)
     progressBar.setWindowModality(QtCore.Qt.WindowModal)
     progressBar.setMinimumDuration(0)
     mainCache = Singleton(MainCache)
     mainCache.refreshReferenceData()
     self.mainWindow = MainWindow()
     self.mainWindow.clearTable()
     resultPositionDict = Engine.buildPositions(fromDate, toDate, True)
     mainCache.positionDict = resultPositionDict[
         Constant.CONST_POSITION_DICT]
     mainCache.oldPositionDict = resultPositionDict[
         Constant.CONST_OLD_POSITION_DICT]
     mainCache.setGlobalAttribute(
         resultPositionDict[Constant.CONST_POSITION_DICT])
     mainCache.corporateEventPositionDictAsset = resultPositionDict[
         Constant.CONST_CORPORATE_POSITION_DICT]
     progressBar.setLabelText("EQUITY")
     progressBar.setValue(3)
     self.mainWindow.renderPositions(mainCache.positionDict, 'EQUITY', 0)
     progressBar.setLabelText("EQUITY-SIC")
     progressBar.setValue(6)
     self.mainWindow.renderPositions(mainCache.positionDict, 'EQUITY', 1)
     progressBar.setLabelText("FUND")
     progressBar.setValue(7)
     self.mainWindow.renderPositions(mainCache.positionDict, 'FUND', 0)
     progressBar.setLabelText("BOND")
     progressBar.setValue(8)
     self.mainWindow.renderPositions(mainCache.positionDict, 'BOND', 0)
     progressBar.setValue(9)
     self.mainWindow.renderSubtotal(mainCache.positionDict, 'ALL', 0)
     progressBar.setLabelText("CORPORATE EVENT")
     progressBar.setValue(10)
     self.mainWindow.renderCorpEvent(
         mainCache.corporateEventPositionDictAsset)
     #======================================================================
     mainCache.summaryDict = Engine.buildSummaryByCustody(
         mainCache.positionDict, mainCache.oldPositionDict)
     self.mainWindow.renderSummary(mainCache.summaryDict)
     self.mainWindow.renderGeneralInfoPanel(mainCache.usdMXN)