How do I get data through my alpaca datastream?

225 Views Asked by At

I am trying to get live stock data through my Alpaca API, however, when I run my script, nothing happens at all. Here is the script.

from alpaca.data.live import StockDataStream

async def quote_handler(quote):
    print(quote)

stream = StockDataStream("<key>", "<secret>")
stream.subscribe_quotes(quote_handler, "TSLA")
stream.run()
1

There are 1 best solutions below

0
On BEST ANSWER

First, you should not give away your keys, it's called secret key...

Second, if there is no stream, maybe you try to get data when the market is closed