def get_price_quote(self, d=None, column='adj_close'):
"""
Get the price of an Asset.
:param date or datetime d: The datetime of when to retrieve the price quote from.
(default: ``date.today()``)
:param str column: The header of the column to use to get the price quote from.
(default: ``adj_close``
:return: namedtuple with price and the the datetime
:rtype: namedtuple
"""
quote = namedtuple('Quote', 'price time')
if d is None:
df = web.get_quote_yahoo(self.ticker)
d = date.today()
time = dt_utils.parse_date(df['time'][0]).time()
dt = datetime.combine(d, time=time)
return quote(price=df['last'], time=dt)
else:
price = self.ohlcv.ix[d][column][0]
return quote(price=price, time=d)
评论列表
文章目录