gadicc / node-yahoo-finance2

Unofficial API for Yahoo Finance
https://www.npmjs.com/package/yahoo-finance2
MIT License
378 stars 62 forks source link

There is an error in the API that retrieves SEC submissions.(Failed validation: #/definitions/QuoteSummaryResult) #646

Closed givinkwon closed 1 year ago

givinkwon commented 1 year ago

Validation Error


const symbol = ['AAPL']
for (let element of symbol) {
    const queryOptions = { period1: '2021-02-01', /* ... */ };
    const result = await yahooFinance.quoteSummary('AAPL', { modules: [ "secFilings" ] });
}

Minimal Reproduction

await yahooFinance.quoteSummary('AAPL', { modules: [ "secFilings" ] })

Symbol(s) that it happened for

Error Message

[
  {
    instancePath: '/secFilings/filings/3/type',
    schemaPath: '#/definitions/Type/enum',
    keyword: 'enum',
    params: {
      allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
    },
    message: 'must be equal to one of the allowed values',
    data: 'SD'
  },
  {
    instancePath: '/secFilings/filings/5/type',
    schemaPath: '#/definitions/Type/enum',
    keyword: 'enum',
    params: {
      allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
    },
    message: 'must be equal to one of the allowed values',
    data: 'PX14A6G'
  },
  {
    instancePath: '/secFilings/filings/6/type',
    schemaPath: '#/definitions/Type/enum',
    keyword: 'enum',
    params: {
      allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
    },
    message: 'must be equal to one of the allowed values',
    data: 'SC 13G/A'
  },
  {
    instancePath: '/secFilings/filings/7/type',
    schemaPath: '#/definitions/Type/enum',
    keyword: 'enum',
    params: {
      allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
    },
    message: 'must be equal to one of the allowed values',
    data: 'SC 13G/A'
  },
  {
    instancePath: '/secFilings/filings/8/type',
    schemaPath: '#/definitions/Type/enum',
    keyword: 'enum',
    params: {
      allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
    },
    message: 'must be equal to one of the allowed values',
    data: 'SC 13G/A'
  },
  {
    instancePath: '/secFilings/filings/9/type',
    schemaPath: '#/definitions/Type/enum',
    keyword: 'enum',
    params: {
      allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
    },
    message: 'must be equal to one of the allowed values',
    data: 'DEFA14A'
  },
  {
    instancePath: '/secFilings/filings/11/type',
    schemaPath: '#/definitions/Type/enum',
    keyword: 'enum',
    params: {
      allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
    },
    message: 'must be equal to one of the allowed values',
    data: 'PX14A6G'
  },
  {
    instancePath: '/secFilings/filings/12/type',
    schemaPath: '#/definitions/Type/enum',
    keyword: 'enum',
    params: {
      allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
    },
    message: 'must be equal to one of the allowed values',
    data: 'DEFA14A'
  },
  {
    instancePath: '/secFilings/filings/13/type',
    schemaPath: '#/definitions/Type/enum',
    keyword: 'enum',
    params: {
      allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
    },
    message: 'must be equal to one of the allowed values',
    data: '25-NSE'
  },
  {
    instancePath: '/secFilings/filings/24/type',
    schemaPath: '#/definitions/Type/enum',
    keyword: 'enum',
    params: {
      allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
    },
    message: 'must be equal to one of the allowed values',
    data: 'PX14A6G'
  },
  {
    instancePath: '/secFilings/filings/25/type',
    schemaPath: '#/definitions/Type/enum',
    keyword: 'enum',
    params: {
      allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
    },
    message: 'must be equal to one of the allowed values',
    data: 'PX14A6G'
  }
]

This may happen intermittently and you should catch errors appropriately.
However:  1) if this recently started happening on every request for a symbol
that used to work, Yahoo may have changed their API.  2) If this happens on
every request for a symbol you've never used before, but not for other
symbols, you've found an edge-case (OR, we may just be protecting you from
"bad" data sometimes stored for e.g. misspelt symbols on Yahoo's side).
Please see if anyone has reported this previously:

  https://github.com/gadicc/node-yahoo-finance2/issues?q=is%3Aissue+Failed%20validation%3A%20%23%2Fdefinitions%2FQuoteSummaryResult

