コード例 #1
0
ファイル: PortfolioOptimizer.cs プロジェクト: ifzz/QuantSys
        public static void Run()
        {
            List<Position> list = new List<Position>();

            /*
            list.Add(new Position());
            list.Add(new Position("bond"));
            list.Add(new Position("stock"));
             * */
            Portfolio p = new Portfolio();

            double[] returns = {0.000, 0.13, -0.13};
            DenseVector returns1 = new DenseVector(returns);

            double[] stdev = {0, 7.4, 7.4};
            double[,] covariance = {{1, -.4, -.45}, {-.4, 1, .35}, {-0.45, 0.35, 1}};

            DenseMatrix covariance1 = StatisticsExtension.CorrelationToCovariance(new DenseMatrix(covariance),
                                                                                  new DenseVector(stdev));


            PortfolioOptimizer po = new PortfolioOptimizer(p, .09002, covariance1, returns1);
            po.BuildRiskModel();
            Console.ReadLine();
        }
コード例 #2
0
ファイル: PortfolioOptimizer.cs プロジェクト: ifzz/QuantSys
 public PortfolioOptimizer(Portfolio p, double minReturn, DenseMatrix cov, DenseVector returns)
 {
     portfolio = p;
     this.returns = returns;
     covariance = cov;
     this.minReturn = minReturn;
     resultWeights = new DenseVector(returns.Count);
 }
コード例 #3
0
ファイル: AccountManager.cs プロジェクト: ifzz/QuantSys
 public AccountManager()
 {
     _portfolio = new Portfolio();
     _flags = new List<HighstockFlag>();
     _outStandingStopOrders = new Dictionary<Symbol, StopOrder>();
     _outStandingLimitOrders = new Dictionary<Symbol, LimitOrder>();
     _tradeProfits = new List<double>();
     _performance = new BacktestPerformance();
     currentOffers = new Dictionary<Symbol, Tick>();
 }