Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pydantic Validation Error when Running get_market_metrics() #112

Closed
joshuabuildsthings opened this issue Dec 4, 2023 · 3 comments
Closed

Comments

@joshuabuildsthings
Copy link

Describe the bug

ValidationError Traceback (most recent call last)
Cell In[3], line 3
      1 from tastytrade.metrics import get_market_metrics
----> 3 metrics =  get_market_metrics(session, 'spy')
      5 display(metrics)

File ~\AppData\Roaming\Python\Python310\site-packages\tastytrade\metrics.py:114, in get_market_metrics(session, symbols)
    110 validate_response(response)
    112 data = response.json()['data']['items']
--> 114 return [MarketMetricInfo(**entry) for entry in data]

File ~\AppData\Roaming\Python\Python310\site-packages\tastytrade\metrics.py:114, in <listcomp>(.0)
    110 validate_response(response)
    112 data = response.json()['data']['items']
--> 114 return [MarketMetricInfo(**entry) for entry in data]

File lib\site-packages\pydantic\main.py:341, in pydantic.main.BaseModel.__init__()

ValidationError: 1 validation error for MarketMetricInfo
liquidity-running-state -> updated-at
  field required (type=value_error.missing)

How to reproduce

from tastytrade.metrics import get_market_metrics

metrics =  get_market_metrics(session, 'spy')

display(metrics)
@Graeme22
Copy link
Contributor

Graeme22 commented Dec 4, 2023

Thanks for opening an issue! Were you using a production or certification session?

@joshuabuildsthings
Copy link
Author

@Graeme22 - Thanks for the rapid response! I was using a production session. Debug output confirmed I was properly connected.

I swapped this library out for the "official" Python SDK and was able to make the request & pull the data.

@Graeme22
Copy link
Contributor

Graeme22 commented Dec 4, 2023

Gotcha. It's fixed in the master branch if you want to do a local install. It'll be in the next release as well. Cheers

@Graeme22 Graeme22 closed this as completed Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants