|
1
|
|
|
# ================================================================================== # |
|
2
|
|
|
# key_statistics.py - This file is part of the yfrake package. # |
|
3
|
|
|
# ================================================================================== # |
|
4
|
|
|
# # |
|
5
|
|
|
# MIT License # |
|
6
|
|
|
# # |
|
7
|
|
|
# Copyright (c) 2022 Mattias Aabmets # |
|
8
|
|
|
# # |
|
9
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy # |
|
10
|
|
|
# of this software and associated documentation files (the "Software"), to deal # |
|
11
|
|
|
# in the Software without restriction, including without limitation the rights # |
|
12
|
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # |
|
13
|
|
|
# copies of the Software, and to permit persons to whom the Software is # |
|
14
|
|
|
# furnished to do so, subject to the following conditions: # |
|
15
|
|
|
# # |
|
16
|
|
|
# The above copyright notice and this permission notice shall be included in all # |
|
17
|
|
|
# copies or substantial portions of the Software. # |
|
18
|
|
|
# # |
|
19
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # |
|
20
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # |
|
21
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # |
|
22
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # |
|
23
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # |
|
24
|
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # |
|
25
|
|
|
# SOFTWARE. # |
|
26
|
|
|
# # |
|
27
|
|
|
# ================================================================================== # |
|
28
|
|
|
summary = 'Key Statistics' |
|
29
|
|
|
description = 'Returns the key statistics of a security identifier.' |
|
30
|
|
|
|
|
31
|
|
|
# ---------------------------------------------------------------------------------- # |
|
32
|
|
|
parameters = [ |
|
33
|
|
|
{ |
|
34
|
|
|
'name': 'symbol', |
|
35
|
|
|
'description': 'Any valid equity security identifier.', |
|
36
|
|
|
'required': True, |
|
37
|
|
|
'in': 'query', |
|
38
|
|
|
'schema': { |
|
39
|
|
|
'type': str |
|
40
|
|
|
} |
|
41
|
|
|
} |
|
42
|
|
|
] |
|
43
|
|
|
|
|
44
|
|
|
# ---------------------------------------------------------------------------------- # |
|
45
|
|
|
response = { |
|
46
|
|
|
'maxAge': int, |
|
47
|
|
|
'priceHint': { |
|
48
|
|
|
'raw': int, |
|
49
|
|
|
'fmt': str, |
|
50
|
|
|
'longFmt': str |
|
51
|
|
|
}, |
|
52
|
|
|
'enterpriseValue': { |
|
53
|
|
|
'raw': int, |
|
54
|
|
|
'fmt': str, |
|
55
|
|
|
'longFmt': str |
|
56
|
|
|
}, |
|
57
|
|
|
'forwardPE': { |
|
58
|
|
|
'raw': float, |
|
59
|
|
|
'fmt': str |
|
60
|
|
|
}, |
|
61
|
|
|
'profitMargins': { |
|
62
|
|
|
'raw': float, |
|
63
|
|
|
'fmt': str |
|
64
|
|
|
}, |
|
65
|
|
|
'floatShares': { |
|
66
|
|
|
'raw': int, |
|
67
|
|
|
'fmt': str, |
|
68
|
|
|
'longFmt': str |
|
69
|
|
|
}, |
|
70
|
|
|
'sharesOutstanding': { |
|
71
|
|
|
'raw': int, |
|
72
|
|
|
'fmt': str, |
|
73
|
|
|
'longFmt': str |
|
74
|
|
|
}, |
|
75
|
|
|
'sharesShort': { |
|
76
|
|
|
'raw': int, |
|
77
|
|
|
'fmt': str, |
|
78
|
|
|
'longFmt': str |
|
79
|
|
|
}, |
|
80
|
|
|
'sharesShortPriorMonth': { |
|
81
|
|
|
'raw': int, |
|
82
|
|
|
'fmt': str, |
|
83
|
|
|
'longFmt': str |
|
84
|
|
|
}, |
|
85
|
|
|
'sharesShortPreviousMonthDate': { |
|
86
|
|
|
'raw': int, |
|
87
|
|
|
'fmt': str |
|
88
|
|
|
}, |
|
89
|
|
|
'dateShortInterest': { |
|
90
|
|
|
'raw': int, |
|
91
|
|
|
'fmt': str |
|
92
|
|
|
}, |
|
93
|
|
|
'sharesPercentSharesOut': { |
|
94
|
|
|
'raw': float, |
|
95
|
|
|
'fmt': str |
|
96
|
|
|
}, |
|
97
|
|
|
'heldPercentInsiders': { |
|
98
|
|
|
'raw': float, |
|
99
|
|
|
'fmt': str |
|
100
|
|
|
}, |
|
101
|
|
|
'heldPercentInstitutions': { |
|
102
|
|
|
'raw': float, |
|
103
|
|
|
'fmt': str |
|
104
|
|
|
}, |
|
105
|
|
|
'shortRatio': { |
|
106
|
|
|
'raw': float, |
|
107
|
|
|
'fmt': str |
|
108
|
|
|
}, |
|
109
|
|
|
'shortPercentOfFloat': { |
|
110
|
|
|
'raw': float, |
|
111
|
|
|
'fmt': str |
|
112
|
|
|
}, |
|
113
|
|
|
'beta': { |
|
114
|
|
|
'raw': float, |
|
115
|
|
|
'fmt': str |
|
116
|
|
|
}, |
|
117
|
|
|
'impliedSharesOutstanding': { |
|
118
|
|
|
'raw': int, |
|
119
|
|
|
'fmt': str, |
|
120
|
|
|
'longFmt': str |
|
121
|
|
|
}, |
|
122
|
|
|
'morningStarOverallRating': dict, |
|
123
|
|
|
'morningStarRiskRating': dict, |
|
124
|
|
|
'category': dict, |
|
125
|
|
|
'bookValue': { |
|
126
|
|
|
'raw': float, |
|
127
|
|
|
'fmt': str |
|
128
|
|
|
}, |
|
129
|
|
|
'priceToBook': { |
|
130
|
|
|
'raw': float, |
|
131
|
|
|
'fmt': str |
|
132
|
|
|
}, |
|
133
|
|
|
'annualReportExpenseRatio': dict, |
|
134
|
|
|
'ytdReturn': dict, |
|
135
|
|
|
'beta3Year': dict, |
|
136
|
|
|
'totalAssets': dict, |
|
137
|
|
|
'yield': dict, |
|
138
|
|
|
'fundFamily': dict, |
|
139
|
|
|
'fundInceptionDate': dict, |
|
140
|
|
|
'legalType': dict, |
|
141
|
|
|
'threeYearAverageReturn': dict, |
|
142
|
|
|
'fiveYearAverageReturn': dict, |
|
143
|
|
|
'priceToSalesTrailing12Months': dict, |
|
144
|
|
|
'lastFiscalYearEnd': { |
|
145
|
|
|
'raw': int, |
|
146
|
|
|
'fmt': str |
|
147
|
|
|
}, |
|
148
|
|
|
'nextFiscalYearEnd': { |
|
149
|
|
|
'raw': int, |
|
150
|
|
|
'fmt': str |
|
151
|
|
|
}, |
|
152
|
|
|
'mostRecentQuarter': { |
|
153
|
|
|
'raw': int, |
|
154
|
|
|
'fmt': str |
|
155
|
|
|
}, |
|
156
|
|
|
'earningsQuarterlyGrowth': { |
|
157
|
|
|
'raw': float, |
|
158
|
|
|
'fmt': str |
|
159
|
|
|
}, |
|
160
|
|
|
'revenueQuarterlyGrowth': dict, |
|
161
|
|
|
'netIncomeToCommon': { |
|
162
|
|
|
'raw': int, |
|
163
|
|
|
'fmt': str, |
|
164
|
|
|
'longFmt': str |
|
165
|
|
|
}, |
|
166
|
|
|
'trailingEps': { |
|
167
|
|
|
'raw': float, |
|
168
|
|
|
'fmt': str |
|
169
|
|
|
}, |
|
170
|
|
|
'forwardEps': { |
|
171
|
|
|
'raw': float, |
|
172
|
|
|
'fmt': str |
|
173
|
|
|
}, |
|
174
|
|
|
'pegRatio': { |
|
175
|
|
|
'raw': float, |
|
176
|
|
|
'fmt': str |
|
177
|
|
|
}, |
|
178
|
|
|
'lastSplitFactor': str, |
|
179
|
|
|
'lastSplitDate': { |
|
180
|
|
|
'raw': int, |
|
181
|
|
|
'fmt': str |
|
182
|
|
|
}, |
|
183
|
|
|
'enterpriseToRevenue': { |
|
184
|
|
|
'raw': float, |
|
185
|
|
|
'fmt': str |
|
186
|
|
|
}, |
|
187
|
|
|
'enterpriseToEbitda': { |
|
188
|
|
|
'raw': float, |
|
189
|
|
|
'fmt': str |
|
190
|
|
|
}, |
|
191
|
|
|
'52WeekChange': { |
|
192
|
|
|
'raw': float, |
|
193
|
|
|
'fmt': str |
|
194
|
|
|
}, |
|
195
|
|
|
'SandP52WeekChange': { |
|
196
|
|
|
'raw': float, |
|
197
|
|
|
'fmt': str |
|
198
|
|
|
}, |
|
199
|
|
|
'lastDividendValue': { |
|
200
|
|
|
'raw': float, |
|
201
|
|
|
'fmt': str |
|
202
|
|
|
}, |
|
203
|
|
|
'lastDividendDate': { |
|
204
|
|
|
'raw': int, |
|
205
|
|
|
'fmt': str |
|
206
|
|
|
}, |
|
207
|
|
|
'lastCapGain': dict, |
|
208
|
|
|
'annualHoldingsTurnover': dict |
|
209
|
|
|
} |
|
210
|
|
|
|