Exemple #1
0
        public SessionData(
			int idSession,
			bool bIsPreTaxOnlyOperation,
			AtCalculationSession acs,
			List<PpaCalendar> calendarEntries,
			IFeedback hLogger)
        {
            m_idSession = idSession;
            m_gcFeedback = hLogger;

            Utility.clearCalendarData();
            m_pCalendar = Utility.m_calendar_data;

            FillCalendar(calendarEntries);

            m_pCalc = new CalcData();

            m_pCalc.m_bPreTaxCalculationsOnly = bIsPreTaxOnlyOperation;
            m_pCalc.m_calculation_id = idSession;
            m_pCalc.m_calc_from_date = acs.AtCalcYearmonthStart;
            m_pCalc.m_calc_to_date = acs.AtCalcYearmonthEnd;
            m_pCalc.m_bDataFilled = FillData(acs);

            Debug.IndentSize = 4;
            Debug.AutoFlush = true;

            g_hSessionData = this;
        }
Exemple #2
0
        public bool CalculatePerformance(AtCalculationSession acsOutput)
        {
            if (!Calculator.CalculatePerformance(this, m_pCalc, m_gcFeedback)) return false;

            // save calculation results to AtCalculationSession collections (m_acsOutput).
            // DB saving is done outside the calculation engine.
            // See DBAccess::ForwardResults()/sp_AT_SaveATReturnsData for next step: moving from AT_RETURNS to AT_RETURNS_YEARMONTH
            SaveCalculationResults(acsOutput);
            return true;
        }
Exemple #3
0
 public int SaveSimulatedBenchPerformance(AtCalculationSession acsOutput)
 {
     return 0;
 }
Exemple #4
0
 public int SaveReturnsData(AtCalculationSession acsOutput)
 {
     return 0;
 }
Exemple #5
0
 public int SaveClientSimulatedBench(AtCalculationSession acsOutput)
 {
     return 0;
 }
Exemple #6
0
        public void SaveCalculationResults(AtCalculationSession acsOutput)
        {
            int i;
            // save to AtSimulatedBenchPerformance
            i = SaveSimulatedBenchPerformance(acsOutput);
            DETAIL_LOG(string.Format("Saved {0} rows to SimulatedBenchPerformance", i));

            // save to AtClientSimulatedBench
            i = SaveClientSimulatedBench(acsOutput);
            DETAIL_LOG(string.Format("Saved {0} rows to ClientSimulatedBench", i));

            // save to AtReturns
            i = SaveReturnsData(acsOutput);
            DETAIL_LOG(string.Format("Saved {0} rows to ReturnsData", i));
        }
