fmp-data 0.1.0__py3-none-any.whl

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.
Files changed (50) hide show
  1. fmp_data/__init__.py +29 -0
  2. fmp_data/alternative/__init__.py +32 -0
  3. fmp_data/alternative/client.py +144 -0
  4. fmp_data/alternative/endpoints.py +359 -0
  5. fmp_data/alternative/models.py +267 -0
  6. fmp_data/base.py +289 -0
  7. fmp_data/client.py +256 -0
  8. fmp_data/company/__init__.py +20 -0
  9. fmp_data/company/client.py +119 -0
  10. fmp_data/company/endpoints.py +295 -0
  11. fmp_data/company/models.py +302 -0
  12. fmp_data/config.py +196 -0
  13. fmp_data/economics/__init__.py +16 -0
  14. fmp_data/economics/client.py +52 -0
  15. fmp_data/economics/endpoints.py +101 -0
  16. fmp_data/economics/models.py +66 -0
  17. fmp_data/exceptions.py +54 -0
  18. fmp_data/fundamental/__init__.py +40 -0
  19. fmp_data/fundamental/client.py +72 -0
  20. fmp_data/fundamental/endpoints.py +309 -0
  21. fmp_data/fundamental/models.py +887 -0
  22. fmp_data/institutional/__init__.py +26 -0
  23. fmp_data/institutional/client.py +59 -0
  24. fmp_data/institutional/endpoints.py +208 -0
  25. fmp_data/institutional/models.py +207 -0
  26. fmp_data/intelligence/__init__.py +34 -0
  27. fmp_data/intelligence/client.py +117 -0
  28. fmp_data/intelligence/endpoints.py +339 -0
  29. fmp_data/intelligence/models.py +356 -0
  30. fmp_data/investment/__init__.py +24 -0
  31. fmp_data/investment/client.py +90 -0
  32. fmp_data/investment/endpoints.py +241 -0
  33. fmp_data/investment/models.py +205 -0
  34. fmp_data/logger.py +351 -0
  35. fmp_data/market/__init__.py +26 -0
  36. fmp_data/market/client.py +93 -0
  37. fmp_data/market/endpoints.py +203 -0
  38. fmp_data/market/models.py +238 -0
  39. fmp_data/models.py +198 -0
  40. fmp_data/rate_limit.py +136 -0
  41. fmp_data/technical/__init__.py +28 -0
  42. fmp_data/technical/client.py +214 -0
  43. fmp_data/technical/endpoints.py +100 -0
  44. fmp_data/technical/models.py +78 -0
  45. fmp_data-0.1.0.dist-info/LICENSE +21 -0
  46. fmp_data-0.1.0.dist-info/METADATA +355 -0
  47. fmp_data-0.1.0.dist-info/NOTICE +37 -0
  48. fmp_data-0.1.0.dist-info/RECORD +50 -0
  49. fmp_data-0.1.0.dist-info/WHEEL +4 -0
  50. fmp_data-0.1.0.dist-info/entry_points.txt +9 -0
