self.get_last_prices¶
- lumibot.strategies.strategy.Strategy.get_last_prices(self, assets, quote=None, exchange=None)¶
Takes a list of assets and returns the last known prices
Makes an active call to the market to retrieve the last price. In backtesting will provide the close of the last complete bar.
- Parameters
assets (list of Asset objects) – List of Asset objects for which the last closed price will be retrieved.
quote (Asset object) – Quote asset object for which the last closed price will be retrieved. This is required for cryptocurrency pairs.
- Returns
Last known closing prices as either a list of floats or Decimal objects.
- Return type
list of floats or Decimals
Example
>>> # Will return the last price for the assets >>> assets = ["SPY", "TLT"] >>> last_prices = self.get_last_prices(assets)