gadicc / node-yahoo-finance2

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

Quote: unsupported quoteType "ECNQUOTE" #464

Open apteryxxyz opened 2 years ago

apteryxxyz commented 2 years ago

Validation Error

Minimal Reproduction

yahooFinance.quote('NZ')

Symbol(s) that it happened for

Error Message

The following result did not validate with schema: #/definitions/QuoteResponseArray
[
  {
    instancePath: '/0',
    schemaPath: '#/anyOf',
    keyword: 'anyOf',
    params: {},
    message: 'must match a schema in anyOf',
    data: '[shortened by validateAndCoerceTypes]'
  }
]

Environment

Browser or Node: node Node version (if applicable): v17.5.0 Npm version: v8.4.1 Browser verion (if applicable): Library version (e.g. 1.10.1): v2.3.3

Additional Context

Not sure what this error/warning means, just asks to make an issue.

gadicc commented 2 years ago

Hey @apteryxxyz, thanks for reporting. First time I've seen:

{
      quoteType: 'ECNQUOTE',
      typeDisp: 'ECNQUOTE',
}

What exactly is this symbol? Can you see info about it on Yahoo's web interface? I tried to search for it but it's not found (but yes, obviously I understand that quote is returning data about it).

apteryxxyz commented 2 years ago

What exactly is this symbol?

I have no idea, I made a route in one of my projects API which utilitises this module, and I was testing it trying to break it. 'NZ' happened to log a message to my console.

gadicc commented 2 years ago

Ok, thanks. I'm going to see what else I can find out about this kind of quoteType and how we want to support it.

WudsyWudsyWudsy commented 1 year ago

Can also add the ticker symbol NIK to this list. This isn't a ticker symbol I know from anything, it was a typo of NKE.

The Yahoo web interface doesn't not recognise the ticker symbol, however, for some reason the API is responding with data under this ECNQUOTE quoteType.

ECNQUOTE is very strange, there is no current price but a historic price range. tradeable is also false in both the case of NIK and NZ. (Edit: this is true for many equities too, so this is not significant). Both have "fullExchangeName": "NasdaqGS" and "exchange": "NMS" (could be National Market System?).

ECN may stand for 'electronic communication network', but I am really stretching it here.

Request: https://query1.finance.yahoo.com/v7/finance/quote?symbols=NIK

Response data:

{
    "quoteResponse": {
        "result": [
            {
                "language": "en-US",
                "region": "US",
                "quoteType": "ECNQUOTE",
                "typeDisp": "ECNQUOTE",
                "quoteSourceName": "Delayed Quote",
                "triggerable": true,
                "customPriceAlertConfidence": "HIGH",
                "exchange": "NMS",
                "exchangeTimezoneName": "America/New_York",
                "exchangeTimezoneShortName": "EDT",
                "gmtOffSetMilliseconds": -14400000,
                "market": "us_market",
                "esgPopulated": false,
                "marketState": "PRE",
                "firstTradeDateMilliseconds": 839511000000,
                "priceHint": 2,
                "fullExchangeName": "NasdaqGS",
                "averageDailyVolume3Month": 29000,
                "averageDailyVolume10Day": 29000,
                "fiftyTwoWeekRange": "0.18 - 0.19",
                "fiftyTwoWeekLow": 0.18,
                "fiftyTwoWeekHigh": 0.19,
                "fiftyDayAverage": 0.19,
                "twoHundredDayAverage": 0.19,
                "sourceInterval": 15,
                "exchangeDataDelayedBy": 0,
                "tradeable": false,
                "cryptoTradeable": false,
                "symbol": "NIK"
            }
        ],
        "error": null
    }
}