finnhubio / Finnhub-API

Finnhub API provides institutional-grade financial data to investors, fintech startups and investment firms. We support real-time stock price, global fundamentals and alternative data. https://finnhub.io/docs/api
97 stars 6 forks source link

Forex candle time #140

Open hypo-thesis opened 4 years ago

hypo-thesis commented 4 years ago

So as the example suggests

request('https://finnhub.io/api/v1/forex/candle?symbol=OANDA:EUR_USD&resolution=D&from=1572651390&to=1575243390&token=mytoken', { json: true }, (err, res, body) => { if (err) { return console.log(err); } console.log(body.url); console.log(body.explanation); });

Returns the results. upon changing the Unix time stamps I receive NULL

the above code was executed with 1586103635representing 5th of April and 1586709080 representing today 12th of April. which resulted into [1.08538, 1.09283, 1.0935700000000002] so basically a query of 7 days came back as an array of 3. The day before 4th of April with time stamp of 1586017880 comes back as an array of 5.

Can you elaborate a little more on how this time frame works and what countis ? I do not see count in the sample as well.

finnhubio commented 4 years ago

What's your question exactly ?

jordan-tiona commented 4 years ago

It should be noted that between April 5th and April 12th there were only four market days. The market is closed on the weekend and it was closed for Good Friday as well. count would be the number of candles rather than using to. So https://finnhub.io/api/v1/forex/candle?symbol=OANDA:EUR_USD&resolution=D&from=1572651390&count=5&token=mytoken would (if I'm doing that correctly) give you the five candles after April 5th, which again would skip Good Friday and would give you April 14th instead.

ghost commented 4 years ago

count [optional] Shortcut to set to=Unix.Now and from=Unix.Now - count * resolution_second.