Esempio n. 1
0
        /// <summary>
        /// Main program entry.
        /// </summary>
        public static void Main(string[] args)
        {
            s_options = new TrackerOptions(new DateTime(2011, 8, 8));
            s_engine = new TeamFoundationEngine("http://rufrt-vxbuild:8080/tfs/sandbox");

            // TODO: fake uploading for garbage parts
            // FakeUploader.UploadFakeFile(1);
            // return;

            DateTime start = DateTime.Now;
            Console.WriteLine("Started at {0:G}.", start);

            List<ISourceFile> files = s_engine.GetFiles(s_options);
            foreach (ISourceFile file in files)
            {
                Console.WriteLine("[{0:HH:mm:ss}] {1}", DateTime.Now, file.FullPath);
                ProcessFile(file);
            }

            DateTime end = DateTime.Now;
            Console.WriteLine("Finished at {0:G}.", end);

            TimeSpan delta = end.Subtract(start);
            int seconds = Convert.ToInt32(delta.TotalSeconds);
            delta = TimeSpan.FromSeconds(seconds);
            Console.WriteLine("Done in {0}.", delta);
            Console.ReadKey();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            BasicConfigurator.Configure();
            SetConsoleCtrlHandler(new HandlerRoutine(ConsoleCtrlCheck), true);
            log.Info("Application Started");
            _priceEngine = new PriceEngine(new SecurityPriceRetrieverStrategy(new YahooMarketDataPriceSource()));
            string apiKey = ConfigurationManager.AppSettings["EdgarApiKey"];

            _statementEngine = new StatementEngine(new StatementRetrieverStrategy(new EdgarMarketDataFinancialStatementSource(apiKey)));
            _ncavEngine      = new NcavEngine();
            log.Info("Starting to retrieve prices");
            while (_priceEngine.ShouldWork)
            {
                _priceEngine.DoCycle();
            }
            log.Info("Prices retrieved.");
            log.Info("Starting to retrieve financial statements");
            while (_statementEngine.ShouldWork)
            {
                _statementEngine.DoCycle();
            }
            log.Info("Financial statements retrieved.");
            log.Info("Starting to Update Ncav and discounts on Ncav");
            while (_ncavEngine.ShouldWork)
            {
                _ncavEngine.DoCycle();
            }
            log.Info("Calculus on Net current asset value done.");
            //log.Info("Exiting Application.");
            using (var unitOfWork = new UnitOfWork(new MidasContext()))
            {
                var securitiesToInvest =
                    SecurityDalFactory.GetInstance()
                    .GetSecurityDal()
                    .GetAllSecurities()
                    .Where(x => x.DiscountOnNcav > (Decimal)0.25)
                    .Where(x => !BlackList.IsBlackListed(x.Ticker))
                    .OrderBy(x => x.DiscountOnNcav).Reverse()
                    .ToList();
                foreach (var security in securitiesToInvest)
                {
                    log.Info(string.Format("Found security {0} with discount on Ncav : {1}", security.Ticker, security.DiscountOnNcav));
                }
                log.Info(string.Format("Total : {0}", securitiesToInvest.Count));

                //var ssl = unitOfWork.Securities.Find(s => s.Ticker == "NTWK").First();
                //var statements = unitOfWork.FinancialStatements.Find(s => s.PrimarySymbol == "NTWK");
                //var latestStatement = statements.OrderBy(s => s.PeriodEnd).Last();
                //var ncav = latestStatement.BalanceSheet.TotalCurrentAssets -
                //           latestStatement.BalanceSheet.TotalCurrentLiabilities;
                //var last = ssl.Last;
                //var ticker = "DAL";
                //var fcau = unitOfWork.Securities.Find(x => x.Ticker == ticker);
                //var statements = unitOfWork.FinancialStatements.GetAll().Where(s => s.PrimarySymbol == ticker).Where(x => x.FormType == "10-K");
                int test = 0;

                Console.ReadLine();
            }
        }
Esempio n. 3
0
        public void ImportFinancialsStatements()
        {
            string apiKey = ConfigurationManager.AppSettings["EdgarApiKey"];

            _statementsEngine = new StatementEngine(new StatementRetrieverStrategy(new EdgarMarketDataFinancialStatementSource(apiKey)));
            while (_statementsEngine.ShouldWork)
            {
                _statementsEngine.DoCycle();
            }
            RefreshNetNets();
        }
Esempio n. 4
0
 public void RecalculateDiscountsOnNcav()
 {
     _priceEngine = new PriceEngine(new SecurityPriceRetrieverStrategy(new YahooMarketDataPriceSource()));
     while (_priceEngine.ShouldWork)
     {
         _priceEngine.DoCycle();
     }
     _ncavEngine = new NcavEngine();
     while (_ncavEngine.ShouldWork)
     {
         _ncavEngine.DoCycle();
     }
     RefreshNetNets();
 }