public void PopulateChartPrice(string ticker) { List <Object> result = bbH.GetPriceVolumeValue(ticker, null, "20180101", "20180220"); List <double> price = (List <double>)result[1]; ChartValues <double> valueChart = new ChartValues <double>(); for (int i = 0; i < price.Count; i++) { valueChart.Add(price[i]); } NameAsset = ticker; ValueAsset = new SeriesCollection { new LineSeries { Title = "Price", Values = valueChart } }; }
public void PopulateChartPrice(string ticker) { // Get historical data List <Object> result = bbH.GetPriceVolumeValue(ticker, null, "20180101", "20180220"); List <double> price = (List <double>)result[1]; ChartValues <double> valueChart = new ChartValues <double>(); for (int i = 0; i < price.Count; i++) { valueChart.Add(price[i]); } // Compute Volatility ChartValues <double> valueVolatility = new ChartValues <double>(); double V0 = price[0]; for (int i = 0; i < price.Count; i++) { double Vt = price[i]; valueVolatility.Add(((Vt / V0) - 1) * 100); // peut etre *100 à voir selon le résultat } NameAsset = ticker; // Compute Performance ChartValues <double> valuePerformance = new ChartValues <double>(); for (int i = 0; i < price.Count; i++) { double resultPerf = PopulationStandardDeviation(valueVolatility.Take(i).ToList()); valuePerformance.Add(resultPerf); } AssetValue = new SeriesCollection { new LineSeries { Title = "Asset Value", Values = valueChart } }; AssetValuePerformance = new SeriesCollection { new LineSeries { Title = "Performance", Values = valuePerformance } }; AssetValueVolatility = new SeriesCollection { new LineSeries { Title = "Volatility", Values = valueVolatility } }; // Here for AssetReaserch AssetResarch.ValuePerformance = valuePerformance.ToList(); AssetResarch.Value = valueChart.ToList(); AssetResarch.ValueVolatility = valueVolatility.ToList(); }