or open a new issue (and mention the symbol):  yahoo-finance2 v2.4.1

  https://github.com/gadicc/node-yahoo-finance2/issues/new?labels=bug%2C+validation&template=validation.md&title=Failed%20validation%3A%20%23%2Fdefinitions%2FQuoteSummaryResult

For information on how to turn off the above logging or skip these errors,
see https://github.com/gadicc/node-yahoo-finance2/tree/devel/docs/validation.md.

file:///Users/x76j9kxcd4j/Documents/GitHub/chosun-webull/functions/node_modules/yahoo-finance2/dist/esm/src/lib/validateAndCoerceTypes.js:290
        throw new FailedYahooValidationError("Failed Yahoo Schema validation", {
              ^

FailedYahooValidationError: Failed Yahoo Schema validation
    at validate (file:///Users/x76j9kxcd4j/Documents/GitHub/chosun-webull/functions/node_modules/yahoo-finance2/dist/esm/src/lib/validateAndCoerceTypes.js:290:15)
    at Object.moduleExec [as _moduleExec] (file:///Users/x76j9kxcd4j/Documents/GitHub/chosun-webull/functions/node_modules/yahoo-finance2/dist/esm/src/lib/moduleExec.js:87:9)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async file:///Users/x76j9kxcd4j/Documents/GitHub/chosun-webull/functions/src/utils/test.mjs:14:20 {
  result: {
    secFilings: {
      filings: [
        {
          date: '2023-05-10',
          epochDate: 2023-05-10T00:00:00.000Z,
          type: '8-K',
          title: 'Corporate Changes & Voting Matters',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0001140361-23-023909_320193',
          exhibits: [ [Object], [Object], [Object], [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2023-05-05',
          epochDate: 2023-05-05T00:00:00.000Z,
          type: '10-Q',
          title: 'Periodic Financial Reports',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0000320193-23-000064_320193',
          exhibits: [ [Object], [Object], [Object], [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2023-05-04',
          epochDate: 2023-05-04T00:00:00.000Z,
          type: '8-K',
          title: 'Corporate Changes & Voting Matters',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0000320193-23-000063_320193',
          exhibits: [ [Object], [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2023-03-16',
          epochDate: 2023-03-16T00:00:00.000Z,
          type: 'SD',
          title: 'Specialized Disclosure Report filed pursuant to Section 1502 of the Dodd-Frank Wall Street Reform and Consumer Protection Act relating to the use of conflict minerals (Rule 13p-1)',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0001140361-23-012065_320193',
          exhibits: [ [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2023-03-10',
          epochDate: 2023-03-10T00:00:00.000Z,
          type: '8-K',
          title: 'Corporate Changes & Voting Matters',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0001140361-23-011192_320193',
          exhibits: [ [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2023-02-22',
          epochDate: 2023-02-22T00:00:00.000Z,
          type: 'PX14A6G',
          title: 'Notice of exempt solicitation',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0001096906-23-000438_320193',
          exhibits: [ [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2023-02-14',
          epochDate: 2023-02-14T00:00:00.000Z,
          type: 'SC 13G/A',
          title: 'Tender Offer/Acquisition Reports',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0001193125-23-038262_320193',
          exhibits: [
            [Object],
            [Object],
            [Object],
            [Object],
            [Object],
            [Object]
          ],
          maxAge: 1
        },
        {
          date: '2023-02-09',
          epochDate: 2023-02-09T00:00:00.000Z,
          type: 'SC 13G/A',
          title: 'Tender Offer/Acquisition Reports',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0001104659-23-015055_320193',
          exhibits: [ [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2023-02-07',
          epochDate: 2023-02-07T00:00:00.000Z,
          type: 'SC 13G/A',
          title: 'Tender Offer/Acquisition Reports',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0001306550-23-008266_320193',
          exhibits: [ [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2023-02-03',
          epochDate: 2023-02-03T00:00:00.000Z,
          type: 'DEFA14A',
          title: 'Proxy Statements',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0001140361-23-004439_320193',
          exhibits: [ [Object] ],
          maxAge: 1
        },
        {
          date: '2023-02-02',
          epochDate: 2023-02-02T00:00:00.000Z,
          type: '8-K',
          title: 'Corporate Changes & Voting Matters',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0000320193-23-000005_320193',
          exhibits: [ [Object], [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2023-01-30',
          epochDate: 2023-01-30T00:00:00.000Z,
          type: 'PX14A6G',
          title: 'Notice of exempt solicitation',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0001214659-23-001246_320193',
          exhibits: [ [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2023-01-12',
          epochDate: 2023-01-12T00:00:00.000Z,
          type: 'DEFA14A',
          title: 'Proxy Statements',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0001308179-23-000020_320193',
          exhibits: [ [Object] ],
          maxAge: 1
        },
        {
          date: '2022-11-09',
          epochDate: 2022-11-09T00:00:00.000Z,
          type: '25-NSE',
          title: 'Notification filed by national security exchange to report the removal from listing and registration of matured',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0001354457-22-000638_320193',
          exhibits: [ [Object], [Object], [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2022-11-07',
          epochDate: 2022-11-07T00:00:00.000Z,
          type: '8-K',
          title: 'Corporate Changes & Voting Matters',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0001193125-22-278435_320193',
          exhibits: [ [Object], [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2022-10-28',
          epochDate: 2022-10-28T00:00:00.000Z,
          type: '10-K',
          title: 'Periodic Financial Reports',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0000320193-22-000108_320193',
          exhibits: [
            [Object], [Object],
            [Object], [Object],
            [Object], [Object],
            [Object], [Object]
          ],
          maxAge: 1
        },
        {
          date: '2022-10-27',
          epochDate: 2022-10-27T00:00:00.000Z,
          type: '8-K',
          title: 'Corporate Changes & Voting Matters',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0000320193-22-000107_320193',
          exhibits: [ [Object], [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2022-08-19',
          epochDate: 2022-08-19T00:00:00.000Z,
          type: '8-K',
          title: 'Corporate Changes & Voting Matters',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0001193125-22-225365_320193',
          exhibits: [ [Object], [Object], [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2022-08-08',
          epochDate: 2022-08-08T00:00:00.000Z,
          type: '8-K',
          title: 'Corporate Changes & Voting Matters',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0001193125-22-214914_320193',
          exhibits: [ [Object], [Object], [Object], [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2022-07-29',
          epochDate: 2022-07-29T00:00:00.000Z,
          type: '10-Q',
          title: 'Periodic Financial Reports',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0000320193-22-000070_320193',
          exhibits: [ [Object], [Object], [Object], [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2022-07-28',
          epochDate: 2022-07-28T00:00:00.000Z,
          type: '8-K',
          title: 'Corporate Changes & Voting Matters',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0000320193-22-000069_320193',
          exhibits: [ [Object], [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2022-04-29',
          epochDate: 2022-04-29T00:00:00.000Z,
          type: '10-Q',
          title: 'Periodic Financial Reports',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0000320193-22-000059_320193',
          exhibits: [ [Object], [Object], [Object], [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2022-04-28',
          epochDate: 2022-04-28T00:00:00.000Z,
          type: '8-K',
          title: 'Corporate Changes & Voting Matters',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0000320193-22-000058_320193',
          exhibits: [ [Object], [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2022-03-04',
          epochDate: 2022-03-04T00:00:00.000Z,
          type: '8-K',
          title: 'Corporate Changes & Voting Matters',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0001193125-22-066169_320193',
          exhibits: [ [Object], [Object], [Object], [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2022-02-09',
          epochDate: 2022-02-09T00:00:00.000Z,
          type: 'PX14A6G',
          title: 'Notice of exempt solicitation',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0001214659-22-002092_320193',
          exhibits: [ [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2022-02-01',
          epochDate: 2022-02-01T00:00:00.000Z,
          type: 'PX14A6G',
          title: 'Notice of exempt solicitation',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0001214659-22-001589_320193',
          exhibits: [ [Object], [Object] ],
          maxAge: 1
        },
        {
          date: '2022-01-28',
          epochDate: 2022-01-28T00:00:00.000Z,
          type: '10-Q',
          title: 'Periodic Financial Reports',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0000320193-22-000007_320193',
          exhibits: [
            [Object], [Object],
            [Object], [Object],
            [Object], [Object],
            [Object], [Object],
            [Object], [Object],
            [Object]
          ],
          maxAge: 1
        },
        {
          date: '2022-01-27',
          epochDate: 2022-01-27T00:00:00.000Z,
          type: '8-K',
          title: 'Corporate Changes & Voting Matters',
          edgarUrl: 'https://finance.yahoo.com/sec-filing/AAPL/0000320193-22-000006_320193',
          exhibits: [ [Object], [Object], [Object], [Object], [Object] ],
          maxAge: 1
        }
      ],
      maxAge: 86400
    }
  },
  errors: [
    {
      instancePath: '/secFilings/filings/3/type',
      schemaPath: '#/definitions/Type/enum',
      keyword: 'enum',
      params: {
        allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
      },
      message: 'must be equal to one of the allowed values',
      data: 'SD'
    },
    {
      instancePath: '/secFilings/filings/5/type',
      schemaPath: '#/definitions/Type/enum',
      keyword: 'enum',
      params: {
        allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
      },
      message: 'must be equal to one of the allowed values',
      data: 'PX14A6G'
    },
    {
      instancePath: '/secFilings/filings/6/type',
      schemaPath: '#/definitions/Type/enum',
      keyword: 'enum',
      params: {
        allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
      },
      message: 'must be equal to one of the allowed values',
      data: 'SC 13G/A'
    },
    {
      instancePath: '/secFilings/filings/7/type',
      schemaPath: '#/definitions/Type/enum',
      keyword: 'enum',
      params: {
        allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
      },
      message: 'must be equal to one of the allowed values',
      data: 'SC 13G/A'
    },
    {
      instancePath: '/secFilings/filings/8/type',
      schemaPath: '#/definitions/Type/enum',
      keyword: 'enum',
      params: {
        allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
      },
      message: 'must be equal to one of the allowed values',
      data: 'SC 13G/A'
    },
    {
      instancePath: '/secFilings/filings/9/type',
      schemaPath: '#/definitions/Type/enum',
      keyword: 'enum',
      params: {
        allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
      },
      message: 'must be equal to one of the allowed values',
      data: 'DEFA14A'
    },
    {
      instancePath: '/secFilings/filings/11/type',
      schemaPath: '#/definitions/Type/enum',
      keyword: 'enum',
      params: {
        allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
      },
      message: 'must be equal to one of the allowed values',
      data: 'PX14A6G'
    },
    {
      instancePath: '/secFilings/filings/12/type',
      schemaPath: '#/definitions/Type/enum',
      keyword: 'enum',
      params: {
        allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
      },
      message: 'must be equal to one of the allowed values',
      data: 'DEFA14A'
    },
    {
      instancePath: '/secFilings/filings/13/type',
      schemaPath: '#/definitions/Type/enum',
      keyword: 'enum',
      params: {
        allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
      },
      message: 'must be equal to one of the allowed values',
      data: '25-NSE'
    },
    {
      instancePath: '/secFilings/filings/24/type',
      schemaPath: '#/definitions/Type/enum',
      keyword: 'enum',
      params: {
        allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
      },
      message: 'must be equal to one of the allowed values',
      data: 'PX14A6G'
    },
    {
      instancePath: '/secFilings/filings/25/type',
      schemaPath: '#/definitions/Type/enum',
      keyword: 'enum',
      params: {
        allowedValues: [ '10-K', '10-Q', '8-K', '8-K/A', '10-K/A', '10-Q/A' ]
      },
      message: 'must be equal to one of the allowed values',
      data: 'PX14A6G'
    }
  ]
}

Environment

Browser or Node: Node version (if applicable): v16.15.1 Npm version: 8.11.0 Browser verion (if applicable): local Test Library version (e.g. 1.10.1): 2.4.1

Additional Context

/// validateAndCoerceTypes
function validate({ source, type, object, schemaKey, options, }) {
    const validator = ajv.getSchema(schemaKey);
    if (!validator)
        throw new Error("No such schema with key: " + schemaKey);
    const valid = validator(object);
    if (valid)
        return;
    if (type === "result") {
        /* istanbul ignore else */
        if (validator.errors) {
            let origData = false;
            validator.errors.forEach((error) => {
                // For now let's ignore the base object which could be huge.
                /* istanbul ignore else */
                if (error.instancePath !== "")
                    // Note, not the regular ajv data value from verbose:true
                    error.data = resolvePath(object, error.instancePath);
                if (error.schemaPath === "#/anyOf") {
                    if (origData === false) {
                        origData = error.data;
                    }
                    else if (origData === error.data) {
                        error.data = "[shortened by validateAndCoerceTypes]";
                    }
                }
            });
            // Becaue of the "anyOf" in quote, errors are huuuuge and mostly
            // irrelevant... so let's filter out (some of) the latter
            validator.errors = validator.errors.filter((error) => {
                var _a, _b;
                if (error.schemaPath.startsWith("#/definitions/Quote")) {
                    const schemaQuoteType = error.schemaPath
                        .substring(19)
                        .split("/")[0]
                        .toUpperCase();
                    /*
                     * Filter out entries for non-matching schema type, i.e.
                     * {
                     *   schemaPath: '#/definitions/QuoteCryptoCurrency/properties...'
                     *   data: {
                     *     quoteType: "EQUITY"
                     *   }
                     * }
                     */
                    if (typeof error.data === "object" &&
                        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
                        // @ts-ignore: Properrty "quoteType" does not exist on type "object"
                        ((_a = error.data) === null || _a === void 0 ? void 0 : _a.quoteType) !== schemaQuoteType)
                        return false;
                    /*
                     * Filter out the non-matching "const" for the above.
                     * {
                     *   schemaPath: '#/definitions/QuoteCryptoCurrency/properties/quoteType/const'
                     *   keyword: "const",
                     *   params: { allowedValue: "CRYPTOCURRENCY"}},
                     *   data: "EQUITY"
                     * }
                     */
                    if (typeof error.data === "string" &&
                        ((_b = error.params) === null || _b === void 0 ? void 0 : _b.allowedValue) === schemaQuoteType)
                        return false;
                }
                return true;
            });
            // In the case of there being NO match in #anyOf, bring back the data
            if (validator.errors.length === 1 &&
                validator.errors[0].schemaPath === "#/anyOf")
                validator.errors[0].data = origData;
        }
        if (options.logErrors === true) {
            const title = encodeURIComponent("Failed validation: " + schemaKey);
            console.log("The following result did not validate with schema: " + schemaKey);
            logObj(validator.errors);
            // logObj(object);
            console.log(`
This may happen intermittently and you should catch errors appropriately.
However:  1) if this recently started happening on every request for a symbol
that used to work, Yahoo may have changed their API.  2) If this happens on
every request for a symbol you've never used before, but not for other
symbols, you've found an edge-case (OR, we may just be protecting you from
"bad" data sometimes stored for e.g. misspelt symbols on Yahoo's side).
Please see if anyone has reported this previously:

  ${pkg.repository}/issues?q=is%3Aissue+${title}

or open a new issue (and mention the symbol):  ${pkg.name} v${pkg.version}

  ${pkg.repository}/issues/new?labels=bug%2C+validation&template=validation.md&title=${title}

For information on how to turn off the above logging or skip these errors,
see https://github.com/gadicc/node-yahoo-finance2/tree/devel/docs/validation.md.
`);
        } /* if (logErrors) */
        throw new FailedYahooValidationError("Failed Yahoo Schema validation", {
            result: object,
            errors: validator.errors,
        });
    } /* if (type === 'options') */
    else {
        if (options.logOptionsErrors === true) {
            console.error(`[yahooFinance.${source}] Invalid options ("${schemaKey}")`);
            logObj({ errors: validator.errors, input: object });
        }
        throw new InvalidOptionsError(`yahooFinance.${source} called with invalid options.`);
    }
}

Despite the object returning valid data, there is an error within the object preventing the proper retrieval of results.

gadicc commented 1 year ago

Thanks for reporting @givinkwon, and for your patience. This is now fixed and will be in the next release, there'll be an automated message here when it's published.

gadicc commented 1 year ago

:tada: This issue has been resolved in version 2.4.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket: