public override bool getNumericValue(string stockID, out double val) { StockFinanceData fd = StockDataCenter.getInstance().getFinanceData(stockID); StockMarketData md = StockDataCenter.getInstance().getMarketData(stockID); val = 0.0; if (fd == null || md == null) { return(false); } double epsTTM = fd.eps4Quarter; double epsLastYear = fd.epsLastYear; if (epsTTM < 0.0) { return(false); } if (epsLastYear < 0.0 && epsTTM > double.Epsilon) { return(true); } val = (epsTTM - epsLastYear) / md.latestPrice; return(false); }
public void Setup() { var mockHttp = new MockHttpMessageHandler(); var client = mockHttp.ToHttpClient(); var stockMarketAPI = new StockMarketAPI(client); var stockMarketData = new StockMarketData(stockMarketAPI); TestHelpers.MockStockData(mockHttp); TestHelpers.MockFondData(mockHttp); TestHelpers.MockBondData(mockHttp); TestHelpers.MockDividendData(mockHttp); TestHelpers.MockCouponsData(mockHttp); var context = TestHelpers.GetMockFinanceDbContext(); TestHelpers.SeedOperations1(context); _financeDataService = new FinanceDataService(context); var assetFactory = new AssetsFactory(_financeDataService, stockMarketData); var balanceService = new BalanceService(_financeDataService); _marketService = new MarketService(_financeDataService, assetFactory, balanceService); _portfolioService = new PortfolioService(_financeDataService, balanceService, assetFactory); }
private async void btnCPUBoundOperations_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(_data)) { StockMarketData stockMarketData = new StockMarketData(); _data = await stockMarketData.GetDataAsync(); } StockMarketDataAnalysis stockMarketDataAnalysis = new StockMarketDataAnalysis(_data); // string result = await Task.Run(() => stockMarketDataAnalysis.CalculateStockastics()); // AddListItem(result); List <Task <string> > tasks = new List <Task <string> >(); tasks.Add(Task.Run(() => stockMarketDataAnalysis.CalculateFastMovingAverage())); tasks.Add(Task.Run(() => stockMarketDataAnalysis.CalculateSlowMovingAverage())); tasks.Add(Task.Run(() => stockMarketDataAnalysis.CalculateStockastics())); tasks.Add(Task.Run(() => stockMarketDataAnalysis.CalculateBollingerbands())); // Task.WaitAll(tasks.ToArray()); await Task.WhenAll(tasks.ToArray()); //await Task.WhenAll(tasks.ToArray()).ConfigureAwait(false); AddListItem(tasks[0].Result); AddListItem(tasks[1].Result); AddListItem(tasks[2].Result); AddListItem(tasks[3].Result); DisplayIndicatorsOnChart(tasks[0].Result, tasks[1].Result, tasks[2].Result, tasks[3].Result); // SaveIndicatorDataToFile(tasks[0].Result, tasks[1].Result, tasks[2].Result, tasks[3].Result); }
public KLineAnalyzer(List <StockKLine> data, StockMarketData md) { m_kLineData = data; m_curMarketData = md; init(); }
public void Setup() { _mockHttp = new MockHttpMessageHandler(); var client = _mockHttp.ToHttpClient(); var stockMarketAPI = new StockMarketAPI(client); MockData(); var stockMarketData = new StockMarketData(stockMarketAPI); _graphService = new GraphService(stockMarketData); }
public void Setup() { var mockHttp = new MockHttpMessageHandler(); var client = mockHttp.ToHttpClient(); var stockMarketAPI = new StockMarketAPI(client); var stockMarketData = new StockMarketData(stockMarketAPI); TestHelpers.MockStockData(mockHttp); _data = stockMarketData.GetStockData("YNDX").Result; }
public override bool filterMethod(string stockID) { StockMarketData md = StockDataCenter.getInstance().getMarketData(stockID); if (md != null && PriceAnalyzer.isPriceScaleSatisfied(stockID, md.latestPrice, m_ratio)) { return(true); } return(false); }
public override bool getNumericValue(string stockID, out double val) { StockMarketData md = StockDataCenter.getInstance().getMarketData(stockID); val = 0.0; if (md != null) { val = md.PE; return(true); } return(false); }
public static double calcCurCostRefValue(string stockID, string year, string season) { double costRefVal = 0.0; StockReportData rd = StockDBVisitor.getInstance().getStockReportData(stockID, year, season); StockMarketData md = StockDataCenter.getInstance().getMarketData(stockID); int quarter = int.Parse(season); if (rd != null && md != null) { costRefVal = (rd.eps / md.latestPrice) / quarter * 4; } return(costRefVal); }
public static bool calcDynamicPE(string stockID, out double val) { StockMarketData md = StockDataCenter.getInstance().getMarketData(stockID); string year = GlobalConfig.getInstance().curYear; string quarter = GlobalConfig.getInstance().curQuarter; StockReportData rd = StockDBVisitor.getInstance().getStockReportData(stockID, year, quarter); val = 0.0; if (md != null && rd != null) { double profitVal = getEstimateProfitValue(rd.net_profits, quarter); val = md.totalCapitalisation * 10000.0 / profitVal; return(true); } return(false); }
public void Setup() { var mockHttp = new MockHttpMessageHandler(); var client = mockHttp.ToHttpClient(); var stockMarketAPI = new StockMarketAPI(client); var stockMarketData = new StockMarketData(stockMarketAPI); TestHelpers.MockStockData(mockHttp); TestHelpers.MockFondData(mockHttp); TestHelpers.MockDividendData(mockHttp); var context = TestHelpers.GetMockFinanceDbContext(); TestHelpers.SeedOperations1(context); var financeDataService = new FinanceDataService(context); _assetFactory = new AssetsFactory(financeDataService, stockMarketData); }
public static bool getPriceScaleFromDate(string stockID, string beginDate, out double ratio) { ratio = 0.0; StockMarketData md = StockDataCenter.getInstance().getMarketData(stockID); if (md == null) { return(false); } double curPrice = md.latestPrice; List <StockKLineBaidu> arr = StockDataCenter.getInstance().getKLineBaidu(stockID); if (arr == null || arr.Count == 0) { return(false); } ratio = getPriceScale(arr, curPrice, beginDate); return(true); }
public void Setup() { _mockHttp = new MockHttpMessageHandler(); var client = _mockHttp.ToHttpClient(); var stockMarketAPI = new StockMarketAPI(client); MockData(); var stockMarketData = new StockMarketData(stockMarketAPI); var context = TestHelpers.GetMockFinanceDbContext(); TestHelpers.SeedOperations1(context); var financeDataService = new FinanceDataService(context); TestHelpers.MockStockData(_mockHttp); TestHelpers.MockFondData(_mockHttp); TestHelpers.MockBondData(_mockHttp); TestHelpers.MockDividendData(_mockHttp); TestHelpers.MockCouponsData(_mockHttp); _searchService = new SearchService(stockMarketData, financeDataService); }
public async Task Setup() { var mockHttp = new MockHttpMessageHandler(); var client = mockHttp.ToHttpClient(); var stockMarketApi = new StockMarketAPI(client); var stockMarketData = new StockMarketData(stockMarketApi); var context = TestHelpers.GetMockFinanceDbContext(); _financeDataService = new FinanceDataService(context); var assetFactory = new AssetsFactory(_financeDataService, stockMarketData); _balanceService = new BalanceService(_financeDataService); TestHelpers.SeedApp(context); _portfolioService = new PortfolioService(_financeDataService, _balanceService, assetFactory); TestHelpers.MockStockData(mockHttp); TestHelpers.MockFondData(mockHttp); TestHelpers.MockBondData(mockHttp); TestHelpers.SeedOperations2(context); }