Exemple #7
0
        public bool FillData(AtCalculationSession acs)
        {
            m_pCalc.m_bDataFilled = false;
            const int cSteps = 17;
            int iStep = 1;

            try
            {

                InitFixedIncomeModelList(acs.AtFiModelProxyCollection);

                UpdateTableReadProgress("Fixed Income Models", iStep++, cSteps, (iStep*100)/cSteps);
                InitFixedIncomeModelList(acs.AtFiModelProxyCollection);

                UpdateTableReadProgress("Fixed Income Model Proxies", iStep++, cSteps, (iStep*100)/cSteps);
                InitFixedIncomeProxies(acs.AtFiModelProxyCollection);

                UpdateTableReadProgress("Client Information", iStep++, cSteps, (iStep*100)/cSteps);
                FillClientGenericData(acs.AtClientGenericCollection);
                acs.AtClientGenericCollection.Clear();

                UpdateTableReadProgress("Fixed Income Account Information", iStep++, cSteps, (iStep*100)/cSteps);
                FillTagTypes(acs.AtFiAccountCollection);
                acs.AtFiAccountCollection.Clear();

                UpdateTableReadProgress("Daily Bench Returns", iStep++, cSteps, (iStep*100)/cSteps);
                FillBenchDailyReturns(acs.AtBenchDailyReturnsCollection);
                acs.AtBenchDailyReturnsCollection.Clear();

                UpdateTableReadProgress("Monthly Bench Returns", iStep++, cSteps, (iStep*100)/cSteps);
                FillBenchMonthlyReturns(acs.AtBenchMonthlyReturnsCollection);
                acs.AtBenchMonthlyReturnsCollection.Clear();

                UpdateTableReadProgress("Model Daily Returns", iStep++, cSteps, (iStep*100)/cSteps);
                FillModelDailyReturns(acs.AtModelDailyReturnsCollection);
                acs.AtModelDailyReturnsCollection.Clear();

                UpdateTableReadProgress("Model Monthly Returns", iStep++, cSteps, (iStep*100)/cSteps);
                FillModelMonthlyReturns(acs.AtModelMonthlyReturnsCollection);
                acs.AtModelMonthlyReturnsCollection.Clear();

                UpdateTableReadProgress("Client Model Weights", iStep++, cSteps, (iStep*100)/cSteps);
                FillClientModelWeights(acs.AtClientModelWeightsCollection);
                acs.AtClientModelWeightsCollection.Clear();

                UpdateTableReadProgress("Cash Rebalancing Dates", iStep++, cSteps, (iStep*100)/cSteps);
                FillICFRFlags(acs.AtIcfrCollection);
                acs.AtIcfrCollection.Clear();

                UpdateTableReadProgress("Client Bench Allocations", iStep++, cSteps, (iStep*100)/cSteps);
                FillClientBenchData(acs.AtClientBenchAllocationCollection);
                acs.AtClientBenchAllocationCollection.Clear();

                UpdateTableReadProgress("Client Simulated Bench Returns", iStep++, cSteps, (iStep*100)/cSteps);
                FillSimulatedBenchData(acs.AtClientSimulatedBenchCollection);
                acs.AtClientSimulatedBenchCollection.Clear();

                UpdateTableReadProgress("Client Asset Flows", iStep++, cSteps, (iStep*100)/cSteps);
                FillClientAssetFlows(acs.AtClientAssetFlowsCollection);
                acs.AtClientAssetFlowsCollection.Clear();

                UpdateTableReadProgress("Client Monthly Returns", iStep++, cSteps, (iStep*100)/cSteps);
                FillClientMonthlyReturns(acs.AtClientMonthlyReturnsCollection);
                acs.AtClientMonthlyReturnsCollection.Clear();

                UpdateTableReadProgress("Client Tax Rates", iStep++, cSteps, (iStep*100)/cSteps);
                FillClientTaxRates(acs.AtClientTaxratesCollection);

                m_pCalc.setInitialMonthFlag();

                UpdateTableReadProgress("Client Sleeve Performance Data for Fixed Income", iStep++, cSteps, (iStep*100)/cSteps);
                AddFixedIncomeClientMonthlySleeveData(acs.AtSleeveClientMonthlyReturnsCollection);
                acs.AtSleeveClientMonthlyReturnsCollection.Clear();

                UpdateTableReadProgress("Client Sleeve Asset Flow Data for Fixed Income", iStep++, cSteps, (iStep*100)/cSteps);
                AddFixedIncomeClientSleeveAssetFlowData(acs.AtSleeveClientAssetFlowsCollection);
                acs.AtSleeveClientAssetFlowsCollection.Clear();

                FixUpNonFixedIncomeRlzdGL();

                // add non-fixed-income-account asset flows to all-asset-flows-list
                FixUpNonFixedIncomeAssetFlows();

                m_gcFeedback.LogProgress(
                    m_idSession,
                    LogType.LOG_TYPE_DATA_LOAD,
                    LogSeverity.LOG_SEVERITY_STATUS,
                    "Complete",
                    string.Empty,
                    string.Empty,
                    true);

                m_pCalc.m_bDataFilled = true;
            }
            catch (Exception e)
            {
                var str = string.Format("Error occurred while loading in 'SessionData::FillData': {0}", e);
                m_gcFeedback.LogProgress(
                    m_idSession,
                    LogType.LOG_TYPE_DATA_LOAD,
                    LogSeverity.LOG_SEVERITY_ERROR,
                    str, string.Empty, string.Empty, false);
                m_pCalc.m_bDataFilled = false;
                throw;
            }

            m_pCalc.m_client_data = m_pCalc.m_client_data
                                                .Where(clients => clients.Value.m_bIsValid)
                                                .ToDictionary(clients => clients.Key, clients => clients.Value);

            return m_pCalc.m_bDataFilled;
        }