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

Not access to Finnhub resource #58

Open
yy824 opened this issue Jul 2, 2024 · 1 comment
Open

Not access to Finnhub resource #58

yy824 opened this issue Jul 2, 2024 · 1 comment

Comments

@yy824
Copy link

yy824 commented Jul 2, 2024

Hi, dear all,

I am a new learner of Finnhub who is trying to do some basic work with Finnhub.

Finnhub-python version: 2.24.20.

Here is the code. API-key I have stored in .env with FINNHUB_KEY=xxxxxxxxxxxxxxxxxxxxxx

from decouple import config
import finnhub
import json
import pandas as pd
from pprint import pprint
import requests

-# Get the tokens for API access
api_key = config("FINNHUB_KEY")

-# Specify params
symbol = 'IBM'
interval = 'D'
start_date = 1609455600 #2021-01-01
end_date = 1612047600 #2021-01-31

-# Specify endpoints
base_url = 'https://finnhub.io/api/v1'
endpoint = '/stock/candle?'
query = f'symbol={symbol}&resolution={interval}&from={start_date}&to={end_date}&token={api_key}'

-# Get request
response = requests.get(base_url + endpoint + query)
pprint(response.json())

-# Convert to DataFrame
data = pd.DataFrame.from_records(response.json())
data['t'] = pd.to_datetime(data['t'], unit='s')
print(data.head())

Error:
{'error': "You don't have access to this resource."}

Could someone help me on this point?

@SomwareHR
Copy link

Same here. I have a free account and am not nowhere near the limits (https://finnhub.io/docs/api/rate-limit), so probably 95% of data is not available to free accounts, just like any other "free" financial API.

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

2 participants