예제 #1
0
        //[Fact]
        public void For_real()
        {
            // remove Skip property and add api key below to run against live API
            var client           = new StockApiClient("Api key goes here");
            var balancer         = new Balancer(client);
            var currentPortfolio = new Portfolio(new List <PortfolioStock> {
                new PortfolioStock(symbol: "AAPL", shares: 50),
                new PortfolioStock(symbol: "GOOG", shares: 200),
                new PortfolioStock(symbol: "CYBR", shares: 150),
                new PortfolioStock(symbol: "ABB", shares: 900)
            });
            var requestedPortfolio = new Portfolio(new List <PortfolioStock> {
                new PortfolioStock(symbol: "AAPL", allocationPercentage: 22),
                new PortfolioStock(symbol: "GOOG", allocationPercentage: 38),
                new PortfolioStock(symbol: "GFN", allocationPercentage: 25),
                new PortfolioStock(symbol: "ACAD", allocationPercentage: 15)
            });
            var today = DateTime.Now.Date;

            var(actions, updatedPortfolio) = balancer.Balance(currentPortfolio, requestedPortfolio, today);

            WriteOutput(actions, updatedPortfolio);
        }
예제 #2
0
 public Balancer(StockApiClient stockClient)
 {
     _stockClient = stockClient;
 }