SimFin / simfin

Simple financial data for Python
https://simfin.com/
Other
298 stars 39 forks source link

Dataset "us-income-ttm" not on disk. #15

Closed DextyGummy closed 1 year ago

DextyGummy commented 1 year ago

Bug Report

Please make sure you have the latest simfin package installed by running:

pip install --upgrade simfin

And make sure you have downloaded fresh data-files from the SimFin server by setting refresh_days=0 (see example below).

If you still cannot solve the problem and need our help, then please provide the following.

Description

I am getting error message Dataset "us-income-ttm" not on disk. when attempting to download data into colab notebook. I also get this error message when running tutorials that have the same code as mine. This did not happen with the previous version. I was able to down signal dataset prior to Feb 22, 2023 update. I have the latest version 0.9.0.

System Details

Code Example

Import the main functionality from the SimFin Python API.

import simfin as sf

Import names used for easy access to SimFin's data-columns.

from simfin.names import *

import seaborn as sns

# Configure simfin.
sf.set_data_dir('~/simfin_data/')
sf.load_api_key(path='~/simfin_api_key.txt', default_key='free')

# Interested in the US stock-market.
market = 'us'

offset = pd.DateOffset(days=60)

Refresh the fundamental datasets (Income Statements etc.)

every 30 days.

refresh_days = 30

# Refresh the dataset with shareprices every 10 days.
 refresh_days_shareprices = 10

%%time
hub = sf.StockHub(market=market, tickers=tickers, offset=offset,
              refresh_days=refresh_days,
              refresh_days_shareprices=refresh_days_shareprices)

try to download data using StockHub Object

 %%time
 df_fin_signals = hub.fin_signals(variant='daily')

also tried same code from SimFin tutorial https://github.com/SimFin/simfin-tutorials/blob/master/05_Data_Hubs.ipynb but get #similar error message

Result / Error

Dataset "us-income-ttm" not on disk.

HTTPError Traceback (most recent call last)

in [/usr/local/lib/python3.8/dist-packages/simfin/hubs.py](https://localhost:8080/#) in fin_signals(self, variant, func) 619 # This is only really necessary if the cache-file needs refreshing, 620 # but it is easier to program like this and the overhead is small. --> 621 df_income_ttm = self.load_income(variant='ttm') 622 df_balance_ttm = self.load_balance(variant='ttm') 623 df_cashflow_ttm = self.load_cashflow(variant='ttm') 5 frames [/usr/local/lib/python3.8/dist-packages/requests/models.py](https://localhost:8080/#) in raise_for_status(self) 941 942 if http_error_msg: --> 943 raise HTTPError(http_error_msg, response=self) 944 945 def close(self): HTTPError: 401 Client Error: Unauthorized for url: https://backend.simfin.com/api/bulk-download?dataset=income&variant=ttm&market=us
thf24 commented 1 year ago

If you are getting a 401 error it means that there is something wrong with your API-key.

For me the code is running fine.

Can you try instead of sf.load_api_key the following (probably the file with the api-key is not found): sf.set_api_key(api_key='YOUR_KEY')

DextyGummy commented 1 year ago

Hi Thomas,

Thank you, I did use my own API key but I still get the error. I will check the SimFin support page.

Thanks, Eliana Velazquez

On Tue, Mar 7, 2023 at 6:25 AM Thomas Flassbeck @.***> wrote:

If you are getting a 401 error it means that there is something wrong with your API-key.

For me the code is running fine.

Can you try instead of sf.load_api_key the following (probably the file with the api-key is not found): sf.set_api_key(api_key='YOUR_KEY')

— Reply to this email directly, view it on GitHub https://github.com/SimFin/simfin/issues/15#issuecomment-1458264630, or unsubscribe https://github.com/notifications/unsubscribe-auth/A57HNHW4J4NSZY3GX4AED5DW25AMTANCNFSM6AAAAAAVR375IE . You are receiving this because you authored the thread.Message ID: @.***>

thf24 commented 1 year ago

E-mail was not confirmed - if your e-mail is not confirmed in our system the API calls won't work. We will add a notice to the website if that should be the case.