Comments (9)
What FinancialModelingPrep are you on? I've built in a wait timer when you reach your rate limit per minute. E.g. the Starter plan has a limit of 250 per minute. Most likely you've hit that and then when you try to run for a few companies straight after it waits again.
The downside of collecting data from FMP for historical data is that I do two API calls per company given that I obtain both the market data and dividends. I can build in an argument for that as well to exclude dividends if desired.
To overcome this, you'd have to upgrade your plan sadly. If this doesn't seem to be the issue please let me know and provide all the errors you get!
By the way, I am aware Yahoo Finance also has the historical data but you will get rate limited just as quickly with them which requires a much longer wait time once you do.
PS: I can make this more obvious by providing a print statement. Does that make sense to you?
EDIT: For thousands of companies, you are stretching the limit of my package. I suggest dividing it up in groups but do provide me with the errors you get!
from financetoolkit.
Hi @cianryan09, this issue should now be resolved with the release of v1.6.1 which will automatically disable the wait timer that you are having issues with in this case. See: https://github.com/JerBouma/FinanceToolkit/releases/tag/v1.6.3
Please let me know if this doesn't solve the issue.
from financetoolkit.
Thank you Jeroen for the reply and apologies for the delay in getting back to your original response. I am currently on the free plan just to see what it's like. Does 1 stock = 1 call to the API or do all stocks in the 'tickers' variable count as one call? E.g. if I have 250 tickers in the ticker list and run Toolkit, does that exhaust my calls for the day?
I also updated to 1.6.3 and it did not seem to result in any speed improvements but that may just be purely due to the call limits described above.
from financetoolkit.
Let's say you input TSLA, AAPL and MSFT into the Toolkit. Every time you call a function that collects data, it will costs about 3 API calls. So for balance sheets, income statements, cash flow statements, historical data and more. So for example if you call Balance + Income + Cash Flow that's 9 API calls.
I don't fully understand how it takes so long for you to collect data as it should be almost instantly. For example I am using a Free key here and it takes less than 3 seconds. Could you elaborate further?
![image](https://private-user-images.githubusercontent.com/46355364/287814474-724ef7b0-5854-4f25-b519-0ee98ba1aa08.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE4MjQ0ODYsIm5iZiI6MTcyMTgyNDE4NiwicGF0aCI6Ii80NjM1NTM2NC8yODc4MTQ0NzQtNzI0ZWY3YjAtNTg1NC00ZjI1LWI1MTktMGVlOThiYTFhYTA4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzI0VDEyMjk0NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTY1NjFiNzM1NjQ0MTlmMmJjOGJhZDE5N2YyY2NhNGVhN2EzZmNhMjUwZGI2ODE4NzY3MzRlZDQyZmQyZGFmZDgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Hy_TyjMaQUE2-OTTXeDVvCRvNWYGneaILO7QqwYfZok)
from financetoolkit.
good to know, thanks. This is the code I have run and I timed it:
(The date is just today's date five years ago)
so the same three stocks are taking me nearly 9 seconds.
Is it possibly to do with how my environment is set up?
I set up a new conda environment with python 3.10 and pip installed financetoolkit. I am running the above a script from a file saved locally on VS code. Not really a coding expert so excuse me if the question is basic or off-topic.
EDIT: it also seems the API limit on the free plan is 250 / DAY and not minute, which probably explains the crashes happening with the tickers list gets into the hundreds
from financetoolkit.
Does it change anything if you define the start_time
right before the hist_data
? I can't imagine it being that long. The environment you are using is fine, it shouldn't be an issue there.
The API limit should not be an issue as I've made sure that once you hit the limit it will just tell you no data could be collected instead of giving you errors or letting you wait.
from financetoolkit.
I tried the above but it made almost no difference. I also upgraded to one of the paid plans and still no speed improvement. And its nothing else in my script causing the slowdown - if I comment out the .get_historical()
line it drops to 2 seconds.
It's hardly a hardware issue? Maybe all the threading uses a lot of memory/CPU that my older equipment can't handle?
from financetoolkit.
Hi! I am expecting this to be a hardware issue or networking issue. What you can try is using Google Colab which already cuts it down to 5 seconds. For other components this can be as little as 2-3 seconds in Google Colab. If it doesn't for you, then its 100% a network issue.
![image](https://private-user-images.githubusercontent.com/46355364/288000960-6aa15d41-ec1d-41fa-b429-7786ed5c3ca1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE4MjQ0ODYsIm5iZiI6MTcyMTgyNDE4NiwicGF0aCI6Ii80NjM1NTM2NC8yODgwMDA5NjAtNmFhMTVkNDEtZWMxZC00MWZhLWI0MjktNzc4NmVkNWMzY2ExLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzI0VDEyMjk0NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdkMTRmMzk1ODg3NWM1MmNmZmYzNTA5NzNhMGExNGQ3ZWY2MjVkNTg2ZGEzZDM1N2JkOGNiMjU0ODQ4MDRhODEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.HUBRduvKnrvdpweGOKeGe49DM4b6eV_dvzHsoLYftj0)
from financetoolkit.
Hi - using Colab does cut the time down by a lot. 1000 tickers takes around 2 minutes. Thank you for the suggestion!
from financetoolkit.
Related Issues (20)
- Getting a lot of NaNs HOT 7
- Error in company.ratios Function HOT 1
- [HELP] - ValueError: source code string cannot contain null bytes HOT 4
- Missing Symbols in FinanceDatabase available in FinancialToolkit HOT 1
- Growth, value, quality stocks info ? HOT 1
- [IMPROVE] Proxy availability HOT 1
- [IMPROVE] Add TQDM/Progress bar on tickers fetched HOT 1
- ValueError: Value is too big! HOT 5
- Is it possible to get sector, industry group info of stock ? HOT 1
- Clarification on Calculating Excess Returns in Non-US Markets with Different Currencies HOT 3
- [BUG] IndexingError: Too many indexers HOT 1
- [IMPROVE] NaN values in PVGO HOT 7
- [BUG] Error using convert_currency=True for old financial data HOT 6
- [FR] Adding calculation of resistance levels HOT 4
- [Bugs] small error in get_interest_debt_per_share(..) HOT 2
- [BUG]: serious bug, missing Estimates dates HOT 2
- [BUG]: income statement false if trailing for Weighted Average Shares HOT 2
- fixed_income is not working anymore HOT 1
- get_historical_data() method error HOT 3
- ratios.get_reinvestment_rate(trailing=4) not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from financetoolkit.