Open kkh3868 opened 3 weeks ago
quote
returns an object, Seems like you are trying to parseFloat
that object instead of the current price.
The current price would be the regularMarketPrice
You need to do something like this:
const quote = await yf2.quote(stock.symbol)
const currentPrice = quote?.regularMarketPrice
See https://github.com/gadicc/node-yahoo-finance2/blob/devel/docs/modules/quote.md
@glaucoheitor thanks for your help! it really works!!
Bug Report
Describe the bug
the result is.....
memberId : 1 Symbol: AAPL, Quantity: 14 Please consider completing the survey at https://bit.ly/yahoo-finance-api-feedback if you haven't already; for more info see https://github.com/gadicc/node-yahoo-finance2/issues/764#issuecomment-2056623851. Fetching crumb and cookies from https://finance.yahoo.com/quote/AAPL... We expected a redirect to guce.yahoo.com, but got https://finance.yahoo.com/quote/AAPL/ We'll try to continue anyway - you can safely ignore this if the request succeeds Success. Cookie expires on Sun Jun 08 2025 04:55:29 GMT+0900 (대한민국 표준시) fetch https://query1.finance.yahoo.com/v1/test/getcrumb New crumb: X2Q5c9WZbWY quote : NaN Symbol: TSLA, Quantity: 15 quote : NaN Symbol: ALI=F, Quantity: 1 quote : NaN Symbol: NVDA, Quantity: 6 quote : NaN
Minimal Reproduction
this yahoofinance.quote function occurs crumb error
Environment
Browser or Node: Node version (if applicable): v20.11.1 Npm version: 10.8.1 Browser verion (if applicable): chrome 125.0.6422.142 Library version (e.g.
1.10.1
): 2.11.3Additional Context