financedatabase 2.2.1__tar.gz → 2.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: financedatabase
3
- Version: 2.2.1
3
+ Version: 2.2.3
4
4
  Summary: This is a database of 300.000+ symbols containing Equities, ETFs, Funds, Indices, Currencies, Cryptocurrencies and Money Markets.
5
5
  Home-page: https://www.jeroenbouma.com/
6
6
  License: MIT
7
7
  Author: Jeroen Bouma
8
- Requires-Python: >=3.10,<3.13
8
+ Requires-Python: >=3.10,<3.14
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Intended Audience :: Financial and Insurance Industry
11
11
  Classifier: License :: OSI Approved :: MIT License
@@ -15,8 +15,9 @@ Classifier: Programming Language :: Python :: 3.10
15
15
  Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Topic :: Office/Business :: Financial :: Investment
18
- Requires-Dist: financetoolkit (>=1.3.5,<2.0.0)
19
- Requires-Dist: pandas[computation,performance,plot] (>=2.1.0,<3.0.0)
18
+ Provides-Extra: financetoolkit
19
+ Requires-Dist: financetoolkit ; extra == "financetoolkit"
20
+ Requires-Dist: pandas[computation,excel,performance,plot] (>=2.2,<3.0)
20
21
  Project-URL: Repository, https://github.com/JerBouma/FinanceDatabase
21
22
  Description-Content-Type: text/markdown
22
23
 
@@ -24,7 +25,6 @@ Description-Content-Type: text/markdown
24
25
 
