Coder Social home page Coder Social logo

Comments (8)

hiohiohio avatar hiohiohio commented on June 12, 2024 2

released https://github.com/alpacahq/alpaca-py/releases/tag/v0.13.1.
Can you please try to use the new version?

edit: sorry, missed to bump versions. so should be v0.13.1

from alpaca-py.

grzesir avatar grzesir commented on June 12, 2024 2

from alpaca-py.

grzesir avatar grzesir commented on June 12, 2024 1

+1. Was about to post this as well. Here's the issue I'm getting:

10/26/23 01:47:15 AM
2023-10-26 05:47:15,041: alpaca.trading.stream: ERROR: error during websocket communication: 3 validation errors for TradeUpdate
10/26/23 01:47:15 AM
position_qty
10/26/23 01:47:15 AM
Field required [type=missing, input_value={'event': 'new', 'timesta...4a04-a508-1ba63cfc3150'}, input_type=dict]
10/26/23 01:47:15 AM
For further information visit https://errors.pydantic.dev/2.4/v/missing
10/26/23 01:47:15 AM
price
10/26/23 01:47:15 AM
Field required [type=missing, input_value={'event': 'new', 'timesta...4a04-a508-1ba63cfc3150'}, input_type=dict]
10/26/23 01:47:15 AM
For further information visit https://errors.pydantic.dev/2.4/v/missing
10/26/23 01:47:15 AM
qty
10/26/23 01:47:15 AM
Field required [type=missing, input_value={'event': 'new', 'timesta...4a04-a508-1ba63cfc3150'}, input_type=dict]
10/26/23 01:47:15 AM
For further information visit https://errors.pydantic.dev/2.4/v/missing
10/26/23 01:47:15 AM
Traceback (most recent call last):
10/26/23 01:47:15 AM
File "/home/runner/2be35c55-ea57-4c2f-9ba0-c48797fbc552/venv/lib/python3.10/site-packages/alpaca/trading/stream.py", line 172, in _run_forever
10/26/23 01:47:15 AM
await self._consume()
10/26/23 01:47:15 AM
File "/home/runner/2be35c55-ea57-4c2f-9ba0-c48797fbc552/venv/lib/python3.10/site-packages/alpaca/trading/stream.py", line 145, in _consume
10/26/23 01:47:15 AM
await self._dispatch(msg)
10/26/23 01:47:15 AM
File "/home/runner/2be35c55-ea57-4c2f-9ba0-c48797fbc552/venv/lib/python3.10/site-packages/alpaca/trading/stream.py", line 89, in _dispatch
10/26/23 01:47:15 AM
await self._trade_updates_handler(self._cast(msg))
10/26/23 01:47:15 AM
File "/home/runner/2be35c55-ea57-4c2f-9ba0-c48797fbc552/venv/lib/python3.10/site-packages/alpaca/trading/stream.py", line 103, in _cast
10/26/23 01:47:15 AM
result = TradeUpdate(**msg.get("data"))
10/26/23 01:47:15 AM
File "/home/runner/2be35c55-ea57-4c2f-9ba0-c48797fbc552/venv/lib/python3.10/site-packages/pydantic/main.py", line 164, in __init__
10/26/23 01:47:15 AM
__pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)
10/26/23 01:47:15 AM
pydantic_core._pydantic_core.ValidationError: 3 validation errors for TradeUpdate
10/26/23 01:47:15 AM
position_qty
10/26/23 01:47:15 AM
Field required [type=missing, input_value={'event': 'new', 'timesta...4a04-a508-1ba63cfc3150'}, input_type=dict]
10/26/23 01:47:15 AM
For further information visit https://errors.pydantic.dev/2.4/v/missing
10/26/23 01:47:15 AM
price
10/26/23 01:47:15 AM
Field required [type=missing, input_value={'event': 'new', 'timesta...4a04-a508-1ba63cfc3150'}, input_type=dict]
10/26/23 01:47:15 AM
For further information visit https://errors.pydantic.dev/2.4/v/missing
10/26/23 01:47:15 AM
qty
10/26/23 01:47:15 AM
Field required [type=missing, input_value={'event': 'new', 'timesta...4a04-a508-1ba63cfc3150'}, input_type=dict]

from alpaca-py.

hiohiohio avatar hiohiohio commented on June 12, 2024 1

Thank you for the reporting and sorry for the inconvenience.
Just created a PR to solve this issue.
#372

from alpaca-py.

bulletbs avatar bulletbs commented on June 12, 2024 1

Now it works just fine (with v0.13.0+), no more pydantic validation errors on events
Thnx!

from alpaca-py.

impredicative avatar impredicative commented on June 12, 2024

I am going to update my code for use raw_data=True because this pydantic nonsense will always be susceptible to breakage for the slightest reasons.

from alpaca-py.

grzesir avatar grzesir commented on June 12, 2024

I am going to update my code for use raw_data=True because this pydantic nonsense will always be susceptible to breakage for the slightest reasons.

Yea that sounds like a good idea, I really dislike pydantic. Where exactly are you putting raw_data=True?

from alpaca-py.

impredicative avatar impredicative commented on June 12, 2024

Where exactly are you putting raw_data=True?

It can be specified as a kwarg when initializing an instance of the TradingStream class. Its default value is False.

from alpaca-py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.