kensho-kfinance 2.7.0__py3-none-any.whl → 2.8.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.
Potentially problematic release.
This version of kensho-kfinance might be problematic. Click here for more details.
- {kensho_kfinance-2.7.0.dist-info → kensho_kfinance-2.8.0.dist-info}/METADATA +1 -1
- kensho_kfinance-2.8.0.dist-info/RECORD +70 -0
- kfinance/CHANGELOG.md +3 -0
- kfinance/decimal_with_unit.py +78 -0
- kfinance/fetch.py +15 -16
- kfinance/kfinance.py +40 -44
- kfinance/meta_classes.py +28 -27
- kfinance/models/business_relationship_models.py +26 -0
- kfinance/models/capitalization_models.py +90 -0
- kfinance/models/competitor_models.py +13 -0
- kfinance/models/currency_models.py +345 -0
- kfinance/models/date_and_period_models.py +48 -0
- kfinance/models/id_models.py +7 -0
- kfinance/models/industry_models.py +12 -0
- kfinance/{constants.py → models/line_item_models.py} +1 -165
- kfinance/models/permission_models.py +15 -0
- kfinance/models/price_models.py +70 -0
- kfinance/models/segment_models.py +8 -0
- kfinance/models/statement_models.py +9 -0
- kfinance/tests/test_batch_requests.py +61 -31
- kfinance/tests/test_client.py +1 -1
- kfinance/tests/test_decimal_with_unit.py +60 -0
- kfinance/tests/test_example_notebook.py +1 -0
- kfinance/tests/test_fetch.py +23 -12
- kfinance/tests/test_models/__init__.py +0 -0
- kfinance/tests/test_models/test_capitalization_models.py +83 -0
- kfinance/tests/test_models/test_price_models.py +58 -0
- kfinance/tests/test_objects.py +29 -23
- kfinance/tests/test_tools.py +35 -11
- kfinance/tool_calling/get_advisors_for_company_in_transaction_from_identifier.py +1 -1
- kfinance/tool_calling/get_business_relationship_from_identifier.py +2 -1
- kfinance/tool_calling/get_capitalization_from_identifier.py +4 -5
- kfinance/tool_calling/get_competitors_from_identifier.py +2 -1
- kfinance/tool_calling/get_cusip_from_ticker.py +1 -1
- kfinance/tool_calling/get_earnings.py +1 -1
- kfinance/tool_calling/get_financial_line_item_from_identifier.py +3 -1
- kfinance/tool_calling/get_financial_statement_from_identifier.py +3 -1
- kfinance/tool_calling/get_history_metadata_from_identifier.py +2 -1
- kfinance/tool_calling/get_info_from_identifier.py +1 -1
- kfinance/tool_calling/get_isin_from_ticker.py +1 -1
- kfinance/tool_calling/get_latest.py +2 -1
- kfinance/tool_calling/get_latest_earnings.py +1 -1
- kfinance/tool_calling/get_merger_info_from_transaction_id.py +1 -1
- kfinance/tool_calling/get_mergers_from_identifier.py +1 -1
- kfinance/tool_calling/get_n_quarters_ago.py +2 -1
- kfinance/tool_calling/get_next_earnings.py +1 -1
- kfinance/tool_calling/get_prices_from_identifier.py +4 -3
- kfinance/tool_calling/get_segments_from_identifier.py +3 -1
- kfinance/tool_calling/get_transcript.py +1 -1
- kfinance/tool_calling/resolve_identifier.py +1 -1
- kfinance/tool_calling/shared_models.py +1 -1
- kfinance/version.py +2 -2
- kensho_kfinance-2.7.0.dist-info/RECORD +0 -54
- {kensho_kfinance-2.7.0.dist-info → kensho_kfinance-2.8.0.dist-info}/WHEEL +0 -0
- {kensho_kfinance-2.7.0.dist-info → kensho_kfinance-2.8.0.dist-info}/licenses/AUTHORS.md +0 -0
- {kensho_kfinance-2.7.0.dist-info → kensho_kfinance-2.8.0.dist-info}/licenses/LICENSE +0 -0
- {kensho_kfinance-2.7.0.dist-info → kensho_kfinance-2.8.0.dist-info}/top_level.txt +0 -0
- /kfinance/{tests/scratch.py → models/__init__.py} +0 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@dataclass
|
|
5
|
+
class Currency:
|
|
6
|
+
"""Follows ISO 4217"""
|
|
7
|
+
|
|
8
|
+
code: str
|
|
9
|
+
num: int
|
|
10
|
+
conventional_decimals: int
|
|
11
|
+
name: str
|
|
12
|
+
symbol: str | None
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
CURRENCIES = [
|
|
16
|
+
Currency(
|
|
17
|
+
code="AED",
|
|
18
|
+
num=784,
|
|
19
|
+
conventional_decimals=2,
|
|
20
|
+
name="United Arab Emirates dirham",
|
|
21
|
+
symbol=None,
|
|
22
|
+
),
|
|
23
|
+
Currency(code="AFN", num=971, conventional_decimals=2, name="Afghan afghani", symbol="\u060b"),
|
|
24
|
+
Currency(code="ALL", num=8, conventional_decimals=2, name="Albanian lek", symbol="Lek"),
|
|
25
|
+
Currency(code="AMD", num=51, conventional_decimals=2, name="Armenian dram", symbol="\u058f"),
|
|
26
|
+
Currency(code="AOA", num=973, conventional_decimals=2, name="Angolan kwanza", symbol="Kz"),
|
|
27
|
+
Currency(code="ARS", num=32, conventional_decimals=2, name="Argentine peso", symbol="Arg$"),
|
|
28
|
+
Currency(code="AUD", num=36, conventional_decimals=2, name="Australian dollar", symbol="A$"),
|
|
29
|
+
Currency(code="AWG", num=533, conventional_decimals=2, name="Aruban florin", symbol="\u0192"),
|
|
30
|
+
Currency(
|
|
31
|
+
code="AZN", num=944, conventional_decimals=2, name="Azerbaijani manat", symbol="\u20bc"
|
|
32
|
+
),
|
|
33
|
+
Currency(
|
|
34
|
+
code="BAM",
|
|
35
|
+
num=977,
|
|
36
|
+
conventional_decimals=2,
|
|
37
|
+
name="Bosnia and Herzegovina convertible mark",
|
|
38
|
+
symbol="KM",
|
|
39
|
+
),
|
|
40
|
+
Currency(code="BBD", num=52, conventional_decimals=2, name="Barbados dollar", symbol="Bds$"),
|
|
41
|
+
Currency(code="BDT", num=50, conventional_decimals=2, name="Bangladeshi taka", symbol="\u09f3"),
|
|
42
|
+
Currency(code="BGN", num=975, conventional_decimals=2, name="Bulgarian lev", symbol="lev"),
|
|
43
|
+
Currency(code="BHD", num=48, conventional_decimals=3, name="Bahraini dinar", symbol="BD"),
|
|
44
|
+
Currency(code="BIF", num=108, conventional_decimals=0, name="Burundian franc", symbol="FBu"),
|
|
45
|
+
Currency(code="BMD", num=60, conventional_decimals=2, name="Bermudian dollar", symbol="Ber$"),
|
|
46
|
+
Currency(code="BND", num=96, conventional_decimals=2, name="Brunei dollar", symbol="B$"),
|
|
47
|
+
Currency(code="BOB", num=68, conventional_decimals=2, name="Boliviano", symbol="Bs"),
|
|
48
|
+
Currency(
|
|
49
|
+
code="BOV",
|
|
50
|
+
num=984,
|
|
51
|
+
conventional_decimals=2,
|
|
52
|
+
name="Bolivian Mvdol (funds code),",
|
|
53
|
+
symbol=None,
|
|
54
|
+
),
|
|
55
|
+
Currency(code="BRL", num=986, conventional_decimals=2, name="Brazilian real", symbol="R$"),
|
|
56
|
+
Currency(code="BSD", num=44, conventional_decimals=2, name="Bahamian dollar", symbol="B$"),
|
|
57
|
+
Currency(code="BTN", num=64, conventional_decimals=2, name="Bhutanese ngultrum", symbol="Nu"),
|
|
58
|
+
Currency(code="BWP", num=72, conventional_decimals=2, name="Botswana pula", symbol="P"),
|
|
59
|
+
Currency(code="BYN", num=933, conventional_decimals=2, name="Belarusian ruble", symbol="R"),
|
|
60
|
+
Currency(code="BZD", num=84, conventional_decimals=2, name="Belize dollar", symbol="BZ$"),
|
|
61
|
+
Currency(code="CAD", num=124, conventional_decimals=2, name="Canadian dollar", symbol="C$"),
|
|
62
|
+
Currency(code="CDF", num=976, conventional_decimals=2, name="Congolese franc", symbol="FC"),
|
|
63
|
+
Currency(code="CHE", num=947, conventional_decimals=2, name="WIR franc", symbol=None),
|
|
64
|
+
Currency(code="CHF", num=756, conventional_decimals=2, name="Swiss franc", symbol="SFr"),
|
|
65
|
+
Currency(code="CHW", num=948, conventional_decimals=2, name="WIR franc", symbol=None),
|
|
66
|
+
Currency(
|
|
67
|
+
code="CLF",
|
|
68
|
+
num=990,
|
|
69
|
+
conventional_decimals=4,
|
|
70
|
+
name="Unidad de Fomento (funds code),",
|
|
71
|
+
symbol=None,
|
|
72
|
+
),
|
|
73
|
+
Currency(code="CLP", num=152, conventional_decimals=0, name="Chilean peso", symbol="Ch$"),
|
|
74
|
+
Currency(code="CNY", num=156, conventional_decimals=2, name="Renminbi", symbol="CN\u00a5"),
|
|
75
|
+
Currency(code="COP", num=170, conventional_decimals=2, name="Colombian peso", symbol="Col$"),
|
|
76
|
+
Currency(
|
|
77
|
+
code="COU",
|
|
78
|
+
num=970,
|
|
79
|
+
conventional_decimals=2,
|
|
80
|
+
name="Unidad de Valor Real (UVR), (funds code),",
|
|
81
|
+
symbol=None,
|
|
82
|
+
),
|
|
83
|
+
Currency(
|
|
84
|
+
code="CRC", num=188, conventional_decimals=2, name="Costa Rican colon", symbol="\u20a1"
|
|
85
|
+
),
|
|
86
|
+
Currency(code="CUP", num=192, conventional_decimals=2, name="Cuban peso", symbol="Cu$"),
|
|
87
|
+
Currency(code="CVE", num=132, conventional_decimals=2, name="Cape Verdean escudo", symbol=None),
|
|
88
|
+
Currency(code="CZK", num=203, conventional_decimals=2, name="Czech koruna", symbol="K\u010d"),
|
|
89
|
+
Currency(code="DJF", num=262, conventional_decimals=0, name="Djiboutian franc", symbol="DF"),
|
|
90
|
+
Currency(code="DKK", num=208, conventional_decimals=2, name="Danish krone", symbol="kr"),
|
|
91
|
+
Currency(code="DOP", num=214, conventional_decimals=2, name="Dominican peso", symbol="RD$"),
|
|
92
|
+
Currency(code="DZD", num=12, conventional_decimals=2, name="Algerian dinar", symbol="DA"),
|
|
93
|
+
Currency(code="EGP", num=818, conventional_decimals=2, name="Egyptian pound", symbol="\u00a3E"),
|
|
94
|
+
Currency(code="ERN", num=232, conventional_decimals=2, name="Eritrean nakfa", symbol="Nfk"),
|
|
95
|
+
Currency(code="ETB", num=230, conventional_decimals=2, name="Ethiopian birr", symbol="Br"),
|
|
96
|
+
Currency(code="EUR", num=978, conventional_decimals=2, name="Euro", symbol="\u20ac"),
|
|
97
|
+
Currency(code="FJD", num=242, conventional_decimals=2, name="Fiji dollar", symbol="FJ$"),
|
|
98
|
+
Currency(
|
|
99
|
+
code="FKP", num=238, conventional_decimals=2, name="Falkland Islands pound", symbol="\u00a3"
|
|
100
|
+
),
|
|
101
|
+
Currency(code="GBP", num=826, conventional_decimals=2, name="Pound sterling", symbol="\u00a3"),
|
|
102
|
+
Currency(code="GEL", num=981, conventional_decimals=2, name="Georgian lari", symbol="\u20be"),
|
|
103
|
+
Currency(code="GHS", num=936, conventional_decimals=2, name="Ghanaian cedi", symbol="\u20bf"),
|
|
104
|
+
Currency(code="GIP", num=292, conventional_decimals=2, name="Gibraltar pound", symbol="\u00a3"),
|
|
105
|
+
Currency(code="GMD", num=270, conventional_decimals=2, name="Gambian dalasi", symbol="D"),
|
|
106
|
+
Currency(code="GNF", num=324, conventional_decimals=0, name="Guinean franc", symbol="FG"),
|
|
107
|
+
Currency(code="GTQ", num=320, conventional_decimals=2, name="Guatemalan quetzal", symbol="Q"),
|
|
108
|
+
Currency(code="GYD", num=328, conventional_decimals=2, name="Guyanese dollar", symbol="G$"),
|
|
109
|
+
Currency(code="HKD", num=344, conventional_decimals=2, name="Hong Kong dollar", symbol="HK$"),
|
|
110
|
+
Currency(code="HNL", num=340, conventional_decimals=2, name="Honduran lempira", symbol="L"),
|
|
111
|
+
Currency(code="HTG", num=332, conventional_decimals=2, name="Haitian gourde", symbol="G"),
|
|
112
|
+
Currency(code="HUF", num=348, conventional_decimals=2, name="Hungarian forint", symbol="Ft"),
|
|
113
|
+
Currency(code="IDR", num=360, conventional_decimals=2, name="Indonesian rupiah", symbol="Rp"),
|
|
114
|
+
Currency(
|
|
115
|
+
code="ILS", num=376, conventional_decimals=2, name="Israeli new shekel", symbol="\u20aa"
|
|
116
|
+
),
|
|
117
|
+
Currency(code="INR", num=356, conventional_decimals=2, name="Indian rupee", symbol="\u20b9"),
|
|
118
|
+
Currency(code="IQD", num=368, conventional_decimals=3, name="Iraqi dinar", symbol="ID"),
|
|
119
|
+
Currency(code="IRR", num=364, conventional_decimals=2, name="Iranian rial", symbol="\ufdfc"),
|
|
120
|
+
Currency(code="ISK", num=352, conventional_decimals=0, name="Icelandic króna", symbol="kr"),
|
|
121
|
+
Currency(code="JMD", num=388, conventional_decimals=2, name="Jamaican dollar", symbol="J$"),
|
|
122
|
+
Currency(code="JOD", num=400, conventional_decimals=3, name="Jordanian dinar", symbol="JD"),
|
|
123
|
+
Currency(code="JPY", num=392, conventional_decimals=0, name="Japanese yen", symbol="\u00a5"),
|
|
124
|
+
Currency(code="KES", num=404, conventional_decimals=2, name="Kenyan shilling", symbol="KSh"),
|
|
125
|
+
Currency(code="KGS", num=417, conventional_decimals=2, name="Kyrgyzstani som", symbol="\u20c0"),
|
|
126
|
+
Currency(code="KHR", num=116, conventional_decimals=2, name="Cambodian riel", symbol="\u17db"),
|
|
127
|
+
Currency(code="KMF", num=174, conventional_decimals=0, name="Comoro franc", symbol="FC"),
|
|
128
|
+
Currency(
|
|
129
|
+
code="KPW", num=408, conventional_decimals=2, name="North Korean won", symbol="\u20a9"
|
|
130
|
+
),
|
|
131
|
+
Currency(
|
|
132
|
+
code="KRW", num=410, conventional_decimals=0, name="South Korean won", symbol="\u20a9"
|
|
133
|
+
),
|
|
134
|
+
Currency(code="KWD", num=414, conventional_decimals=3, name="Kuwaiti dinar", symbol="KD"),
|
|
135
|
+
Currency(
|
|
136
|
+
code="KYD", num=136, conventional_decimals=2, name="Cayman Islands dollar", symbol="CI$"
|
|
137
|
+
),
|
|
138
|
+
Currency(
|
|
139
|
+
code="KZT", num=398, conventional_decimals=2, name="Kazakhstani tenge", symbol="\u20b8"
|
|
140
|
+
),
|
|
141
|
+
Currency(code="LAK", num=418, conventional_decimals=2, name="Lao kip", symbol="\u20ad "),
|
|
142
|
+
Currency(code="LBP", num=422, conventional_decimals=2, name="Lebanese pound", symbol="LL"),
|
|
143
|
+
Currency(
|
|
144
|
+
code="LKR", num=144, conventional_decimals=2, name="Sri Lankan rupee", symbol="\u20a8"
|
|
145
|
+
),
|
|
146
|
+
Currency(code="LRD", num=430, conventional_decimals=2, name="Liberian dollar", symbol="L$"),
|
|
147
|
+
Currency(code="LSL", num=426, conventional_decimals=2, name="Lesotho loti", symbol="L"),
|
|
148
|
+
Currency(code="LYD", num=434, conventional_decimals=3, name="Libyan dinar", symbol="LD"),
|
|
149
|
+
Currency(code="MAD", num=504, conventional_decimals=2, name="Moroccan dirham", symbol="Dh"),
|
|
150
|
+
Currency(code="MDL", num=498, conventional_decimals=2, name="Moldovan leu", symbol="L"),
|
|
151
|
+
Currency(code="MGA", num=969, conventional_decimals=2, name="Malagasy ariary", symbol="Ar"),
|
|
152
|
+
Currency(code="MKD", num=807, conventional_decimals=2, name="Macedonian denar", symbol="DEN"),
|
|
153
|
+
Currency(code="MMK", num=104, conventional_decimals=2, name="Myanmar kyat", symbol="K"),
|
|
154
|
+
Currency(
|
|
155
|
+
code="MNT", num=496, conventional_decimals=2, name="Mongolian tögrög", symbol="\u20ae"
|
|
156
|
+
),
|
|
157
|
+
Currency(code="MOP", num=446, conventional_decimals=2, name="Macanese pataca", symbol="$"),
|
|
158
|
+
Currency(code="MRU", num=929, conventional_decimals=2, name="Mauritanian ouguiya", symbol="UM"),
|
|
159
|
+
Currency(code="MUR", num=480, conventional_decimals=2, name="Mauritian rupee", symbol="\u20a8"),
|
|
160
|
+
Currency(code="MVR", num=462, conventional_decimals=2, name="Maldivian rufiyaa", symbol="Rf"),
|
|
161
|
+
Currency(code="MWK", num=454, conventional_decimals=2, name="Malawian kwacha", symbol="MK"),
|
|
162
|
+
Currency(code="MXN", num=484, conventional_decimals=2, name="Mexican peso", symbol="Mex$"),
|
|
163
|
+
Currency(
|
|
164
|
+
code="MXV",
|
|
165
|
+
num=979,
|
|
166
|
+
conventional_decimals=2,
|
|
167
|
+
name="Mexican Unidad de Inversion (UDI), (funds code),",
|
|
168
|
+
symbol=None,
|
|
169
|
+
),
|
|
170
|
+
Currency(code="MYR", num=458, conventional_decimals=2, name="Malaysian ringgit", symbol="RM"),
|
|
171
|
+
Currency(code="MZN", num=943, conventional_decimals=2, name="Mozambican metical", symbol="Mt"),
|
|
172
|
+
Currency(code="NAD", num=516, conventional_decimals=2, name="Namibian dollar", symbol="N$"),
|
|
173
|
+
Currency(code="NGN", num=566, conventional_decimals=2, name="Nigerian naira", symbol="\u20a6"),
|
|
174
|
+
Currency(code="NIO", num=558, conventional_decimals=2, name="Nicaraguan córdoba", symbol="C$"),
|
|
175
|
+
Currency(code="NOK", num=578, conventional_decimals=2, name="Norwegian krone", symbol="kr"),
|
|
176
|
+
Currency(code="NPR", num=524, conventional_decimals=2, name="Nepalese rupee", symbol="\u20b9"),
|
|
177
|
+
Currency(code="NZD", num=554, conventional_decimals=2, name="New Zealand dollar", symbol="$NZ"),
|
|
178
|
+
Currency(code="OMR", num=512, conventional_decimals=3, name="Omani rial", symbol="RO"),
|
|
179
|
+
Currency(code="PAB", num=590, conventional_decimals=2, name="Panamanian balboa", symbol="B/."),
|
|
180
|
+
Currency(code="PEN", num=604, conventional_decimals=2, name="Peruvian sol", symbol="S/"),
|
|
181
|
+
Currency(
|
|
182
|
+
code="PGK", num=598, conventional_decimals=2, name="Papua New Guinean kina", symbol="K"
|
|
183
|
+
),
|
|
184
|
+
Currency(code="PHP", num=608, conventional_decimals=2, name="Philippine peso", symbol="\u20b1"),
|
|
185
|
+
Currency(code="PKR", num=586, conventional_decimals=2, name="Pakistani rupee", symbol="Pre"),
|
|
186
|
+
Currency(code="PLN", num=985, conventional_decimals=2, name="Polish złoty", symbol="z\u0142"),
|
|
187
|
+
Currency(
|
|
188
|
+
code="PYG", num=600, conventional_decimals=0, name="Paraguayan guaraní", symbol="\u20b2"
|
|
189
|
+
),
|
|
190
|
+
Currency(code="QAR", num=634, conventional_decimals=2, name="Qatari riyal", symbol="QR"),
|
|
191
|
+
Currency(code="RON", num=946, conventional_decimals=2, name="Romanian leu", symbol=None),
|
|
192
|
+
Currency(code="RSD", num=941, conventional_decimals=2, name="Serbian dinar", symbol="DIN"),
|
|
193
|
+
Currency(code="RUB", num=643, conventional_decimals=2, name="Russian ruble", symbol="\u20bd"),
|
|
194
|
+
Currency(code="RWF", num=646, conventional_decimals=0, name="Rwandan franc", symbol="FRw"),
|
|
195
|
+
Currency(code="SAR", num=682, conventional_decimals=2, name="Saudi riyal", symbol="\u20c2"),
|
|
196
|
+
Currency(
|
|
197
|
+
code="SBD", num=90, conventional_decimals=2, name="Solomon Islands dollar", symbol="SI$"
|
|
198
|
+
),
|
|
199
|
+
Currency(code="SCR", num=690, conventional_decimals=2, name="Seychelles rupee", symbol="Sre"),
|
|
200
|
+
Currency(code="SDG", num=938, conventional_decimals=2, name="Sudanese pound", symbol="LS"),
|
|
201
|
+
Currency(code="SEK", num=752, conventional_decimals=2, name="Swedish krona", symbol="kr"),
|
|
202
|
+
Currency(code="SGD", num=702, conventional_decimals=2, name="Singapore dollar", symbol="S$"),
|
|
203
|
+
Currency(
|
|
204
|
+
code="SHP", num=654, conventional_decimals=2, name="Saint Helena pound", symbol="\u00a3"
|
|
205
|
+
),
|
|
206
|
+
Currency(
|
|
207
|
+
code="SLE", num=925, conventional_decimals=2, name="Sierra Leonean leone", symbol="Le"
|
|
208
|
+
),
|
|
209
|
+
Currency(
|
|
210
|
+
code="SOS", num=706, conventional_decimals=2, name="Somalian shilling", symbol="Sh.So."
|
|
211
|
+
),
|
|
212
|
+
Currency(code="SRD", num=968, conventional_decimals=2, name="Surinamese dollar", symbol=None),
|
|
213
|
+
Currency(
|
|
214
|
+
code="SSP", num=728, conventional_decimals=2, name="South Sudanese pound", symbol="SSP"
|
|
215
|
+
),
|
|
216
|
+
Currency(
|
|
217
|
+
code="STN",
|
|
218
|
+
num=930,
|
|
219
|
+
conventional_decimals=2,
|
|
220
|
+
name="São Tomé and Príncipe dobra",
|
|
221
|
+
symbol="Db",
|
|
222
|
+
),
|
|
223
|
+
Currency(
|
|
224
|
+
code="SVC", num=222, conventional_decimals=2, name="Salvadoran colón", symbol="\u20a1"
|
|
225
|
+
),
|
|
226
|
+
Currency(code="SYP", num=760, conventional_decimals=2, name="Syrian pound", symbol="LS"),
|
|
227
|
+
Currency(code="SZL", num=748, conventional_decimals=2, name="Swazi lilangeni", symbol="E"),
|
|
228
|
+
Currency(code="THB", num=764, conventional_decimals=2, name="Thai baht", symbol="\u0e3f"),
|
|
229
|
+
Currency(code="TJS", num=972, conventional_decimals=2, name="Tajikistani somoni", symbol="SM"),
|
|
230
|
+
Currency(
|
|
231
|
+
code="TMT", num=934, conventional_decimals=2, name="Turkmenistan manat", symbol="\u20bc"
|
|
232
|
+
),
|
|
233
|
+
Currency(code="TND", num=788, conventional_decimals=3, name="Tunisian dinar", symbol="DT"),
|
|
234
|
+
Currency(code="TOP", num=776, conventional_decimals=2, name="Tongan paʻanga", symbol="T$"),
|
|
235
|
+
Currency(code="TRY", num=949, conventional_decimals=2, name="Turkish lira", symbol="\u20ba"),
|
|
236
|
+
Currency(
|
|
237
|
+
code="TTD",
|
|
238
|
+
num=780,
|
|
239
|
+
conventional_decimals=2,
|
|
240
|
+
name="Trinidad and Tobago dollar",
|
|
241
|
+
symbol="TT$",
|
|
242
|
+
),
|
|
243
|
+
Currency(code="TWD", num=901, conventional_decimals=2, name="New Taiwan dollar", symbol="NT$"),
|
|
244
|
+
Currency(code="TZS", num=834, conventional_decimals=2, name="Tanzanian shilling", symbol="TSh"),
|
|
245
|
+
Currency(
|
|
246
|
+
code="UAH", num=980, conventional_decimals=2, name="Ukrainian hryvnia", symbol="\u20b4"
|
|
247
|
+
),
|
|
248
|
+
Currency(code="UGX", num=800, conventional_decimals=0, name="Ugandan shilling", symbol="Ush"),
|
|
249
|
+
Currency(code="USD", num=840, conventional_decimals=2, name="United States dollar", symbol="$"),
|
|
250
|
+
Currency(
|
|
251
|
+
code="USN",
|
|
252
|
+
num=997,
|
|
253
|
+
conventional_decimals=2,
|
|
254
|
+
name="United States dollar (next day),",
|
|
255
|
+
symbol="$",
|
|
256
|
+
),
|
|
257
|
+
Currency(
|
|
258
|
+
code="UYI",
|
|
259
|
+
num=940,
|
|
260
|
+
conventional_decimals=0,
|
|
261
|
+
name="Uruguay Peso en Unidades Indexadas (URUIURUI), (funds code),",
|
|
262
|
+
symbol=None,
|
|
263
|
+
),
|
|
264
|
+
Currency(code="UYU", num=858, conventional_decimals=2, name="Uruguayan peso", symbol="$U"),
|
|
265
|
+
Currency(code="UYW", num=927, conventional_decimals=4, name="Unidad previsional", symbol=None),
|
|
266
|
+
Currency(code="UZS", num=860, conventional_decimals=2, name="Uzbekistani sum", symbol="sum"),
|
|
267
|
+
Currency(
|
|
268
|
+
code="VED", num=926, conventional_decimals=2, name="Venezuelan digital bolívar", symbol="Bs"
|
|
269
|
+
),
|
|
270
|
+
Currency(
|
|
271
|
+
code="VES",
|
|
272
|
+
num=928,
|
|
273
|
+
conventional_decimals=2,
|
|
274
|
+
name="Venezuelan sovereign bolívar",
|
|
275
|
+
symbol="Bs",
|
|
276
|
+
),
|
|
277
|
+
Currency(code="VND", num=704, conventional_decimals=0, name="Vietnamese đồng", symbol="\u20ab"),
|
|
278
|
+
Currency(code="VUV", num=548, conventional_decimals=0, name="Vanuatu vatu", symbol="VT"),
|
|
279
|
+
Currency(code="WST", num=882, conventional_decimals=2, name="Samoan tala", symbol="WS$"),
|
|
280
|
+
Currency(code="XAF", num=950, conventional_decimals=0, name="CFA franc BEAC", symbol=None),
|
|
281
|
+
Currency(code="XAG", num=961, conventional_decimals=3, name="Silver", symbol=None),
|
|
282
|
+
Currency(code="XAU", num=959, conventional_decimals=3, name="Gold", symbol=None),
|
|
283
|
+
Currency(
|
|
284
|
+
code="XBA",
|
|
285
|
+
num=955,
|
|
286
|
+
conventional_decimals=3,
|
|
287
|
+
name="European Composite Unit (EURCO), (bond market unit),",
|
|
288
|
+
symbol=None,
|
|
289
|
+
),
|
|
290
|
+
Currency(
|
|
291
|
+
code="XBB",
|
|
292
|
+
num=956,
|
|
293
|
+
conventional_decimals=3,
|
|
294
|
+
name="European Monetary Unit (E.M.U.-6), (bond market unit),",
|
|
295
|
+
symbol=None,
|
|
296
|
+
),
|
|
297
|
+
Currency(
|
|
298
|
+
code="XBC",
|
|
299
|
+
num=957,
|
|
300
|
+
conventional_decimals=3,
|
|
301
|
+
name="European Unit of Account 9 (E.U.A.-9), (bond market unit),",
|
|
302
|
+
symbol=None,
|
|
303
|
+
),
|
|
304
|
+
Currency(
|
|
305
|
+
code="XBD",
|
|
306
|
+
num=958,
|
|
307
|
+
conventional_decimals=3,
|
|
308
|
+
name="European Unit of Account 17 (E.U.A.-17), (bond market unit),",
|
|
309
|
+
symbol=None,
|
|
310
|
+
),
|
|
311
|
+
Currency(
|
|
312
|
+
code="XCD", num=951, conventional_decimals=2, name="East Caribbean dollar", symbol="EC$"
|
|
313
|
+
),
|
|
314
|
+
Currency(
|
|
315
|
+
code="XCG",
|
|
316
|
+
num=532,
|
|
317
|
+
conventional_decimals=2,
|
|
318
|
+
name="Netherlands Antillean guilder",
|
|
319
|
+
symbol="\u0192",
|
|
320
|
+
),
|
|
321
|
+
Currency(
|
|
322
|
+
code="XDR", num=960, conventional_decimals=3, name="Special drawing rights", symbol=None
|
|
323
|
+
),
|
|
324
|
+
Currency(code="XOF", num=952, conventional_decimals=0, name="CFA franc BCEAO", symbol=None),
|
|
325
|
+
Currency(code="XPD", num=964, conventional_decimals=3, name="Palladium", symbol=None),
|
|
326
|
+
Currency(
|
|
327
|
+
code="XPF",
|
|
328
|
+
num=953,
|
|
329
|
+
conventional_decimals=0,
|
|
330
|
+
name="CFP franc (franc Pacifique),",
|
|
331
|
+
symbol="F",
|
|
332
|
+
),
|
|
333
|
+
Currency(code="XPT", num=962, conventional_decimals=3, name="Platinum", symbol=None),
|
|
334
|
+
Currency(code="XSU", num=994, conventional_decimals=3, name="SUCRE", symbol=None),
|
|
335
|
+
Currency(
|
|
336
|
+
code="XTS", num=963, conventional_decimals=3, name="Code reserved for testing", symbol=None
|
|
337
|
+
),
|
|
338
|
+
Currency(code="XUA", num=965, conventional_decimals=3, name="ADB Unit of Account", symbol=None),
|
|
339
|
+
Currency(code="XXX", num=999, conventional_decimals=3, name="No currency", symbol=None),
|
|
340
|
+
Currency(code="YER", num=886, conventional_decimals=2, name="Yemeni rial", symbol="Yrl"),
|
|
341
|
+
Currency(code="ZAR", num=710, conventional_decimals=2, name="South African rand", symbol="R"),
|
|
342
|
+
Currency(code="ZMW", num=967, conventional_decimals=2, name="Zambian kwacha", symbol="K"),
|
|
343
|
+
Currency(code="ZWG", num=924, conventional_decimals=2, name="Zimbabwe Gold", symbol="ZiG"),
|
|
344
|
+
]
|
|
345
|
+
ISO_CODE_TO_CURRENCY = {c.code: c for c in CURRENCIES}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from typing import TypedDict
|
|
2
|
+
|
|
3
|
+
from strenum import StrEnum
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class PeriodType(StrEnum):
|
|
7
|
+
"""The period type"""
|
|
8
|
+
|
|
9
|
+
annual = "annual"
|
|
10
|
+
quarterly = "quarterly"
|
|
11
|
+
ltm = "ltm"
|
|
12
|
+
ytd = "ytd"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class Periodicity(StrEnum):
|
|
16
|
+
"""The frequency or interval at which the historical data points are sampled or aggregated. Periodicity is not the same as the date range. The date range specifies the time span over which the data is retrieved, while periodicity determines how the data within that date range is aggregated."""
|
|
17
|
+
|
|
18
|
+
day = "day"
|
|
19
|
+
week = "week"
|
|
20
|
+
month = "month"
|
|
21
|
+
year = "year"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class YearAndQuarter(TypedDict):
|
|
25
|
+
year: int
|
|
26
|
+
quarter: int
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class LatestAnnualPeriod(TypedDict):
|
|
30
|
+
latest_year: int
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class LatestQuarterlyPeriod(TypedDict):
|
|
34
|
+
latest_quarter: int
|
|
35
|
+
latest_year: int
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class CurrentPeriod(TypedDict):
|
|
39
|
+
current_year: int
|
|
40
|
+
current_quarter: int
|
|
41
|
+
current_month: int
|
|
42
|
+
current_date: str
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class LatestPeriods(TypedDict):
|
|
46
|
+
annual: LatestAnnualPeriod
|
|
47
|
+
quarterly: LatestQuarterlyPeriod
|
|
48
|
+
now: CurrentPeriod
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
from datetime import date
|
|
2
1
|
from itertools import chain
|
|
3
|
-
from typing import
|
|
4
|
-
|
|
5
|
-
from strenum import StrEnum
|
|
2
|
+
from typing import TypedDict
|
|
6
3
|
|
|
7
4
|
|
|
8
5
|
class LineItemType(TypedDict):
|
|
@@ -12,150 +9,6 @@ class LineItemType(TypedDict):
|
|
|
12
9
|
spgi_name: str
|
|
13
10
|
|
|
14
11
|
|
|
15
|
-
class HistoryMetadata(TypedDict):
|
|
16
|
-
currency: str
|
|
17
|
-
symbol: str
|
|
18
|
-
exchange_name: str
|
|
19
|
-
instrument_type: str
|
|
20
|
-
first_trade_date: date
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class IdentificationTriple(NamedTuple):
|
|
24
|
-
trading_item_id: int
|
|
25
|
-
security_id: int
|
|
26
|
-
company_id: int
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class Capitalization(StrEnum):
|
|
30
|
-
"""The capitalization type"""
|
|
31
|
-
|
|
32
|
-
market_cap = "market_cap"
|
|
33
|
-
tev = "tev"
|
|
34
|
-
shares_outstanding = "shares_outstanding"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
class PeriodType(StrEnum):
|
|
38
|
-
"""The period type"""
|
|
39
|
-
|
|
40
|
-
annual = "annual"
|
|
41
|
-
quarterly = "quarterly"
|
|
42
|
-
ltm = "ltm"
|
|
43
|
-
ytd = "ytd"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
class Periodicity(StrEnum):
|
|
47
|
-
"""The frequency or interval at which the historical data points are sampled or aggregated. Periodicity is not the same as the date range. The date range specifies the time span over which the data is retrieved, while periodicity determines how the data within that date range is aggregated."""
|
|
48
|
-
|
|
49
|
-
day = "day"
|
|
50
|
-
week = "week"
|
|
51
|
-
month = "month"
|
|
52
|
-
year = "year"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
class StatementType(StrEnum):
|
|
56
|
-
"""The type of financial statement"""
|
|
57
|
-
|
|
58
|
-
balance_sheet = "balance_sheet"
|
|
59
|
-
income_statement = "income_statement"
|
|
60
|
-
cashflow = "cashflow"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
class SegmentType(StrEnum):
|
|
64
|
-
"""The type of segment"""
|
|
65
|
-
|
|
66
|
-
business = "business"
|
|
67
|
-
geographic = "geographic"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
class BusinessRelationshipType(StrEnum):
|
|
71
|
-
"""The type of business relationship"""
|
|
72
|
-
|
|
73
|
-
supplier = "supplier"
|
|
74
|
-
customer = "customer"
|
|
75
|
-
distributor = "distributor"
|
|
76
|
-
franchisor = "franchisor"
|
|
77
|
-
franchisee = "franchisee"
|
|
78
|
-
landlord = "landlord"
|
|
79
|
-
tenant = "tenant"
|
|
80
|
-
licensor = "licensor"
|
|
81
|
-
licensee = "licensee"
|
|
82
|
-
creditor = "creditor"
|
|
83
|
-
borrower = "borrower"
|
|
84
|
-
lessor = "lessor"
|
|
85
|
-
lessee = "lessee"
|
|
86
|
-
strategic_alliance = "strategic_alliance"
|
|
87
|
-
investor_relations_firm = "investor_relations_firm"
|
|
88
|
-
investor_relations_client = "investor_relations_client"
|
|
89
|
-
transfer_agent = "transfer_agent"
|
|
90
|
-
transfer_agent_client = "transfer_agent_client"
|
|
91
|
-
vendor = "vendor"
|
|
92
|
-
client_services = "client_services"
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
class Permission(StrEnum):
|
|
96
|
-
EarningsPermission = "EarningsPermission"
|
|
97
|
-
TranscriptsPermission = "TranscriptsPermission"
|
|
98
|
-
GICSPermission = "GICSPermission"
|
|
99
|
-
IDPermission = "IDPermission"
|
|
100
|
-
ISCRSPermission = "ISCRSPermission"
|
|
101
|
-
PricingPermission = "PricingPermission"
|
|
102
|
-
RelationshipPermission = "RelationshipPermission"
|
|
103
|
-
StatementsPermission = "StatementsPermission"
|
|
104
|
-
SegmentsPermission = "SegmentsPermission"
|
|
105
|
-
MergersPermission = "MergersPermission"
|
|
106
|
-
CompetitorsPermission = "CompetitorsPermission"
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
class CompetitorSource(StrEnum):
|
|
110
|
-
"""The source type of the competitor information: 'filing' (from SEC filings), 'key_dev' (from key developments), 'contact' (from contact relationships), 'third_party' (from third-party sources), 'self_identified' (self-identified), 'named_by_competitor' (from competitor's perspective)."""
|
|
111
|
-
|
|
112
|
-
all = "all"
|
|
113
|
-
filing = "filing"
|
|
114
|
-
key_dev = "key_dev"
|
|
115
|
-
contact = "contact"
|
|
116
|
-
third_party = "third_party"
|
|
117
|
-
self_identified = "self_identified"
|
|
118
|
-
named_by_competitor = "named_by_competitor"
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
class YearAndQuarter(TypedDict):
|
|
122
|
-
year: int
|
|
123
|
-
quarter: int
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
class LatestAnnualPeriod(TypedDict):
|
|
127
|
-
latest_year: int
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
class LatestQuarterlyPeriod(TypedDict):
|
|
131
|
-
latest_quarter: int
|
|
132
|
-
latest_year: int
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
class CurrentPeriod(TypedDict):
|
|
136
|
-
current_year: int
|
|
137
|
-
current_quarter: int
|
|
138
|
-
current_month: int
|
|
139
|
-
current_date: str
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
class LatestPeriods(TypedDict):
|
|
143
|
-
annual: LatestAnnualPeriod
|
|
144
|
-
quarterly: LatestQuarterlyPeriod
|
|
145
|
-
now: CurrentPeriod
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
class IndustryClassification(StrEnum):
|
|
149
|
-
sic = "sic"
|
|
150
|
-
naics = "naics"
|
|
151
|
-
nace = "nace"
|
|
152
|
-
anzsic = "anzsic"
|
|
153
|
-
spcapiqetf = "spcapiqetf"
|
|
154
|
-
spratings = "spratings"
|
|
155
|
-
gics = "gics"
|
|
156
|
-
simple = "simple"
|
|
157
|
-
|
|
158
|
-
|
|
159
12
|
# all of these values must be lower case keys
|
|
160
13
|
LINE_ITEMS: list[LineItemType] = [
|
|
161
14
|
{
|
|
@@ -1740,23 +1593,6 @@ LINE_ITEMS: list[LineItemType] = [
|
|
|
1740
1593
|
"spgi_name": "Total Debt/Equity",
|
|
1741
1594
|
},
|
|
1742
1595
|
]
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
1596
|
LINE_ITEM_NAMES_AND_ALIASES: list[str] = list(
|
|
1746
1597
|
chain(*[[line_item["name"]] + list(line_item["aliases"]) for line_item in LINE_ITEMS])
|
|
1747
1598
|
)
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
FINANCIAL_STATEMENTS: dict[str, int] = {
|
|
1751
|
-
"income_statement": 1,
|
|
1752
|
-
"balance_sheet": 2,
|
|
1753
|
-
"cash_flow": 3,
|
|
1754
|
-
}
|
|
1755
|
-
|
|
1756
|
-
FINANCIAL_STATEMENTS_SYNONYMS: dict[str, int] = {
|
|
1757
|
-
"is": 1,
|
|
1758
|
-
"bs": 2,
|
|
1759
|
-
"cf": 3,
|
|
1760
|
-
"income_stmt": 1,
|
|
1761
|
-
"cashflow": 3,
|
|
1762
|
-
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from strenum import StrEnum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Permission(StrEnum):
|
|
5
|
+
CompetitorsPermission = "CompetitorsPermission"
|
|
6
|
+
EarningsPermission = "EarningsPermission"
|
|
7
|
+
GICSPermission = "GICSPermission"
|
|
8
|
+
IDPermission = "IDPermission"
|
|
9
|
+
ISCRSPermission = "ISCRSPermission"
|
|
10
|
+
MergersPermission = "MergersPermission"
|
|
11
|
+
PricingPermission = "PricingPermission"
|
|
12
|
+
RelationshipPermission = "RelationshipPermission"
|
|
13
|
+
SegmentsPermission = "SegmentsPermission"
|
|
14
|
+
StatementsPermission = "StatementsPermission"
|
|
15
|
+
TranscriptsPermission = "TranscriptsPermission"
|