Esempio n. 1
0
        // debug Kevin
        //protected void Application_Start()
        protected void Application_Start(object sender, EventArgs e)
        {

            // debug kevin
            String _path = String.Concat(System.Environment.GetEnvironmentVariable("PATH"), ";", System.AppDomain.CurrentDomain.RelativeSearchPath);
            System.Environment.SetEnvironmentVariable("PATH", _path, EnvironmentVariableTarget.Process);

            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            /*
            //List<string> list_equities = new List<String> { "AAPL", "SAN", "0939.HK", "0941.HK", "CSGN.VX", "XOM", "HSBA.L", "1398.HK", "JNJ", "MSFT", "NESN.VX", "NOVN.VX", "PG", "ROG.VX", "SAN.PA", "SIE.DE", "TEF.TI", "FP.PA", "UBSG.VX", "VOD.L" };
            List<string> list_equities = new List<String> { "AAPL" };

            DateTime beginning = new DateTime(2015, 12, 1);
            DateTime end = DateTime.Now;
            string xmlfilePath = "C:/Users/ensimag/Desktop/Everglades/peps/Everglades/bin/YahooDataPeps.xml";
            List<HistoricalColumn> columns = new List<HistoricalColumn>();
            columns.Add(HistoricalColumn.Close);
            columns.Add(HistoricalColumn.High);
            columns.Add(HistoricalColumn.Open);
            columns.Add(HistoricalColumn.Volume);
            columns.Add(HistoricalColumn.Low);
            DataActif donnees = new DataActif(list_equities, columns, beginning, end);
            Environment.CurrentDirectory = "C:/Users/ensimag/Desktop/Everglades/peps/Everglades/bin";
            donnees.ImportData(new ImportYahoo());
            donnees.Export(new ExportXML(xmlfilePath));
            */



            //HomeController.Yahoo_Finance_Parsing();
            Mmodel = new ModelManage();
            Application["Mmodel"] = Mmodel;


        }
Esempio n. 2
0
        public ModelManage()
        {
            //double[,] var0 = HistoricCompute.RiskMetrics.var0();
            //double[,] var = HistoricCompute.RiskMetrics.var(var0, HistoricCompute.RiskMetrics.t0.AddDays(1));
            timers.start("ModelManage initialization");
            timers.start("Database initialization");
            qpcptfaw db = new qpcptfaw();
            //Access.Clear_Everglades_Prices();


            DBInitialisation.DBInit(db);
            HistoricCompute.RiskMetrics.initRiskMetrics(24);
            
            timers.stop("Database initialization");
            /*
            for (int i = 1; i < 50 ; i++ )
            {
                DateTime d = DateTime.Today - TimeSpan.FromDays(i);
                AccessDB.setHedgingPortfolioValue(d, 0);
            }
            */

            //Access.ClearPrice(db, 65);
            //Access.ClearAsset(db, 65);
            //Access.ClearPrice(db, 68);
            //Access.ClearAsset(db, 68);
            //Access.ClearPrices(db);
            //Access.ClearDbConnections(db);
            //Access.ClearAssets(db);
            //Access.Clear_Everglades_Price(new DateTime(2016, 3, 2));
            try
            {
                //Access.Clear_Everglades_Price(new DateTime(2016, 3, 9));
                //Access.Clear_Everglades_Price(new DateTime(2016, 3, 10));
                //Access.Clear_Everglades_Price(new DateTime(2016, 3, 11));
                //Access.Clear_Everglades_Price(new DateTime(2016, 3, 5));
                //Access.Clear_Prices_After(new DateTime(2016, 2, 1), Access.GetIdEverglades());
            }
            catch (Exception)
            {}

            // initialize main variables and lists
            instance = this;
            Assets = new List<IAsset>();
            Assets_Currencies = new List<ICurrency>();
            Dictionary<string, Currencies> curEnum = Access.Get_Equities_Currencies();
            foreach (KeyValuePair<string, Currencies> ent in curEnum)
            {
                Currency cur = new Currency(ent.Value);
                Assets.Add(new Equity(ent.Key, cur));
                if (!Assets_Currencies.Any(x => x.getEnum() == ent.Value) && ent.Value != Currencies.EUR)
                {
                    Assets_Currencies.Add(cur);
                }
            }
            everg = new Everglades(Assets, Assets_Currencies);
            shares_everg = 100000;
            // TODO : change or delete



            //simulateBackTestEvolution(true, DateTime.Today - TimeSpan.FromDays(10), TimeSpan.FromDays(1));


            
            try
            {
                cash = Access.getCashDB(DateTime.Today).value;
                Hedging_Portfolio = getHedgingPortfolioFromBD(DateTime.Today);
            }
            catch (Exception)
            {
                cash = shares_everg * everg.getPrice();
                Hedging_Portfolio = new Portfolio(Assets.Concat(Assets_Currencies.ConvertAll(x => (IAsset)x)).ToList());
            }
            DateTime d_temp = DateTime.Today;
            //Hedging_Portfolio = new Portfolio(Assets.Concat(Assets_Currencies.ConvertAll(x => (IAsset)x)).ToList());
            
            
            Operations_History = new LinkedList<Operation.Operation>();
            derivatives = new List<IDerivative>();
            derivatives.Add(new EuropeanCall());
            derivatives.Add(new EuropeanPut());
            derivatives.Add(new AmericanCall());
            derivatives.Add(new AmericanPut());
            derivatives.Add(new AsianCall());
            derivatives.Add(new AsianPut());
            derivatives.Add(new QuantoCall());
            derivatives.Add(new QuantoPut());
            timers.stop("ModelManage initialization");
        }