tastyware / tastytrade

An unofficial, sync/async Python SDK for Tastytrade!
https://tastyworks-api.rtfd.io
MIT License
127 stars 43 forks source link

class MarketMetricInfo(TastytradeJsonDataclass): has faulty attributes - part 2 #76

Closed Quenos closed 1 year ago

Quenos commented 1 year ago

The following attributes are not in the get_metrics method. I suspect it became dependent on the asset class. This was retrieved for equity options.

  File "tastytrade/metrics.py", line 110, in <listcomp>
    return [MarketMetricInfo(**entry) for entry in data]
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 8 validation errors for MarketMetricInfo
liquidity-value
  field required (type=value_error.missing)
liquidity-rank
  field required (type=value_error.missing)
liquidity-running-state
  field required (type=value_error.missing)
beta-updated-at
  field required (type=value_error.missing)
dividend-yield
  field required (type=value_error.missing)
listed-market
  field required (type=value_error.missing)
lendability
  field required (type=value_error.missing)
borrow-rate
  field required (type=value_error.missing)
python-BaseException
Graeme22 commented 1 year ago

Hello! Can you post the code that produces this error?

Quenos commented 1 year ago

Nothing special: metrics = get_market_metrics(self.session, [self.symbol]) self.symbol == 'XSP' Valid session

Graeme22 commented 1 year ago

And what kind of session is it?

Quenos commented 1 year ago

Production

Graeme22 commented 1 year ago

If you change the symbol, does the error go away?

Quenos commented 1 year ago

Yes, tried for AAPL,GLD and it works correctly SPY is not working correctly

Graeme22 commented 1 year ago

I also noticed that for SPY, I think it's because it's not beta-weighted against itself haha