def get_portfolio_entries(self, title=None, returns=False, positions=False, multiple=True): """Get portfolio entries or one entry. Args: title: string, portfolio title, could be regexp. returns: [optional] boolean, include returns into the result. positions: [optional] boolean, include positions into the result. multiple: boolean, return multiple entries if True Returns: list of portfolio entries """ query = PortfolioQuery() query.returns = returns query.positions = positions uri = "/finance/feeds/default/portfolios/" + query.ToUri() if multiple: return self.GetEntries(uri, titles=title, converter=PortfolioFeedFromString) else: entry = self.GetSingleEntry(uri, title=title, converter=PortfolioFeedFromString) if entry: return [entry] else: return []
def GetPortfolios(self, with_returns=False): from gdata.finance.service import PortfolioQuery query = PortfolioQuery() query.returns = with_returns wait = 0.1 while True: try: feed = self.client.GetPortfolioFeed(query=query).entry break except Exception, e: from time import sleep sleep(wait) wait *= 2
def GetPortfolios(self, with_returns=False): query = PortfolioQuery() query.returns = with_returns return self.client.GetPortfolioFeed(query=query).entry
def GetPortfolios(self, with_returns=False, inline_positions=False): query = PortfolioQuery() query.returns = with_returns query.positions = inline_positions return self.client.GetPortfolioFeed(query=query).entry