Is there an equivalent to get_bars (in comment below) in new SDK?
from alpaca.trading.client import TradingClient
from alpaca.trading.requests import MarketOrderRequest
from alpaca.trading.enums import OrderSide, TimeInForce
import alpaca_trade_api as tradeapi
from alpaca_trade_api.rest import TimeFrame
import numpy as np
import pandas as pd
import pytz
import datetime as dt
from time import sleep
from api import *
trading_client = TradingClient(ALPACA_API_KEY_ID, ALPACA_API_SECRET_KEY, paper=True)
api = tradeapi.REST(
base_url=ALPACA_API_BASE_URL,
key_id=ALPACA_API_KEY_ID,
secret_key=ALPACA_API_SECRET_KEY
)
# Define the two assets to trade
stock = 'TSLA'
# Set a constant for UTC timezone
UTC = pytz.timezone('UTC')
# Get the current time, 15 minutes, and 1 hour ago
time_now = dt.datetime.now(tz=UTC)
time_15_min_ago = time_now - dt.timedelta(minutes=15)
time_1_hr_ago = time_now - dt.timedelta(hours=1)
# Old library
data_df_stock = api.get_bars( # IS THERE AN EQUIVALENT TO THIS IN NEW SDK
stock,
TimeFrame.Hour,
start=time_1_hr_ago.isoformat(),
end=time_15_min_ago.isoformat(),
adjustment='raw'
).df
print(type(data_df_stock.open))