1
|
|
|
# ================================================================================== # |
2
|
|
|
# earnings.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 = 'Earnings' |
29
|
|
|
description = 'Returns the earnings 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
|
|
|
'earningsChart': { |
48
|
|
|
'quarterly': [ |
49
|
|
|
{ |
50
|
|
|
'date': str, |
51
|
|
|
'actual': { |
52
|
|
|
'raw': float, |
53
|
|
|
'fmt': str |
54
|
|
|
}, |
55
|
|
|
'estimate': { |
56
|
|
|
'raw': float, |
57
|
|
|
'fmt': str |
58
|
|
|
} |
59
|
|
|
}, |
60
|
|
|
{ |
61
|
|
|
'date': str, |
62
|
|
|
'actual': { |
63
|
|
|
'raw': float, |
64
|
|
|
'fmt': str |
65
|
|
|
}, |
66
|
|
|
'estimate': { |
67
|
|
|
'raw': float, |
68
|
|
|
'fmt': str |
69
|
|
|
} |
70
|
|
|
}, |
71
|
|
|
{ |
72
|
|
|
'date': str, |
73
|
|
|
'actual': { |
74
|
|
|
'raw': float, |
75
|
|
|
'fmt': str |
76
|
|
|
}, |
77
|
|
|
'estimate': { |
78
|
|
|
'raw': float, |
79
|
|
|
'fmt': str |
80
|
|
|
} |
81
|
|
|
}, |
82
|
|
|
{ |
83
|
|
|
'date': str, |
84
|
|
|
'actual': { |
85
|
|
|
'raw': float, |
86
|
|
|
'fmt': str |
87
|
|
|
}, |
88
|
|
|
'estimate': { |
89
|
|
|
'raw': float, |
90
|
|
|
'fmt': str |
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
], |
94
|
|
|
'currentQuarterEstimate': { |
95
|
|
|
'raw': float, |
96
|
|
|
'fmt': str |
97
|
|
|
}, |
98
|
|
|
'currentQuarterEstimateDate': str, |
99
|
|
|
'currentQuarterEstimateYear': int, |
100
|
|
|
'earningsDate': [ |
101
|
|
|
{ |
102
|
|
|
'raw': int, |
103
|
|
|
'fmt': str |
104
|
|
|
}, |
105
|
|
|
{ |
106
|
|
|
'raw': int, |
107
|
|
|
'fmt': str |
108
|
|
|
} |
109
|
|
|
] |
110
|
|
|
}, |
111
|
|
|
'financialsChart': { |
112
|
|
|
'yearly': [ |
113
|
|
|
{ |
114
|
|
|
'date': int, |
115
|
|
|
'revenue': { |
116
|
|
|
'raw': int, |
117
|
|
|
'fmt': str, |
118
|
|
|
'longFmt': str |
119
|
|
|
}, |
120
|
|
|
'earnings': { |
121
|
|
|
'raw': int, |
122
|
|
|
'fmt': str, |
123
|
|
|
'longFmt': str |
124
|
|
|
} |
125
|
|
|
}, |
126
|
|
|
{ |
127
|
|
|
'date': int, |
128
|
|
|
'revenue': { |
129
|
|
|
'raw': int, |
130
|
|
|
'fmt': str, |
131
|
|
|
'longFmt': str |
132
|
|
|
}, |
133
|
|
|
'earnings': { |
134
|
|
|
'raw': int, |
135
|
|
|
'fmt': str, |
136
|
|
|
'longFmt': str |
137
|
|
|
} |
138
|
|
|
}, |
139
|
|
|
{ |
140
|
|
|
'date': int, |
141
|
|
|
'revenue': { |
142
|
|
|
'raw': int, |
143
|
|
|
'fmt': str, |
144
|
|
|
'longFmt': str |
145
|
|
|
}, |
146
|
|
|
'earnings': { |
147
|
|
|
'raw': int, |
148
|
|
|
'fmt': str, |
149
|
|
|
'longFmt': str |
150
|
|
|
} |
151
|
|
|
}, |
152
|
|
|
{ |
153
|
|
|
'date': int, |
154
|
|
|
'revenue': { |
155
|
|
|
'raw': int, |
156
|
|
|
'fmt': str, |
157
|
|
|
'longFmt': str |
158
|
|
|
}, |
159
|
|
|
'earnings': { |
160
|
|
|
'raw': int, |
161
|
|
|
'fmt': str, |
162
|
|
|
'longFmt': str |
163
|
|
|
} |
164
|
|
|
} |
165
|
|
|
], |
166
|
|
|
'quarterly': [ |
167
|
|
|
{ |
168
|
|
|
'date': str, |
169
|
|
|
'revenue': { |
170
|
|
|
'raw': int, |
171
|
|
|
'fmt': str, |
172
|
|
|
'longFmt': str |
173
|
|
|
}, |
174
|
|
|
'earnings': { |
175
|
|
|
'raw': int, |
176
|
|
|
'fmt': str, |
177
|
|
|
'longFmt': str |
178
|
|
|
} |
179
|
|
|
}, |
180
|
|
|
{ |
181
|
|
|
'date': str, |
182
|
|
|
'revenue': { |
183
|
|
|
'raw': int, |
184
|
|
|
'fmt': str, |
185
|
|
|
'longFmt': str |
186
|
|
|
}, |
187
|
|
|
'earnings': { |
188
|
|
|
'raw': int, |
189
|
|
|
'fmt': str, |
190
|
|
|
'longFmt': str |
191
|
|
|
} |
192
|
|
|
}, |
193
|
|
|
{ |
194
|
|
|
'date': str, |
195
|
|
|
'revenue': { |
196
|
|
|
'raw': int, |
197
|
|
|
'fmt': str, |
198
|
|
|
'longFmt': str |
199
|
|
|
}, |
200
|
|
|
'earnings': { |
201
|
|
|
'raw': int, |
202
|
|
|
'fmt': str, |
203
|
|
|
'longFmt': str |
204
|
|
|
} |
205
|
|
|
}, |
206
|
|
|
{ |
207
|
|
|
'date': str, |
208
|
|
|
'revenue': { |
209
|
|
|
'raw': int, |
210
|
|
|
'fmt': str, |
211
|
|
|
'longFmt': str |
212
|
|
|
}, |
213
|
|
|
'earnings': { |
214
|
|
|
'raw': int, |
215
|
|
|
'fmt': str, |
216
|
|
|
'longFmt': str |
217
|
|
|
} |
218
|
|
|
} |
219
|
|
|
] |
220
|
|
|
}, |
221
|
|
|
'financialCurrency': str |
222
|
|
|
} |
223
|
|
|
|