Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] Intrinio Balance Sheet Period #6343

Merged
merged 2 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ class IntrinioBalanceSheetQueryParams(BalanceSheetQueryParams):
description="The specific fiscal year. Reports do not go beyond 2008.",
)

@field_validator("period", mode="after", check_fields=False)
@classmethod
def validate_period(cls, v):
"""Validate period."""
v = "FY" if v == "annual" else "QTR"
return v

@field_validator("symbol", mode="after", check_fields=False)
@classmethod
def handle_symbol(cls, v) -> str:
Expand Down Expand Up @@ -428,9 +421,9 @@ async def aextract_data(
"""Return the raw data from the Intrinio endpoint."""
api_key = credentials.get("intrinio_api_key") if credentials else ""
statement_code = "balance_sheet_statement"
period = "FY" if query.period == "annual" else "QTR"
fundamentals_data: Dict = {}
base_url = "https://api-v2.intrinio.com"
period = "FY" if query.period == "annual" else "QTR"
fundamentals_url = (
f"{base_url}/companies/{query.symbol}/fundamentals?"
f"statement_code={statement_code}&type={period}"
Expand All @@ -444,7 +437,6 @@ async def aextract_data(
fundamentals_data = (await get_data_one(fundamentals_url, **kwargs)).get(
"fundamentals", []
)

fiscal_periods = [
f"{item['fiscal_year']}-{item['fiscal_period']}"
for item in fundamentals_data
Expand All @@ -462,8 +454,8 @@ async def callback(response: ClientResponse, _: Any) -> Dict:
}

urls = [
f"{base_url}/fundamentals/{query.symbol}-{statement_code}-{period}/standardized_financials?api_key={api_key}"
for period in fiscal_periods
f"{base_url}/fundamentals/{query.symbol}-{statement_code}-{p}/standardized_financials?api_key={api_key}"
for p in fiscal_periods
]

return await amake_requests(urls, callback, **kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interactions:
response:
body:
string: !!binary |
H4sIAFHo7WUAA6zXXW+bMBQG4L8y+TpB59jYYN+1WpotbToSpUvbaUI0oRstIV+kU1b1v8/20q5i
H4sIALOYKmYAA6zXXW+bMBQG4L8y+TpB59jYYN+1WpotbToSpUvbaUI0oRstIV+kU1b1v8/20q5i
4QZzCRgCj47PefNM7nfFPFmkRZnkW6K+PZNsTpQ5G3+9e1gAJR2yLZMyNUvi2XKe6qt3SZ4UszTe
/kzTMn67rJfeZ9tZksf7NNkQRYGyt1OrdJMtzaPPbvS6cr8yD9qk9ub53x/ZlPFcHxFV7PK8Q9Ji
fjgm5kldkF0G9jfyrPjx7pLfBdoFnFCmgCkWegBwqxdm2zjXi7YlUeVml3bIbmVumldvpXQCXEGg
Expand All @@ -35,7 +35,7 @@ interactions:
Content-Type:
- application/json
Date:
- Sun, 10 Mar 2024 17:05:21 GMT
- Thu, 25 Apr 2024 17:53:55 GMT
Transfer-Encoding:
- chunked
Vary:
Expand All @@ -57,7 +57,7 @@ interactions:
response:
body:
string: !!binary |
H4sIAFHo7WUAA6yZa3OqRhjHv4rDm7ZTTZer4ExfmMtJm1g1Jicxp+04K2yQE1wILJ5gJt+9z3oD
H4sIALSYKmYAA6yZa3OqRhjHv4rDm7ZTTZer4ExfmMtJm1g1Jicxp+04K2yQE1wILJ5gJt+9z3oD
BESZ5pXusyz/3+5zW/MhhAxTCweWsyTW5MWhmJoOdkOh8/eHYGGGJwzbQudDcCyhI8DnSX+sXV8v
haZA8ZzA2AUOZ41/IoQkrXH1FjkL7BLKQpiwelIwwQ6vIBmTjwP4xFf0GHbNKOBfcRiSlTWEyYSa
sLrYFF6wybwApv4Klil28cogWGTqMBiJqMPXiUJL+GwK8IYIrJJhaCpa/Z2hz2YJCRr3bi7jhOR+
Expand Down Expand Up @@ -90,7 +90,62 @@ interactions:
Content-Type:
- application/json
Date:
- Sun, 10 Mar 2024 17:05:21 GMT
- Thu, 25 Apr 2024 17:53:56 GMT
Transfer-Encoding:
- chunked
Vary:
- Origin,Accept-Encoding
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
method: GET
uri: https://api-v2.intrinio.com/fundamentals/AAPL-balance_sheet_statement-2022-FY/standardized_financials?api_key=MOCK_API_KEY
response:
body:
string: !!binary |
H4sIALSYKmYAA6yZbXeqRhDHv4qHN21PNV0eBc/pC/Nw0ya5xpjcxNy2x7PCBmlwIbDkBnPy3Ttr
VBYBUU7zSncWmN/OzH8G8y7FDFMHR463IM7kyaOY2h72Y6n317vkYIYnDLtS713yHKknwefJYGyc
ny+ktkTxnMDaCY5nrb8ThBSjdfaSeK/YJ5TFsGF5pWSDHR5BcqYQR/CJ3zFg2LeTiH/FcUyW1hg2
E2rD3eW29IRtFkSw9VewTLGPlwbJIVOPwUpCPX6fJHakj7YET0jAqqiGZqDl3xH6aFeQoPHVxWma
kdzOgoh17kg0b/1JX0nM5jmQmJsZWL2ccV8UtSGKZuhmLcr9+OH6YpyhDAJG1kG5IjgmrRGxCQRg
6pMNEIVNkbi8L4rWDEVVulo9ysB9pOcCSt+2gwSOuowAr2yNKPSGATFlU9uDYnjzKlDwhKLwLI/E
7RYlLAsCYd7Klh7gvNHMec3aoy6c8XV06Wa+X7MZiVonn760+mtnPv0PuHHbz30prIYhkBVFrcWg
i4vpQBCqO+5LFUapo3mMMnlqqE+yqmtIryUYpuHou5BEQ7g5a7eGURCSiKVtUXZDrkeF1ArDYkWU
cTSsaE2R5W4txpv79vggYFwF1K2WWR+sdSpLA7qjZzQsbFlB5h5BeU79H85iuzoGG49a1xAcDEXt
lpZKiesHsCkNE07XNKVeev9NR69+ul0xAlpZ0dQClWE0bIZyV1fU+spH7sB8KVR+mfMFl2ni+zlP
xWT6/YBepytdvT6Z9NS5vBA8FUaQUzLNSnkzezifq6UC63t46vkegx6TP+3qZmFHxNmls7KMahmO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Type:
- application/json
Date:
- Thu, 25 Apr 2024 17:53:56 GMT
Transfer-Encoding:
- chunked
Vary:
Expand All @@ -112,7 +167,7 @@ interactions:
response:
body:
string: !!binary |
H4sIAFHo7WUAA6yZ23KrNhSGX8XDTdupnXI+eKYXzmGnTbwdx8lOnN12PDIomAYLAiI7OJN375JP
H4sIALSYKmYAA6yZ23KrNhSGX8XDTdupnXI+eKYXzmGnTbwdx8lOnN12PDIomAYLAiI7OJN375JP
CAPGZpormyWL/5PW+pcgH0JMEXFQ5HgL7EyePYKI7SE/Frp/fQgOomhCkSt0PwTPEboCfJ4Mxvrl
5UJoCwTNMVw7Q/Gs9XciirLeunhNvDfkY0JjGLD8pWBDHG6Bc6EQRfCJzRhQ5NtJxL6iOMbLaAyD
MbFhdqktPCObBhEM/RUiU+SjZUBw8NSjcCUhHpsniR3hsy3AHRKIKqqliqu/E/GzXUEijvtX52lG
Expand Down Expand Up @@ -145,7 +200,7 @@ interactions:
Content-Type:
- application/json
Date:
- Sun, 10 Mar 2024 17:05:21 GMT
- Thu, 25 Apr 2024 17:53:56 GMT
Transfer-Encoding:
- chunked
Vary:
Expand All @@ -167,7 +222,7 @@ interactions:
response:
body:
string: !!binary |
H4sIAFHo7WUAA6yZXXOrNhCG/wrDTdupnQphbMhML/J10iY5juPkJM5pOx4ZFEyDBQaRE5zJf+/K
H4sIALSYKmYAA6yZXXOrNhCG/wrDTdupnQphbMhML/J10iY5juPkJM5pOx4ZFEyDBQaRE5zJf+/K
XwgbjM00V7ZWFvtIu++uyIcac8IcEjnejDrDF48RZnvEj9Xjvz5Uh3Ay5MRVjz9Uz1GPVfg87A7a
l5cztaEyMqEwdkbisfJ3ghBuKxfTxHsjPmU8hgnzX6o22OERNGcKSQSfxIoBJ76dROIriWM6t8Yw
mTIbVtca6guxeRDB1F/BMiI+mRtUh448DiMJ88Q6Seyonw0VnpCAtWWarRaa/x2hz0YJCRrcXJ2n
Expand Down Expand Up @@ -200,7 +255,7 @@ interactions:
Content-Type:
- application/json
Date:
- Sun, 10 Mar 2024 17:05:21 GMT
- Thu, 25 Apr 2024 17:53:56 GMT
Transfer-Encoding:
- chunked
Vary:
Expand All @@ -222,7 +277,7 @@ interactions:
response:
body:
string: !!binary |
H4sIAFHo7WUAA6yZa3OjNhSG/4qHL22ndirExeCZfsht0yZex3GyiXfbjkcGBdNgQUBkF2fy33vk
H4sIALSYKmYAA6yZa3OjNhSG/4qHL22ndirExeCZfsht0yZex3GyiXfbjkcGBdNgQUBkF2fy33vk
G2DA2EzzydaRxftIOu+RyLsUccJsEtrugtqTZ5cRZrnEi6TeX++STTiZcOJIvXfJtaWeBJ8ng7F+
dbWQ2hIjcwpt5ySatf6OEcJ66/I1dt+IRxmPoMPyl5IFcXgEzYUCEsInMaLPiWfFofhKooguoxF0
psyC0eW29Ews7ofQ9VeITIlHlgHJplOXQ0vMXDFOHNnSR1uCJ8QQVQwk62j5d4I+2hUkaNy/vkhS
Expand Down Expand Up @@ -255,62 +310,7 @@ interactions:
Content-Type:
- application/json
Date:
- Sun, 10 Mar 2024 17:05:21 GMT
Transfer-Encoding:
- chunked
Vary:
- Origin,Accept-Encoding
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
method: GET
uri: https://api-v2.intrinio.com/fundamentals/AAPL-balance_sheet_statement-2022-FY/standardized_financials?api_key=MOCK_API_KEY
response:
body:
string: !!binary |
H4sIAFHo7WUAA6yZbXeqRhDHv4qHN21PNV0eBc/pC/Nw0ya5xpjcxNy2x7PCBmlwIbDkBnPy3Ttr
VBYBUU7zSncWmN/OzH8G8y7FDFMHR463IM7kyaOY2h72Y6n317vkYIYnDLtS713yHKknwefJYGyc
ny+ktkTxnMDaCY5nrb8ThBSjdfaSeK/YJ5TFsGF5pWSDHR5BcqYQR/CJ3zFg2LeTiH/FcUyW1hg2
E2rD3eW29IRtFkSw9VewTLGPlwbJIVOPwUpCPX6fJHakj7YET0jAqqiGZqDl3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3tjWoXKXyXW2dof
sZvuSq8ygKbSpSOjW6/IkYvUecH/YbSe3zYVXwm0EwWKmys3aEEUQNFT16P857N4+1elppq2H2To
3h8XB59PmDXhIOcmZF/mZwF2J9WBQqdX/5zzf6APxsbNeQFd6Exr/tsZ+D0LfIdE8U+lga5AqXoJ
NFDlS2BNn8q/Bf4Dt0mog3ljwf4GDtYmL6MHLE/5cTKQEb5hYgcOf8LqWZN4RgibbMyw9cmLbexP
UtBHeDtCirJZginLC/itvzxy8DQkSzldXux8PiRiEzhlsoYl1Fl9l/idOsjqKNryGTwpBJMKatJB
yp2i9JAJ72RHgPYdNnrxhAtgDIfAooTAgYT8IvGuGlzXUZQ7pPeQ0dP1I8vQ+KWgIyGm6eY84Pvy
vwyLa+68Zz8Tfu79/vBKkNww9JfCegRrPvFg6Y+Hb8PLEfo6vP5mfjkfH9+pFiewvWcw8gioCpIt
Vfr4+PgPAAD//wMA6O5ytPcYAAA=
headers:
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- application/json
Date:
- Sun, 10 Mar 2024 17:05:21 GMT
- Thu, 25 Apr 2024 17:53:56 GMT
Transfer-Encoding:
- chunked
Vary:
Expand Down
Loading