alpacahq / alpaca-py

The Official Python SDK for Alpaca API
https://alpaca.markets/sdks/python/getting_started.html
Apache License 2.0
537 stars 134 forks source link

[Bug]: Validation on stream timestamps #345

Closed alessiocastrica closed 11 months ago

alessiocastrica commented 11 months ago

Is there an existing issue for this?

Current Behavior

When I subscribe to the websocket for both crypto or stocks I get a pydantic validation Error for the Trade, Quote and Bar models. Screenshot 2023-09-29 at 16 31 20

Expected Behavior

No response

SDK Version I encountered this issue in

v0.11.0

Steps To Reproduce

from alpaca.data.live import StockDataStream

stream = StockDataStream(
    api_key=BROKER_KEY,
    secret_key=BROKER_SECRET,
    url_override="wss://stream.data.sandbox.alpaca.markets/v2/iex",
)
symbol = "AAPL"
async def handler(data):
    print(data)
stream.subscribe_quotes(handler, symbol)
stream.subscribe_trades(handler, symbol)

stream.run()

Filled out the Steps to Reproduce section?

Anything else?

No response