Right now calling get_barset for time frames of Min or 5Min on TSLA will return Bar({‘c’: 861.58, ‘h’: 861.58, ‘l’: 861.58, ‘o’: 861.58, ‘t’: 1612821900, ‘v’: 105} when TSLA is at 850. But on GOOG and AMZN things are normal. Here is the code:
api = tradeapi.REST(ALPACA_LOGIN, ALPACA_PWD)
today = datetime.datetime.now()
ticker = sys.argv[1]
afrom = today - datetime.timedelta(minutes=50)
barset = api.get_barset(ticker, ‘5Min’, after=afrom)
print(barset[ticker][-1])