fmp_data/__init__.py ADDED
@@ -0,0 +1,29 @@
1
+ # fmp_data/__init__.py
2
+ from fmp_data.client import FMPDataClient
3
+ from fmp_data.config import ClientConfig, LoggingConfig, RateLimitConfig
4
+ from fmp_data.exceptions import (
5
+ AuthenticationError,
6
+ ConfigError,
7
+ FMPError,
8
+ RateLimitError,
9
+ ValidationError,
10
+ )
11
+ from fmp_data.logger import FMPLogger
12
+
13
+ # Initialize the logger when the library is imported
14
+ logger = FMPLogger()
15
+
16
+ __all__ = [
17
+ "FMPDataClient",
18
+ "ClientConfig",
19
+ "LoggingConfig",
20
+ "RateLimitConfig",
21
+ "FMPError",
22
+ "RateLimitError",
23
+ "AuthenticationError",
24
+ "ValidationError",
25
+ "ConfigError",
26
+ "logger",
27
+ ]
28
+
29
+ __version__ = "0.1.0"
@@ -0,0 +1,32 @@
1
+ # fmp_data/alternative/__init__.py
2
+ from fmp_data.alternative.client import AlternativeMarketsClient
3
+ from fmp_data.alternative.models import (
4
+ Commodity,
5
+ CommodityHistoricalPrice,
6
+ CommodityIntradayPrice,
7
+ CommodityQuote,
8
+ CryptoHistoricalPrice,
9
+ CryptoIntradayPrice,
10
+ CryptoPair,
11
+ CryptoQuote,
12
+ ForexHistoricalPrice,
13
+ ForexIntradayPrice,
14
+ ForexPair,
15
+ ForexQuote,
16
+ )
17
+
18
+ __all__ = [
19
+ "AlternativeMarketsClient",
20
+ "CryptoPair",
21
+ "CryptoQuote",
22
+ "CryptoHistoricalPrice",
23
+ "CryptoIntradayPrice",
24
+ "ForexPair",
25
+ "ForexQuote",
26
+ "ForexHistoricalPrice",
27
+ "ForexIntradayPrice",
28
+ "Commodity",
29
+ "CommodityQuote",
30
+ "CommodityHistoricalPrice",
31
+ "CommodityIntradayPrice",
32
+ ]
@@ -0,0 +1,144 @@
1
+ # fmp_data/alternative/client.py
2
+ from datetime import date
3
+
4
+ from fmp_data.alternative.endpoints import (
5
+ COMMODITIES_LIST,
6
+ COMMODITIES_QUOTES,
7
+ COMMODITY_HISTORICAL,
8
+ COMMODITY_INTRADAY,
9
+ COMMODITY_QUOTE,
10
+ CRYPTO_HISTORICAL,
11
+ CRYPTO_INTRADAY,
12
+ CRYPTO_LIST,
13
+ CRYPTO_QUOTE,
14
+ CRYPTO_QUOTES,
15
+ FOREX_HISTORICAL,
16
+ FOREX_INTRADAY,
17
+ FOREX_LIST,
18
+ FOREX_QUOTE,
19
+ FOREX_QUOTES,
20
+ )
21
+ from fmp_data.alternative.models import (
22
+ Commodity,
23
+ CommodityIntradayPrice,
24
+ CommodityPriceHistory,
25
+ CommodityQuote,
26
+ CryptoHistoricalData,
27
+ CryptoIntradayPrice,
28
+ CryptoPair,
29
+ CryptoQuote,
30
+ ForexIntradayPrice,
31
+ ForexPair,
32
+ ForexPriceHistory,
33
+ ForexQuote,
34
+ )
35
+ from fmp_data.base import EndpointGroup
36
+
37
+
38
+ class AlternativeMarketsClient(EndpointGroup):
39
+ """Client for alternative markets endpoints"""
40
+
41
+ # Cryptocurrency methods
42
+ def get_crypto_list(self) -> list[CryptoPair]:
43
+ """Get list of available cryptocurrencies"""
44
+ return self.client.request(CRYPTO_LIST)
45
+
46
+ def get_crypto_quotes(self) -> list[CryptoQuote]:
47
+ """Get cryptocurrency quotes"""
48
+ return self.client.request(CRYPTO_QUOTES)
49
+
50
+ def get_crypto_quote(self, symbol: str) -> CryptoQuote:
51
+ """Get cryptocurrency quote"""
52
+ result = self.client.request(CRYPTO_QUOTE, symbol=symbol)
53
+ return result[0] if isinstance(result, list) else result
54
+
55
+ def get_crypto_historical(
56
+ self,
57
+ symbol: str,
58
+ start_date: date | None = None,
59
+ end_date: date | None = None,
60
+ ) -> CryptoHistoricalData:
61
+ """Get cryptocurrency historical prices"""
62
+ params = {"symbol": symbol}
63
+ if start_date:
64
+ params["from"] = start_date.strftime("%Y-%m-%d")
65
+ if end_date:
66
+ params["to"] = end_date.strftime("%Y-%m-%d")
67
+
68
+ return self.client.request(CRYPTO_HISTORICAL, **params)
69
+
70
+ def get_crypto_intraday(
71
+ self, symbol: str, interval: str = "5min"
72
+ ) -> list[CryptoIntradayPrice]:
73
+ """Get cryptocurrency intraday prices"""
74
+ return self.client.request(CRYPTO_INTRADAY, symbol=symbol, interval=interval)
75
+
76
+ # Forex methods
77
+ def get_forex_list(self) -> list[ForexPair]:
78
+ """Get list of available forex pairs"""
79
+ return self.client.request(FOREX_LIST)
80
+
81
+ def get_forex_quotes(self) -> list[ForexQuote]:
82
+ """Get forex quotes"""
83
+ return self.client.request(FOREX_QUOTES)
84
+
85
+ def get_forex_quote(self, symbol: str) -> ForexQuote:
86
+ """Get forex quote"""
87
+ result = self.client.request(FOREX_QUOTE, symbol=symbol)
88
+ return result[0] if isinstance(result, list) else result
89
+
90
+ def get_forex_historical(
91
+ self,
92
+ symbol: str,
93
+ start_date: date | None = None,
94
+ end_date: date | None = None,
95
+ ) -> ForexPriceHistory:
96
+ """Get forex historical prices"""
97
+ params = {"symbol": symbol}
98
+ if start_date:
99
+ params["from"] = start_date.strftime("%Y-%m-%d")
100
+ if end_date:
101
+ params["to"] = end_date.strftime("%Y-%m-%d")
102
+
103
+ return self.client.request(FOREX_HISTORICAL, **params)
104
+
105
+ def get_forex_intraday(
106
+ self, symbol: str, interval: str = "5min"
107
+ ) -> list[ForexIntradayPrice]:
108
+ """Get forex intraday prices"""
109
+ return self.client.request(FOREX_INTRADAY, symbol=symbol, interval=interval)
110
+
111
+ # Commodities methods
112
+ def get_commodities_list(self) -> list[Commodity]:
113
+ """Get list of available commodities"""
114
+ return self.client.request(COMMODITIES_LIST)
115
+
116
+ def get_commodities_quotes(self) -> list[CommodityQuote]:
117
+ """Get commodities quotes"""
118
+ return self.client.request(COMMODITIES_QUOTES)
119
+
120
+ def get_commodity_quote(self, symbol: str) -> CommodityQuote:
121
+ """Get commodity quote"""
122
+ result = self.client.request(COMMODITY_QUOTE, symbol=symbol)
123
+ return result[0] if isinstance(result, list) else result
124
+
125
+ def get_commodity_historical(
126
+ self,
127
+ symbol: str,
128
+ start_date: date | None = None,
129
+ end_date: date | None = None,
130
+ ) -> CommodityPriceHistory:
131
+ """Get commodity historical prices"""
132
+ params = {"symbol": symbol}
133
+ if start_date:
134
+ params["from"] = start_date.strftime("%Y-%m-%d")
135
+ if end_date:
136
+ params["to"] = end_date.strftime("%Y-%m-%d")
137
+
138
+ return self.client.request(COMMODITY_HISTORICAL, **params)
139
+
140
+ def get_commodity_intraday(
141
+ self, symbol: str, interval: str = "5min"
142
+ ) -> list[CommodityIntradayPrice]:
143
+ """Get commodity intraday prices"""
144
+ return self.client.request(COMMODITY_INTRADAY, symbol=symbol, interval=interval)
@@ -0,0 +1,359 @@
1
+ from fmp_data.alternative.models import (
2
+ Commodity,
3
+ CommodityIntradayPrice,
4
+ CommodityPriceHistory,
5
+ CommodityQuote,
6
+ CryptoHistoricalData,
7
+ CryptoIntradayPrice,
8
+ CryptoPair,
9
+ CryptoQuote,
10
+ ForexIntradayPrice,
11
+ ForexPair,
12
+ ForexPriceHistory,
13
+ ForexQuote,
14
+ )
15
+ from fmp_data.models import (
16
+ APIVersion,
17
+ Endpoint,
18
+ EndpointParam,
19
+ HTTPMethod,
20
+ ParamLocation,
21
+ ParamType,
22
+ URLType,
23
+ )
24
+
25
+ CRYPTO_LIST = Endpoint(
26
+ name="crypto_list",
27
+ path="symbol/available-cryptocurrencies",
28
+ version=APIVersion.V3,
29
+ url_type=URLType.API,
30
+ method=HTTPMethod.GET,
31
+ description="Get list of available cryptocurrencies",
32
+ mandatory_params=[],
33
+ optional_params=[],
34
+ response_model=CryptoPair,
35
+ )
36
+
37
+ CRYPTO_QUOTES = Endpoint(
38
+ name="crypto_quotes",
39
+ path="quotes/crypto",
40
+ version=APIVersion.V3,
41
+ url_type=URLType.API,
42
+ method=HTTPMethod.GET,
43
+ description="Get cryptocurrency quotes",
44
+ mandatory_params=[],
45
+ optional_params=[],
46
+ response_model=CryptoQuote,
47
+ )
48
+
49
+ CRYPTO_QUOTE = Endpoint(
50
+ name="crypto_quote",
51
+ path="quote/{symbol}",
52
+ version=APIVersion.V3,
53
+ url_type=URLType.API,
54
+ method=HTTPMethod.GET,
55
+ description="Get cryptocurrency quote",
56
+ mandatory_params=[
57
+ EndpointParam(
58
+ name="symbol",
59
+ location=ParamLocation.PATH,
60
+ param_type=ParamType.STRING,
61
+ required=True,
62
+ description="Crypto pair symbol",
63
+ )
64
+ ],
65
+ optional_params=[],
66
+ response_model=CryptoQuote,
67
+ )
68
+
69
+ CRYPTO_HISTORICAL = Endpoint(
70
+ name="crypto_historical",
71
+ path="historical-price-full/{symbol}",
72
+ version=APIVersion.V3,
73
+ url_type=URLType.API,
74
+ method=HTTPMethod.GET,
75
+ description="Get cryptocurrency historical prices",
76
+ mandatory_params=[
77
+ EndpointParam(
78
+ name="symbol",
79
+ location=ParamLocation.PATH,
80
+ param_type=ParamType.STRING,
81
+ required=True,
82
+ description="Crypto pair symbol",
83
+ )
84
+ ],
85
+ optional_params=[
86
+ EndpointParam(
87
+ name="from",
88
+ location=ParamLocation.QUERY,
89
+ param_type=ParamType.DATE,
90
+ required=False,
91
+ description="Start date",
92
+ ),
93
+ EndpointParam(
94
+ name="to",
95
+ location=ParamLocation.QUERY,
96
+ param_type=ParamType.DATE,
97
+ required=False,
98
+ description="End date",
99
+ ),
100
+ ],
101
+ response_model=CryptoHistoricalData,
102
+ )
103
+
104
+ CRYPTO_INTRADAY = Endpoint(
105
+ name="crypto_intraday",
106
+ path="historical-chart/{interval}/{symbol}",
107
+ version=APIVersion.V3,
108
+ url_type=URLType.API,
109
+ method=HTTPMethod.GET,
110
+ description="Get cryptocurrency intraday prices",
111
+ mandatory_params=[
112
+ EndpointParam(
113
+ name="interval",
114
+ location=ParamLocation.PATH,
115
+ param_type=ParamType.STRING,
116
+ required=True,
117
+ description="Time interval",
118
+ valid_values=["1min", "5min", "15min", "30min", "1hour", "4hour"],
119
+ ),
120
+ EndpointParam(
121
+ name="symbol",
122
+ location=ParamLocation.PATH,
123
+ param_type=ParamType.STRING,
124
+ required=True,
125
+ description="Crypto pair symbol",
126
+ ),
127
+ ],
128
+ optional_params=[],
129
+ response_model=CryptoIntradayPrice,
130
+ )
131
+
132
+ FOREX_LIST = Endpoint(
133
+ name="forex_list",
134
+ path="symbol/available-forex-currency-pairs",
135
+ version=APIVersion.V3,
136
+ url_type=URLType.API,
137
+ method=HTTPMethod.GET,
138
+ description="Get list of available forex pairs",
139
+ mandatory_params=[],
140
+ optional_params=[],
141
+ response_model=ForexPair,
142
+ )
143
+
144
+ FOREX_QUOTES = Endpoint(
145
+ name="forex_quotes",
146
+ path="quotes/forex",
147
+ version=APIVersion.V3,
148
+ url_type=URLType.API,
149
+ method=HTTPMethod.GET,
150
+ description="Get forex quotes",
151
+ mandatory_params=[],
152
+ optional_params=[],
153
+ response_model=ForexQuote,
154
+ )
155
+
156
+ FOREX_QUOTE = Endpoint(
157
+ name="forex_quote",
158
+ path="quote/{symbol}",
159
+ version=APIVersion.V3,
160
+ url_type=URLType.API,
161
+ method=HTTPMethod.GET,
162
+ description="Get forex quote",
163
+ mandatory_params=[
164
+ EndpointParam(
165
+ name="symbol",
166
+ location=ParamLocation.PATH,
167
+ param_type=ParamType.STRING,
168
+ required=True,
169
+ description="Forex pair symbol",
170
+ )
171
+ ],
172
+ optional_params=[],
173
+ response_model=ForexQuote,
174
+ )
175
+
176
+ FOREX_HISTORICAL = Endpoint(
177
+ name="forex_historical",
178
+ path="historical-price-full/{symbol}",
179
+ version=APIVersion.V3,
180
+ url_type=URLType.API,
181
+ method=HTTPMethod.GET,
182
+ description="Get forex historical prices",
183
+ mandatory_params=[
184
+ EndpointParam(
185
+ name="symbol",
186
+ location=ParamLocation.PATH,
187
+ param_type=ParamType.STRING,
188
+ required=True,
189
+ description="Forex pair symbol",
190
+ )
191
+ ],
192
+ optional_params=[
193
+ EndpointParam(
194
+ name="from",
195
+ location=ParamLocation.QUERY,
196
+ param_type=ParamType.DATE,
197
+ required=False,
198
+ description="Start date",
199
+ ),
200
+ EndpointParam(
201
+ name="to",
202
+ location=ParamLocation.QUERY,
203
+ param_type=ParamType.DATE,
204
+ required=False,
205
+ description="End date",
206
+ ),
207
+ ],
208
+ response_model=ForexPriceHistory,
209
+ )
210
+
211
+ FOREX_INTRADAY = Endpoint(
212
+ name="forex_intraday",
213
+ path="historical-chart/{interval}/{symbol}",
214
+ version=APIVersion.V3,
215
+ url_type=URLType.API,
216
+ method=HTTPMethod.GET,
217
+ description="Get forex intraday prices",
218
+ mandatory_params=[
219
+ EndpointParam(
220
+ name="interval",
221
+ location=ParamLocation.PATH,
222
+ param_type=ParamType.STRING,
223
+ required=True,
224
+ description="Time interval",
225
+ valid_values=["1min", "5min", "15min", "30min", "1hour", "4hour"],
226
+ ),
227
+ EndpointParam(
228
+ name="symbol",
229
+ location=ParamLocation.PATH,
230
+ param_type=ParamType.STRING,
231
+ required=True,
232
+ description="Forex pair symbol",
233
+ ),
234
+ ],
235
+ optional_params=[],
236
+ response_model=ForexIntradayPrice,
237
+ )
238
+
239
+ COMMODITIES_LIST = Endpoint(
240
+ name="commodities_list",
241
+ path="symbol/available-commodities",
242
+ version=APIVersion.V3,
243
+ url_type=URLType.API,
244
+ method=HTTPMethod.GET,
245
+ description="Get list of available commodities",
246
+ mandatory_params=[],
247
+ optional_params=[],
248
+ response_model=Commodity,
249
+ )
250
+
251
+ COMMODITIES_QUOTES = Endpoint(
252
+ name="commodities_quotes",
253
+ path="quotes/commodity",
254
+ version=APIVersion.V3,
255
+ url_type=URLType.API,
256
+ method=HTTPMethod.GET,
257
+ description="Get commodities quotes",
258
+ mandatory_params=[],
259
+ optional_params=[],
260
+ response_model=CommodityQuote,
261
+ )
262
+
263
+ COMMODITY_QUOTE = Endpoint(
264
+ name="commodity_quote",
265
+ path="quote/{symbol}",
266
+ version=APIVersion.V3,
267
+ url_type=URLType.API,
268
+ method=HTTPMethod.GET,
269
+ description="Get commodity quote",
270
+ mandatory_params=[
271
+ EndpointParam(
272
+ name="symbol",
273
+ location=ParamLocation.PATH,
274
+ param_type=ParamType.STRING,
275
+ required=True,
276
+ description="Commodity symbol",
277
+ )
278
+ ],
279
+ optional_params=[],
280
+ response_model=CommodityQuote,
281
+ )
282
+
283
+ COMMODITY_HISTORICAL = Endpoint(
284
+ name="commodity_historical",
285
+ path="historical-price-full/{symbol}",
286
+ version=APIVersion.V3,
287
+ url_type=URLType.API,
288
+ method=HTTPMethod.GET,
289
+ description="Get commodity historical prices",
290
+ mandatory_params=[
291
+ EndpointParam(
292
+ name="symbol",
293
+ location=ParamLocation.PATH,
294
+ param_type=ParamType.STRING,
295
+ required=True,
296
+ description="Commodity symbol",
297
+ )
298
+ ],
299
+ optional_params=[
300
+ EndpointParam(
301
+ name="from",
302
+ location=ParamLocation.QUERY,
303
+ param_type=ParamType.DATE,
304
+ required=False,
305
+ description="Start date",
306
+ ),
307
+ EndpointParam(
308
+ name="to",
309
+ location=ParamLocation.QUERY,
310
+ param_type=ParamType.DATE,
311
+ required=False,
312
+ description="End date",
313
+ ),
314
+ ],
315
+ response_model=CommodityPriceHistory,
316
+ )
317
+
318
+ COMMODITY_INTRADAY = Endpoint(
319
+ name="commodity_intraday",
320
+ path="historical-chart/{interval}/{symbol}",
321
+ version=APIVersion.V3,
322
+ url_type=URLType.API,
323
+ method=HTTPMethod.GET,
324
+ description="Get commodity intraday prices",
325
+ mandatory_params=[
326
+ EndpointParam(
327
+ name="interval",
328
+ location=ParamLocation.PATH,
329
+ param_type=ParamType.STRING,
330
+ required=True,
331
+ description="Time interval",
332
+ valid_values=["1min", "5min", "15min", "30min", "1hour", "4hour"],
333
+ ),
334
+ EndpointParam(
335
+ name="symbol",
336
+ location=ParamLocation.PATH,
337
+ param_type=ParamType.STRING,
338
+ required=True,
339
+ description="Commodity symbol",
340
+ ),
341
+ ],
342
+ optional_params=[
343
+ EndpointParam(
344
+ name="from",
345
+ location=ParamLocation.QUERY,
346
+ param_type=ParamType.DATE,
347
+ required=False,
348
+ description="Start date",
349
+ ),
350
+ EndpointParam(
351
+ name="to",
352
+ location=ParamLocation.QUERY,
353
+ param_type=ParamType.DATE,
354
+ required=False,
355
+ description="End date",
356
+ ),
357
+ ],
358
+ response_model=CommodityIntradayPrice,
359
+ )