I don't seem to be able to get the stream to work. i am correctly instantiating DataStreamClient with valid keys from live import.
from dotenv import dotenv_values
from alpaca.data.enums import DataFeed
from alpaca.data.live import StockDataStream
# Load environment variables from .env file
config = dotenv_values(".env")
API_KEY = config['APCA_API_KEY_ID']
SECRET_KEY = config['APCA_API_SECRET_KEY']
# Instantiate the StockDataStream
stream = StockDataStream(
api_key=API_KEY,
secret_key=SECRET_KEY,
feed=DataFeed.IEX, # or DataFeed.SIP if you have access
)
print(stream)
# Define your callback function to handle incoming data
async def handle_bar(bar):
# Process the bar data (this is just a placeholder, adjust according to your data structure)
print(bar)
# Subscribe to live updates for a symbol, e.g., "AAPL"
stream.subscribe_bars(handle_bar, "AAPL")
# Start streaming
stream.run()
Expected Behavior
Expecting candles to come through, but only seeing:
<alpaca.data.live.stock.StockDataStream object at 0x11939f0b0> which is the print from instantiating client.
[X] I have entered valid steps to reproduce my issue or have attached a minimally reproducible case in code that shows my issue happening; and understand that without this my issue will be flagged as invalid and closed after 30 days.
Is there an existing issue for this?
Current Behavior
I don't seem to be able to get the stream to work. i am correctly instantiating DataStreamClient with valid keys from live import.
Expected Behavior
Expecting candles to come through, but only seeing:
<alpaca.data.live.stock.StockDataStream object at 0x11939f0b0>
which is the print from instantiating client.SDK Version I encountered this issue in
Steps To Reproduce
Filled out the Steps to Reproduce section?
Anything else?
thats it.