Beispiel #1
0
        public async Task Get(StrategyRequest request)
        {
            await _stocksRepository.DeleteIncomeStatementEntities();

            await _stocksRepository.DeleteStockProfileEntities();

            await _stocksRepository.DeleteBalanceSheetEntities();

            var sortedStocks = await _stockListService.GetSortedStocks(new DCFRequest()
            {
                DividendMoreThan  = request.Dividend,
                MarketCapMoreThan = request.MarketCapMoreThan,
                Sector            = request.Sector,
                VolumeMoreThan    = request.VolumeMoreThan
            });

            foreach (var item in sortedStocks)
            {
                await _balanceSheetProvider.GetBalanceSheets(item.Symbol);
            }

            var stockSplits = ListExtensions.Split(sortedStocks, 5);

            foreach (var stockSplit in stockSplits)
            {
                var stockSymbols  = StringExtensions.GetSymbolsString(stockSplit.Select(x => x.Symbol).ToArray());
                var stockProfiles = await _profileProvider.GetStockProfile(stockSymbols);
            }

            foreach (var stock in sortedStocks)
            {
                await _incomeStatementProvider.GetIncomeStatements(stock.Symbol);
            }
        }
Beispiel #2
0
        public async Task <IActionResult> GetDCFData(StrategyRequest request)
        {
            var timer = new Stopwatch();

            timer.Start();
            await _dcfStrategy.Get(request);

            timer.Stop();
            return(Ok("Time taken: " + timer.Elapsed.ToString(@"m\:ss\.fff")));
        }
Beispiel #3
0
        public async Task <IActionResult> GetMomentumStockPrices(StrategyRequest request)
        {
            var timer = new Stopwatch();

            timer.Start();
            await _momentumStrategy.GetStockPrices(request.Dividend, request.MarketCapMoreThan, request.From, request.To, request.Sector, request.VolumeMoreThan);

            timer.Stop();
            return(Ok("Time taken: " + timer.Elapsed.ToString(@"m\:ss\.fff")));
        }
Beispiel #4
0
        private void btnRegStrategy_Click(object sender, EventArgs e)
        {
            // Load一个新的策略实例
            EStrategy strategy1 = new EStrategy()
            {
                Id   = 1,
                Type = "Quanter.Strategy.Demo.DemoStrategyActor, Quanter.Strategy.Demo",
                Name = "Demo示例",
                Desc = "Demo实例"
            };

            EStrategy strategy2 = new EStrategy()
            {
                Id   = 2,
                Type = "Quanter.Strategy.XueQiuStrategy.TraceXueQiuStrategyActor, Quanter.Strategy.XueQiuStrategy",
                Name = "雪球策略",
                Desc = "雪球实例"
            };

            EStrategy strategy3 = new EStrategy()
            {
                Id   = 3,
                Type = "Quanter.Strategy.RationBStrategyActor, Quanter.Strategy.RationB",
                Name = "分级策略",
                Desc = "雪球实例"
            };

            StrategyRequest req = new StrategyRequest()
            {
                Type = StrategyRequestType.CREATE, Body = strategy1
            };

            strategyActor.Tell(req);
            //req = new StrategyRequest() { Type = StrategyRequestType.CREATE, Body = strategy2 };
            //strategyActor.Tell(req);
            //req = new StrategyRequest() { Type = StrategyRequestType.CREATE, Body = strategy3 };
            //strategyActor.Tell(req);
        }