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

How to get historical data of last hour #77

Open
MehbubRashid opened this issue Mar 16, 2021 · 3 comments
Open

How to get historical data of last hour #77

MehbubRashid opened this issue Mar 16, 2021 · 3 comments

Comments

@MehbubRashid
Copy link

How can i get historical data of last hour?

@gadicc
Copy link
Collaborator

gadicc commented Mar 17, 2021

Not sure if this is possible, but keep an eye on #76.

Otherwise maybe through the chart data but we don't have an API for that (yet).

@jasonjason1207
Copy link

  1. Got a question while looking into the library. What is period "v"?
    if (!_.includes(['d', 'w', 'm', 'v'], options.period)) { throw new Error('"options.period" must be "d", "w", "m", or "v".'); }

d - day
w - week
m - month
v - what is v ?

  1. And, is there any way to indicate what currency the data is?

@gadicc
Copy link
Collaborator

gadicc commented Apr 19, 2021

@jasonjason1207 if you look a few lines further down you'll see:

  // Convert to yahoo v7 API
  switch (options.period) {
    case 'd': options.period = '1d'; break;
    case 'w': options.period = '1wk'; break;
    case 'm': options.period = '1mo'; break;
    case 'v': options.period = '1d'; options.events = 'div'; break;
    // No default case needed, options are sanitized above.
  }

So actually the 'v' option is from the previous Yahoo API but was kept for consistency so as to not introduce a breaking change into the current major version of node-yahoo-finance. It sets the period to 1d and requests that Dividend events be included in the history.

And, is there any way to indicate what currency the data is?

Not in the history request, but you can map this later to a quote request after.

If you're just starting off, check out https://github.com/gadicc/node-yahoo-finance2 which is the beta release of what will likely be our next major release. The quote API there is a little more developed and you can query all the symbols in a single network request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants