示例#1
0
 public PortfolioFeed Query(PortfolioQuery feedQuery)
 {
     return base.Query(feedQuery) as PortfolioFeed;
 }
        public bool DeletePortfolio(string title)
        {
            PortfolioQuery query = new PortfolioQuery(FinanceNamespace.PORTFOLIOS + Details());
            PortfolioFeed portfolioFeed = FinanceService.Query(query);
            try
            {
                foreach (PortfolioEntry entry in portfolioFeed.Entries)
                {
                    if (entry.Title.Text == title)
                    {
                        FinanceService.Delete(entry);
                        return true;
                    }
                }
                return false;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception trying to delete portfolio = {0}, Message = {1}", title, ex.Message);
            }

            return false;
        }
        public TransactionEntry AddSymbol(string fullSymbolName, string portfolioTitle)
        {
            PortfolioQuery query = new PortfolioQuery(FinanceNamespace.PORTFOLIOS + Details());
            PortfolioFeed portfolioFeed = FinanceService.Query(query);
            try
            {
                foreach (PortfolioEntry entry in portfolioFeed.Entries)
                {
                    if (entry.Title.Text == portfolioTitle)
                    {
                        return AddSymbol(fullSymbolName, entry);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return null;
        }
示例#4
0
 public PortfolioFeed Query(PortfolioQuery feedQuery)
 {
     return(base.Query(feedQuery) as PortfolioFeed);
 }