Files
2024-02-22 14:52:53 -05:00

75 lines
2.2 KiB
C#

//using System;
//using System.Collections;
//using System.Collections.Generic;
//using System.Text;
//using MarketData.Numerical;
//namespace MarketData.MarketDataModel
//{
// public class Statistic
// {
// private double meanReturn;
// private double volatility;
// private double meanPrice;
// private double beta;
// public Statistic()
// {
// }
// public double MeanReturn
// {
// get { return meanReturn; }
// set { meanReturn = value; }
// }
// public double Volatility
// {
// get { return volatility; }
// set { volatility = value; }
// }
// public double MeanPrice
// {
// get { return meanPrice; }
// set { meanPrice = value; }
// }
// public double Beta
// {
// get { return beta; }
// set { beta = value; }
// }
// public static Statistic GetStatistic(Prices prices, Prices benchmarkPrices)
// {
// try
// {
// Statistic statistic = new Statistic();
// if (0 == prices.Count || 0 == benchmarkPrices.Count) return null;
// float[] returns = prices.GetReturns();
// float[] pricesArray = prices.GetPrices();
// float[] benchmarkPricesArray = benchmarkPrices.GetPrices();
// statistic.MeanReturn = Numerics.Mean(ref returns);
// statistic.Volatility = Numerics.Volatility(ref returns);
// statistic.MeanPrice = Numerics.Mean(ref pricesArray);
// statistic.Beta = Numerics.Beta(ref pricesArray, ref benchmarkPricesArray);
// return statistic;
// }
// catch (Exception exception)
// {
// MDTrace.WriteLine(LogLevel.DEBUG, exception.ToString());
// return null;
// }
// }
// public static String Header
// {
// get { return "AverageReturn,Volatility,MeanPrice,Beta"; }
// }
// public override String ToString()
// {
// StringBuilder sb = new StringBuilder();
// sb.Append(String.Format("{0:0.00000}", MeanReturn)).Append(",");
// sb.Append(String.Format("{0:0.00000}", Volatility)).Append(",");
// sb.Append(String.Format("{0:0.00000}", MeanPrice)).Append(",");
// sb.Append(String.Format("{0:0.00000}", Beta)); ;
// return sb.ToString();
// }
// }
//}