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

I get an error when querying { fields } in .quotes. #807

Open
Emre4x0 opened this issue Sep 24, 2024 · 4 comments
Open

I get an error when querying { fields } in .quotes. #807

Emre4x0 opened this issue Sep 24, 2024 · 4 comments
Labels
bug Something isn't working validation Issues related to validation

Comments

@Emre4x0
Copy link

Emre4x0 commented Sep 24, 2024

Validation Error

Minimal Reproduction

await yahooFinance.quote(symbols.map((symbol) => symbol.name), {
fields: [
"symbol",
"regularMarketChange",
"regularMarketChangePercent",
"quoteType",
"circulatingSupply",
"fromCurrency",
"toCurrency",
"lastMarket",
"coinImageUrl",
"volume24Hr",
"volumeAllCurrencies",
"startDate",
"priceHint"
]
});

Error Message

[yahooFinance] Invalid options ("{
  "type": 62,
  "schema": {
    "anyOf": [
      {
        "const": "language",
        "type": "string"
      },
      {
        "const": "region",
        "type": "string"
      },
      {
        "const": "quoteType",
        "type": "string"
      },
      {
        "const": "typeDisp",
        "type": "string"
      },
      {
        "const": "quoteSourceName",
        "type": "string"
      },
      {
        "const": "triggerable",
        "type": "string"
      },
      {
        "const": "currency",
        "type": "string"
      },
      {
        "const": "customPriceAlertConfidence",
        "type": "string"
      },
      {
        "const": "marketState",
        "type": "string"
      },
      {
        "const": "tradeable",
        "type": "string"
      },
      {
        "const": "cryptoTradeable",
        "type": "string"
      },
      {
        "const": "exchange",
        "type": "string"
      },
      {
        "const": "shortName",
        "type": "string"
      },
      {
        "const": "longName",
        "type": "string"
      },
      {
        "const": "messageBoardId",
        "type": "string"
      },
      {
        "const": "exchangeTimezoneName",
        "type": "string"
      },
      {
        "const": "exchangeTimezoneShortName",
        "type": "string"
      },
      {
        "const": "gmtOffSetMilliseconds",
        "type": "string"
      },
      {
        "const": "market",
        "type": "string"
      },
      {
        "const": "esgPopulated",
        "type": "string"
      },
      {
        "const": "fiftyTwoWeekLowChange",
        "type": "string"
      },
      {
        "const": "fiftyTwoWeekLowChangePercent",
        "type": "string"
      },
      {
        "const": "fiftyTwoWeekRange",
        "type": "string"
      },
      {
        "const": "fiftyTwoWeekHighChange",
        "type": "string"
      },
      {
        "const": "fiftyTwoWeekHighChangePercent",
        "type": "string"
      },
      {
        "const": "fiftyTwoWeekLow",
        "type": "string"
      },
      {
        "const": "fiftyTwoWeekHigh",
        "type": "string"
      },
      {
        "const": "fiftyTwoWeekChangePercent",
        "type": "string"
      },
      {
        "const": "dividendDate",
        "type": "string"
      },
      {
        "const": "earningsTimestamp",
        "type": "string"
      },
      {
        "const": "earningsTimestampStart",
        "type": "string"
      },
      {
        "const": "earningsTimestampEnd",
        "type": "string"
      },
      {
        "const": "trailingAnnualDividendRate",
        "type": "string"
      },
      {
        "const": "trailingPE",
        "type": "string"
      },
      {
        "const": "trailingAnnualDividendYield",
        "type": "string"
      },
      {
        "const": "epsTrailingTwelveMonths",
        "type": "string"
      },
      {
        "const": "epsForward",
        "type": "string"
      },
      {
        "const": "epsCurrentYear",
        "type": "string"
      },
      {
        "const": "priceEpsCurrentYear",
        "type": "string"
      },
      {
        "const": "sharesOutstanding",
        "type": "string"
      },
      {
        "const": "bookValue",
        "type": "string"
      },
      {
        "const": "fiftyDayAverage",
        "type": "string"
      },
      {
        "const": "fiftyDayAverageChange",
        "type": "string"
      },
      {
        "const": "fiftyDayAverageChangePercent",
        "type": "string"
      },
      {
        "const": "twoHundredDayAverage",
        "type": "string"
      },
      {
        "const": "twoHundredDayAverageChange",
        "type": "string"
      },
      {
        "const": "twoHundredDayAverageChangePercent",
        "type": "string"
      },
      {
        "const": "marketCap",
        "type": "string"
      },
      {
        "const": "forwardPE",
        "type": "string"
      },
      {
        "const": "priceToBook",
        "type": "string"
      },
      {
        "const": "sourceInterval",
        "type": "string"
      },
      {
        "const": "exchangeDataDelayedBy",
        "type": "string"
      },
      {
        "const": "firstTradeDateMilliseconds",
        "type": "string"
      },
      {
        "const": "priceHint",
        "type": "string"
      },
      {
        "const": "postMarketChangePercent",
        "type": "string"
      },
      {
        "const": "postMarketTime",
        "type": "string"
      },
      {
        "const": "postMarketPrice",
        "type": "string"
      },
      {
        "const": "postMarketChange",
        "type": "string"
      },
      {
        "const": "regularMarketChange",
        "type": "string"
      },
      {
        "const": "regularMarketChangePercent",
        "type": "string"
      },
      {
        "const": "regularMarketTime",
        "type": "string"
      },
      {
        "const": "regularMarketPrice",
        "type": "string"
      },
      {
        "const": "regularMarketDayHigh",
        "type": "string"
      },
      {
        "const": "regularMarketDayRange",
        "type": "string"
      },
      {
        "const": "regularMarketDayLow",
        "type": "string"
      },
      {
        "const": "regularMarketVolume",
        "type": "string"
      },
      {
        "const": "regularMarketPreviousClose",
        "type": "string"
      },
      {
        "const": "preMarketChange",
        "type": "string"
      },
      {
        "const": "preMarketChangePercent",
        "type": "string"
      },
      {
        "const": "preMarketTime",
        "type": "string"
      },
      {
        "const": "preMarketPrice",
        "type": "string"
      },
      {
        "const": "bid",
        "type": "string"
      },
      {
        "const": "ask",
        "type": "string"
      },
      {
        "const": "bidSize",
        "type": "string"
      },
      {
        "const": "askSize",
        "type": "string"
      },
      {
        "const": "fullExchangeName",
        "type": "string"
      },
      {
        "const": "financialCurrency",
        "type": "string"
      },
      {
        "const": "regularMarketOpen",
        "type": "string"
      },
      {
        "const": "averageDailyVolume3Month",
        "type": "string"
      },
      {
        "const": "averageDailyVolume10Day",
        "type": "string"
      },
      {
        "const": "displayName",
        "type": "string"
      },
      {
        "const": "symbol",
        "type": "string"
      },
      {
        "const": "underlyingSymbol",
        "type": "string"
      },
      {
        "const": "ytdReturn",
        "type": "string"
      },
      {
        "const": "trailingThreeMonthReturns",
        "type": "string"
      },
      {
        "const": "trailingThreeMonthNavReturns",
        "type": "string"
      },
      {
        "const": "ipoExpectedDate",
        "type": "string"
      },
      {
        "const": "newListingDate",
        "type": "string"
      },
      {
        "const": "nameChangeDate",
        "type": "string"
      },
      {
        "const": "prevName",
        "type": "string"
      },
      {
        "const": "averageAnalystRating",
        "type": "string"
      },
      {
        "const": "pageViewGrowthWeekly",
        "type": "string"
      },
      {
        "const": "openInterest",
        "type": "string"
      },
      {
        "const": "beta",
        "type": "string"
      }
    ]
  },
  "path": "/fields/7",
  "value": "circulatingSupply",
  "message": "Expected union value"
}")
[yahooFinance] Invalid options ("{
  "type": 62,
  "schema": {
    "anyOf": [
      {
        "const": "language",
        "type": "string"
      },
      {
        "const": "region",
        "type": "string"
      },
      {
        "const": "quoteType",
        "type": "string"
      },
      {
        "const": "typeDisp",
        "type": "string"
      },
      {
        "const": "quoteSourceName",
        "type": "string"
      },
      {
        "const": "triggerable",
        "type": "string"
      },
      {
        "const": "currency",
        "type": "string"
      },
      {
        "const": "customPriceAlertConfidence",
        "type": "string"
      },
      {
        "const": "marketState",
        "type": "string"
      },
      {
        "const": "tradeable",
        "type": "string"
      },
      {
        "const": "cryptoTradeable",
        "type": "string"
      },
      {
        "const": "exchange",
        "type": "string"
      },
      {
        "const": "shortName",
        "type": "string"
      },
      {
        "const": "longName",
        "type": "string"
      },
      {
        "const": "messageBoardId",
        "type": "string"
      },
      {
        "const": "exchangeTimezoneName",
        "type": "string"
      },
      {
        "const": "exchangeTimezoneShortName",
        "type": "string"
      },
      {
        "const": "gmtOffSetMilliseconds",
        "type": "string"
      },
      {
        "const": "market",
        "type": "string"
      },
      {
        "const": "esgPopulated",
        "type": "string"
      },
      {
        "const": "fiftyTwoWeekLowChange",
        "type": "string"
      },
      {
        "const": "fiftyTwoWeekLowChangePercent",
        "type": "string"
      },
      {
        "const": "fiftyTwoWeekRange",
        "type": "string"
      },
      {
        "const": "fiftyTwoWeekHighChange",
        "type": "string"
      },
      {
        "const": "fiftyTwoWeekHighChangePercent",
        "type": "string"
      },
      {
        "const": "fiftyTwoWeekLow",
        "type": "string"
      },
      {
        "const": "fiftyTwoWeekHigh",
        "type": "string"
      },
      {
        "const": "fiftyTwoWeekChangePercent",
        "type": "string"
      },
      {
        "const": "dividendDate",
        "type": "string"
      },
      {
        "const": "earningsTimestamp",
        "type": "string"
      },
      {
        "const": "earningsTimestampStart",
        "type": "string"
      },
      {
        "const": "earningsTimestampEnd",
        "type": "string"
      },
      {
        "const": "trailingAnnualDividendRate",
        "type": "string"
      },
      {
        "const": "trailingPE",
        "type": "string"
      },
      {
        "const": "trailingAnnualDividendYield",
        "type": "string"
      },
      {
        "const": "epsTrailingTwelveMonths",
        "type": "string"
      },
      {
        "const": "epsForward",
        "type": "string"
      },
      {
        "const": "epsCurrentYear",
        "type": "string"
      },
      {
        "const": "priceEpsCurrentYear",
        "type": "string"
      },
      {
        "const": "sharesOutstanding",
        "type": "string"
      },
      {
        "const": "bookValue",
        "type": "string"
      },
      {
        "const": "fiftyDayAverage",
        "type": "string"
      },
      {
        "const": "fiftyDayAverageChange",
        "type": "string"
      },
      {
        "const": "fiftyDayAverageChangePercent",
        "type": "string"
      },
      {
        "const": "twoHundredDayAverage",
        "type": "string"
      },
      {
        "const": "twoHundredDayAverageChange",
        "type": "string"
      },
      {
        "const": "twoHundredDayAverageChangePercent",
        "type": "string"
      },
      {
        "const": "marketCap",
        "type": "string"
      },
      {
        "const": "forwardPE",
        "type": "string"
      },
      {
        "const": "priceToBook",
        "type": "string"
      },
      {
        "const": "sourceInterval",
        "type": "string"
      },
      {
        "const": "exchangeDataDelayedBy",
        "type": "string"
      },
      {
        "const": "firstTradeDateMilliseconds",
        "type": "string"
      },
      {
        "const": "priceHint",
        "type": "string"
      },
      {
        "const": "postMarketChangePercent",
        "type": "string"
      },
      {
        "const": "postMarketTime",
        "type": "string"
      },
      {
        "const": "postMarketPrice",
        "type": "string"
      },
      {
        "const": "postMarketChange",
        "type": "string"
      },
      {
        "const": "regularMarketChange",
        "type": "string"
      },
      {
        "const": "regularMarketChangePercent",
        "type": "string"
      },
      {
        "const": "regularMarketTime",
        "type": "string"
      },
      {
        "const": "regularMarketPrice",
        "type": "string"
      },
      {
        "const": "regularMarketDayHigh",
        "type": "string"
      },
      {
        "const": "regularMarketDayRange",
        "type": "string"
      },
      {
        "const": "regularMarketDayLow",
        "type": "string"
      },
      {
        "const": "regularMarketVolume",
        "type": "string"
      },
      {
        "const": "regularMarketPreviousClose",
        "type": "string"
      },
      {
        "const": "preMarketChange",
        "type": "string"
      },
      {
        "const": "preMarketChangePercent",
        "type": "string"
      },
      {
        "const": "preMarketTime",
        "type": "string"
      },
      {
        "const": "preMarketPrice",
        "type": "string"
      },
      {
        "const": "bid",
        "type": "string"
      },
      {
        "const": "ask",
        "type": "string"
      },
      {
        "const": "bidSize",
        "type": "string"
      },
      {
        "const": "askSize",
        "type": "string"
      },
      {
        "const": "fullExchangeName",
        "type": "string"
      },
      {
        "const": "financialCurrency",
        "type": "string"
      },
      {
        "const": "regularMarketOpen",
        "type": "string"
      },
      {
        "const": "averageDailyVolume3Month",
        "type": "string"
      },
      {
        "const": "averageDailyVolume10Day",
        "type": "string"
      },
      {
        "const": "displayName",
        "type": "string"
      },
      {
        "const": "symbol",
        "type": "string"
      },
      {
        "const": "underlyingSymbol",
        "type": "string"
      },
      {
        "const": "ytdReturn",
        "type": "string"
      },
      {
        "const": "trailingThreeMonthReturns",
        "type": "string"
      },
      {
        "const": "trailingThreeMonthNavReturns",
        "type": "string"
      },
      {
        "const": "ipoExpectedDate",
        "type": "string"
      },
      {
        "const": "newListingDate",
        "type": "string"
      },
      {
        "const": "nameChangeDate",
        "type": "string"
      },
      {
        "const": "prevName",
        "type": "string"
      },
      {
        "const": "averageAnalystRating",
        "type": "string"
      },
      {
        "const": "pageViewGrowthWeekly",
        "type": "string"
      },
      {
        "const": "openInterest",
        "type": "string"
      },
      {
        "const": "beta",
        "type": "string"
      }
    ]
  },
  "path": "/fields/4",
  "value": "circulatingSupply",
  "message": "Expected union value"
}")
  