25
26
  [![GitHub Sponsors](https://img.shields.io/badge/Sponsor_this_Project-grey?logo=github)](https://github.com/sponsors/JerBouma)
26
27
  [![Buy Me a Coffee](https://img.shields.io/badge/Buy_Me_a_Coffee-grey?logo=buymeacoffee)](https://www.buymeacoffee.com/jerbouma)
27
- [![Twitter](https://img.shields.io/badge/Twitter-grey?logo=x)](https://twitter.com/JerBouma)
28
28
  [![LinkedIn](https://img.shields.io/badge/LinkedIn-grey?logo=Linkedin&logoColor=white)](https://www.linkedin.com/in/boumajeroen/)
29
29
  [![Documentation](https://img.shields.io/badge/Documentation-grey?logo=readme)](https://www.jeroenbouma.com/projects/financedatabase)
30
30
  [![Supported Python Versions](https://img.shields.io/pypi/pyversions/financedatabase)](https://pypi.org/project/financedatabase/)
@@ -59,8 +59,6 @@ Some key statistics of the database:
59
59
 
60
60
  The Finance Database is used within or referenced by:
61
61
 
62
- <a href="https://openbb.co/"><img width="200" height="100" alt="OpenBB" src="https://github-production-user-asset-6210df.s3.amazonaws.com/46355364/265290693-cff58802-8f6e-48ec-9a5c-1a7795c3522c.png"></a>
63
- <a href="https://app.noteable.io/f/242bc47d-9c85-4a30-b6e5-d7d201f6e2d6/Finance+Database.ipynb"><img alt="Noteable" width="200" height="100" src="https://github-production-user-asset-6210df.s3.amazonaws.com/46355364/265290704-1110feb5-3ad8-4f1c-b580-df661df4682d.png"></a>
64
62
  <a href="https://algotrading101.com/learn/financedatabase-python-guide/"><img width="200" height="100" alt="AlgoTrading" src="https://github-production-user-asset-6210df.s3.amazonaws.com/46355364/265290727-4c113348-45fc-45fe-afb5-e043b738ee94.png"></a>
65
63
  <a href="https://twitter.com/pyquantnews/status/1576185955677077504?lang=en"><img width="200" height="100" alt="PyQuantNews" src="https://github-production-user-asset-6210df.s3.amazonaws.com/46355364/265290754-8c9025fb-3830-4f41-95fd-e5e6d0f84758.png"></a>
66
64
  <a href="https://alpha2phi.medium.com/investment-analysis-finance-database-61f47ecfe7ca"><img width="200" height="100" alt="Medium" src="https://github-production-user-asset-6210df.s3.amazonaws.com/46355364/265290765-dfbd0f4c-85eb-4de6-adba-345cb5189f31.png"></a>
@@ -598,6 +596,7 @@ This section is meant to thank those that contributed to the project. Looking to
598
596
 
599
597
  | User | Contribution |
600
598
  | ----------------- | ------------ |
599
+ | [desaijimmy](https://github.com/desaijimmy) | Made changes to Equities dataset including the Split of Daimler to Mercedes-Benz and Daimler Trucks |
601
600
  | [nindogo](https://github.com/nindogo) | Introduced a variety of new equities from the Nairobi Securities Exchange and introduced the country Kenya into the dataset. |
602
601
  | [colin99d](https://github.com/colin99d) | Helped in the conversion of the Finance Database package to Object-Orientated, making the code much more efficient. |
603
602
 
@@ -605,10 +604,8 @@ This section is meant to thank those that contributed to the project. Looking to
605
604
  If you have any questions about the FinanceDatabase or would like to share with me what you have been working on, feel free to reach out to me via:
606
605
 
607
606
  - **Website**: https://jeroenbouma.com/
608
- - **Twitter**: https://twitter.com/JerBouma
609
607
  - **LinkedIn:** https://www.linkedin.com/in/boumajeroen/
610
608
  - **Email:** jer.bouma@gmail.com
611
- - **Discord:** add me on Discord **`JerBouma`**
612
609
 
613
610
  f you'd like to support my efforts, either help me out via the [Contributing Guidelines](https://github.com/JerBouma/FinanceDatabase/blob/main/CONTRIBUTING.md) or [Buy me a Coffee](https://www.buymeacoffee.com/jerbouma).
614
611
 
@@ -2,7 +2,6 @@
2
2
 
3
3
  [![GitHub Sponsors](https://img.shields.io/badge/Sponsor_this_Project-grey?logo=github)](https://github.com/sponsors/JerBouma)
4
4
  [![Buy Me a Coffee](https://img.shields.io/badge/Buy_Me_a_Coffee-grey?logo=buymeacoffee)](https://www.buymeacoffee.com/jerbouma)
5
- [![Twitter](https://img.shields.io/badge/Twitter-grey?logo=x)](https://twitter.com/JerBouma)
6
5
  [![LinkedIn](https://img.shields.io/badge/LinkedIn-grey?logo=Linkedin&logoColor=white)](https://www.linkedin.com/in/boumajeroen/)
7
6
  [![Documentation](https://img.shields.io/badge/Documentation-grey?logo=readme)](https://www.jeroenbouma.com/projects/financedatabase)
8
7
  [![Supported Python Versions](https://img.shields.io/pypi/pyversions/financedatabase)](https://pypi.org/project/financedatabase/)
@@ -37,8 +36,6 @@ Some key statistics of the database:
37
36
 
38
37
  The Finance Database is used within or referenced by:
39
38
 
40
- <a href="https://openbb.co/"><img width="200" height="100" alt="OpenBB" src="https://github-production-user-asset-6210df.s3.amazonaws.com/46355364/265290693-cff58802-8f6e-48ec-9a5c-1a7795c3522c.png"></a>
41
- <a href="https://app.noteable.io/f/242bc47d-9c85-4a30-b6e5-d7d201f6e2d6/Finance+Database.ipynb"><img alt="Noteable" width="200" height="100" src="https://github-production-user-asset-6210df.s3.amazonaws.com/46355364/265290704-1110feb5-3ad8-4f1c-b580-df661df4682d.png"></a>
42
39
  <a href="https://algotrading101.com/learn/financedatabase-python-guide/"><img width="200" height="100" alt="AlgoTrading" src="https://github-production-user-asset-6210df.s3.amazonaws.com/46355364/265290727-4c113348-45fc-45fe-afb5-e043b738ee94.png"></a>
43
40
  <a href="https://twitter.com/pyquantnews/status/1576185955677077504?lang=en"><img width="200" height="100" alt="PyQuantNews" src="https://github-production-user-asset-6210df.s3.amazonaws.com/46355364/265290754-8c9025fb-3830-4f41-95fd-e5e6d0f84758.png"></a>
44
41
  <a href="https://alpha2phi.medium.com/investment-analysis-finance-database-61f47ecfe7ca"><img width="200" height="100" alt="Medium" src="https://github-production-user-asset-6210df.s3.amazonaws.com/46355364/265290765-dfbd0f4c-85eb-4de6-adba-345cb5189f31.png"></a>
@@ -576,6 +573,7 @@ This section is meant to thank those that contributed to the project. Looking to
576
573
 
577
574
  | User | Contribution |
578
575
  | ----------------- | ------------ |
576
+ | [desaijimmy](https://github.com/desaijimmy) | Made changes to Equities dataset including the Split of Daimler to Mercedes-Benz and Daimler Trucks |
579
577
  | [nindogo](https://github.com/nindogo) | Introduced a variety of new equities from the Nairobi Securities Exchange and introduced the country Kenya into the dataset. |
580
578
  | [colin99d](https://github.com/colin99d) | Helped in the conversion of the Finance Database package to Object-Orientated, making the code much more efficient. |
581
579
 
@@ -583,10 +581,8 @@ This section is meant to thank those that contributed to the project. Looking to
583
581
  If you have any questions about the FinanceDatabase or would like to share with me what you have been working on, feel free to reach out to me via:
584
582
 
585
583
  - **Website**: https://jeroenbouma.com/
586
- - **Twitter**: https://twitter.com/JerBouma
587
584
  - **LinkedIn:** https://www.linkedin.com/in/boumajeroen/
588
585
  - **Email:** jer.bouma@gmail.com
589
- - **Discord:** add me on Discord **`JerBouma`**
590
586
 
591
587
  f you'd like to support my efforts, either help me out via the [Contributing Guidelines](https://github.com/JerBouma/FinanceDatabase/blob/main/CONTRIBUTING.md) or [Buy me a Coffee](https://www.buymeacoffee.com/jerbouma).
592
588
 
@@ -1,4 +1,5 @@
1
1
  """Init Module"""
2
+
2
3
  from .helpers import obtain_options # noqa
3
4
  from .Cryptos import Cryptos # noqa
4
5
  from .Currencies import Currencies # noqa
@@ -3,7 +3,6 @@
3
3
  from pathlib import Path
4
4
 
5
5
  import pandas as pd
6
- from financetoolkit import Toolkit
7
6
 
8
7
  file_path = Path(__file__).parent.parent / "compression"
9
8
  DATA_REPO = (
@@ -127,53 +126,78 @@ class FinanceFrame(pd.DataFrame):
127
126
  start_date: str | None = None,
128
127
  end_date: str | None = None,
129
128
  quarterly: bool = False,
129
+ use_cached_data: bool | str = False,
130
130
  risk_free_rate: str = "10y",
131
- benchmark_ticker: str = "SPY",
132
- custom_ratios: dict | None = None,
133
- rounding: int = 4,
131
+ benchmark_ticker: str | None = "SPY",
132
+ historical_source: str | None = None,
133
+ convert_currency: bool | None = None,
134
+ intraday_period: str | None = None,
135
+ rounding: int | None = 4,
134
136
  remove_invalid_tickers: bool = False,
135
- sleep_timer: bool = True,
137
+ sleep_timer: bool | None = None,
136
138
  progress_bar: bool = True,
137
- ) -> Toolkit:
139
+ ):
138
140
  """
139
141
  Convert the FinanceFrame to a Finance Toolkit object.
140
142
 
141
143
  This method allows you to convert the FinanceFrame to a Finance Toolkit object,
142
- providing access to 30+ years of fundamental and historical data, 120+ ratios,
144
+ providing access to 30+ years of fundamental and historical data, 180+ ratios,
143
145
  performance and risk metrics, models, and technical indicators.
144
146
 
145
147
  Args:
146
- api_key (str, optional):
147
- Your API key for access to additional data. If not provided, only historical
148
- data and indicators are available. Obtainable from:
149
- https://www.jeroenbouma.com/fmp
150
- start_date (str, optional):
151
- The start date for historical data retrieval. If not provided, it defaults
152
- to the earliest available date.
153
- end_date (str, optional):
154
- The end date for historical data retrieval. If not provided, it defaults to
155
- the current date.
156
- quarterly (bool, optional):
157
- Set to True to retrieve quarterly data. Defaults to False.
158
- risk_free_rate (str, optional):
159
- The risk-free rate used for calculations. Defaults to "10y".
160
- benchmark_ticker (str, optional):
161
- The benchmark ticker symbol. Defaults to "^GSPC".
162
- custom_ratios (dict, optional):
163
- Custom ratios to calculate. Should be a dictionary of ratio names and formulas.
164
- rounding (int, optional):
165
- The number of decimal places to round data. Defaults to 4.
166
- remove_invalid_tickers (bool, optional):
167
- Remove invalid tickers from the toolkit. Defaults to True.
168
- sleep_timer (bool, optional):
169
- Enable a sleep timer to avoid rate limiting. Defaults to False.
170
- progress_bar (bool, optional):
171
- Show a progress bar during data retrieval. Defaults to True.
148
+ tickers (str or list): A string or a list of strings containing the company ticker(s). E.g. 'TSLA' or 'MSFT'
149
+ Find the tickers on a variety of websites or via the FinanceDatabase:
150
+ https://github.com/JerBouma/financedatabase
151
+ api_key (str): An API key from FinancialModelingPrep. Obtain one here:
152
+ https://www.jeroenbouma.com/fmp
153
+ start_date (str): A string containing the start date of the data. This needs to be formatted as YYYY-MM-DD.
154
+ The default is today minus 10 years which can be freely changed to extend the period.
155
+ end_date (str): A string containing the end date of the data. This needs to be formatted as YYYY-MM-DD.
156
+ The default is today which can be freely changed to extend the period.
157
+ quarterly (bool): A boolean indicating whether to collect quarterly data. This defaults to False and thus
158
+ collects yearly financial statements. Note that historical data can still be collected for
159
+ any period and interval.
160
+ use_cached_data (bool or str): A boolean indicating whether to use cached data. This is useful when you
161
+ have collected data before and want to use this data again. If you want to use a specific location to
162
+ store the cached data, you can define this as a string, e.g. "datasets". Defaults to False.
163
+ risk_free_rate (str): A string containing the risk free rate. This can be 13w, 5y, 10y or 30y. This is
164
+ based on the US Treasury Yields and is used to calculate various ratios and Excess Returns.
165
+ benchmark_ticker (str): A string containing the benchmark ticker. Defaults to SPY (S&P 500). This is
166
+ meant to calculate ratios and indicators such as the CAPM and Jensen's Alpha but also serves as purpose to
167
+ give insights in the performance of a stock compared to a benchmark.
168
+ historical_source (str): A string containing the historical source. This can be either FinancialModelingPrep
169
+ or YahooFinance. Defaults to FinancialModelingPrep. It is automatically defined if you enter an API Key from
170
+ FinancialModelingPrep. You can overwrite this by filling this parameter. Note that for the Free plan
171
+ the amount of historical data is limited to 5 years. If you want to collect more data, you need to
172
+ upgrade to a paid plan.
173
+ convert_currency (bool): A boolean indicating whether to convert the currency of the financial statements to
174
+ match that of the related historical data. This is an important conversion when comparing the financial
175
+ statements between each ticker as well as for calculations that are done with the historical data.
176
+ If you are using a Free plan from FinancialModelingPrep, this will be set to False.
177
+ If you are using a Premium plan from FinancialModelingPrep, this will be set to True. Defaults to None
178
+ and can thus be overridden.
179
+ intraday_period (str): A string containing the intraday period. This can be 1min, 5min, 15min, 30min or 1hour.
180
+ This is used to collect intraday data. Note that this is only relevant if you have are looking to utilize
181
+ intraday data through the Toolkit and wish to access Risk, Performance and Technicals for very short
182
+ timeframes. Defaults to None which means it will not use intraday data.
183
+ rounding (int): An integer indicating the number of decimals to round the results to.
184
+ remove_invalid_tickers (bool): A boolean indicating whether to remove invalid tickers. Defaults to False.
185
+ sleep_timer (bool): Whether to set a sleep timer when the rate limit is reached. Note that this only works
186
+ if you have a Premium subscription (Starter or higher) from FinancialModelingPrep. Defaults to None which
187
+ means it is determined by the model (Free plan = False, Premium plan = True).
188
+ progress_bar (bool): Whether to enable the progress bar when ticker amount is over 10. Defaults to True.
172
189
 
173
190
  Returns:
174
191
  Toolkit:
175
192
  A Finance Toolkit object.
176
193
  """
194
+ try:
195
+ from financetoolkit import Toolkit
196
+ except ImportError:
197
+ raise ImportError(
198
+ "To use the 'to_toolkit' functionality, it requires installation of the FinanceToolkit "
199
+ "Please use: \033[1m pip install 'financedatabase[financetoolkit]' \033[0m"
200
+ )
177
201
  if api_key is None:
178
202
  print(
179
203
  "The parameter api_key is not set. Therefore, only historical data and "
@@ -191,9 +215,12 @@ class FinanceFrame(pd.DataFrame):
191
215
  start_date=start_date,
192
216
  end_date=end_date,
193
217
  quarterly=quarterly,
218
+ use_cached_data=use_cached_data,
194
219
  risk_free_rate=risk_free_rate,
195
220
  benchmark_ticker=benchmark_ticker,
196
- custom_ratios=custom_ratios,
221
+ historical_source=historical_source,
222
+ convert_currency=convert_currency,
223
+ intraday_period=intraday_period,
197
224
  rounding=rounding,
198
225
  remove_invalid_tickers=remove_invalid_tickers,
199
226
  sleep_timer=sleep_timer,
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "financedatabase"
3
- version = "2.2.1"
3
+ version = "2.2.3"
4
4
  description = "This is a database of 300.000+ symbols containing Equities, ETFs, Funds, Indices, Currencies, Cryptocurrencies and Money Markets."
5
5
  license = "MIT"
6
6
  authors = ["Jeroen Bouma"]
@@ -22,15 +22,15 @@ classifiers = [
22
22
  ]
23
23
 
24
24
  [tool.poetry.dependencies]
25
- python = ">=3.10, <3.13"
26
- financetoolkit = "^1.3.5"
27
- pandas = {extras = ["computation", "performance", "plot"], version = "^2.1.0"}
25
+ python = ">=3.10, <3.14"
26
+ financetoolkit = { version = "*", optional = true }
27
+ pandas = {version = "^2.2", extras = ["computation", "performance", "plot", "excel"]}
28
28
 
29
29
  [tool.poetry.group.dev.dependencies]
30
30
  pytest = "^6.2.2"
31
31
  pylint = "2.17.0"
32
32
  codespell = "^2.2.4"
33
- black = "^23.1.0"
33
+ black = ">=23.1,<25.0"
34
34
  bandit = "^1.7.0"
35
35
  pytest-mock = "^3.6.1"
36
36
  pytest-recording = "^0.12.0"
@@ -39,6 +39,9 @@ ruff = "^0.0.256"
39
39
  pytest-timeout = "^2.1.0"
40
40
  pytest-recorder = "^0.2.1"
41
41
 
42
+ [tool.poetry.extras]
43
+ financetoolkit = ["financetoolkit"]
44
+
42
45
  [build-system]
43
46
  requires = ["setuptools<65.5.0", "poetry-core>=1.0.0"]
44
47
  build-backend = "poetry.core.masonry.api"
@@ -46,7 +49,7 @@ build-backend = "poetry.core.masonry.api"
46
49
  [tool.ruff]
47
50
  line-length = 122
48
51
  select = ["E", "W", "F", "Q", "W", "S", "UP", "I", "PD", "SIM", "PLC", "PLE", "PLR", "PLW"]
49
- ignore = ["S105", "S106", "S107", "PLR0913"]
52
+ ignore = ["S105", "S106", "S107", "PLR0913", "PLR0912", "PLR0915"]
50
53
 
51
54
  [tool.pylint]
52
55
  max-line-length = 122
File without changes