Environment

Browser or Node: Node
Node version (if applicable): v20.17.0
Library version (e.g. 1.10.1): 2.12.4

Additional Context

when i remove the warning fields, i get different versions of the same error. fetch works when I don't use fields.

@Emre4x0 Emre4x0 added bug Something isn't working validation Issues related to validation labels Sep 24, 2024
@gadicc
Copy link
Owner

gadicc commented Sep 26, 2024

Hey @Emre4x0

Thanks for reporting, confirming the bug. Unfortunately this is an issue with the validation framework we use, and I'll need to prepare a proper bug report there. I hope I'll have a chance over the weekend, let's see.

In the meantime, I just wanted to check how much this bug affects you... i.e., do you still get the fields you need without using the fields option, or do any of those fields need to explicitly specified to get them?

Thanks!

@Emre4x0
Copy link
Author

Emre4x0 commented Sep 26, 2024

Hello, thank you for ur response. I can get the result I want without using fields. I was using fields to shorten my fetch time.

@Emre4x0 Emre4x0 closed this as completed Sep 26, 2024
@Emre4x0 Emre4x0 reopened this Sep 26, 2024
@Emre4x0
Copy link
Author

Emre4x0 commented Sep 26, 2024

I wish you luck with your work @gadicc. I look forward to the new update. 🤩

@gadicc
Copy link
Owner

gadicc commented Sep 26, 2024

Hey, thanks so much, @Emre4x0, appreciate your super quick response and kind words.

I'll leave this open so we can still track it. I'd also like to cleanup the error message A LOT 😅

Thanks again! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working validation Issues related to validation
Projects
None yet
Development

No branches or pull requests

2 participants