From f9ac1cc1b5e1b33b588462aa6a14f1c0076a6bab Mon Sep 17 00:00:00 2001 From: Unt3r <151835497+Unt3r@users.noreply.github.com> Date: Sat, 21 Dec 2024 10:20:39 +0100 Subject: [PATCH] Added analysis information for an instrument (#122) * Update avanza.py Added get_analysis() to get analysis data for an instrument * Update constants.py Added path for analysis information for an instrument --- avanza/avanza.py | 9 +++++++++ avanza/constants.py | 1 + 2 files changed, 10 insertions(+) diff --git a/avanza/avanza.py b/avanza/avanza.py index e66362a..5a771a6 100644 --- a/avanza/avanza.py +++ b/avanza/avanza.py @@ -267,6 +267,15 @@ def get_index_info(self, index_id: str) -> IndexInfo: # Works when sending InstrumentType.STOCK, but not InstrumentType.INDEX return self.get_instrument(InstrumentType.STOCK, index_id) + def get_analysis(self,instrument_id: str ): + """Returns analysis data for an instrument """ + return self.__call( + HttpMethod.GET, + Route.ANALYSIS_PATH.value.format( + instrument_id + ) + ) + def get_instrument(self, instrument_type: InstrumentType, instrument_id: str): """ Get instrument info diff --git a/avanza/constants.py b/avanza/constants.py index 157b316..f91fcf9 100644 --- a/avanza/constants.py +++ b/avanza/constants.py @@ -126,6 +126,7 @@ class Route(enum.Enum): ACCOUNT_PERFORMANCE_CHART_PATH = ( "/_api/account-performance/overview/chart/accounts/timeperiod" ) + ANALYSIS_PATH = '/_api/market-guide/stock/{}/analysis' AUTHENTICATION_PATH = "/_api/authentication/sessions/usercredentials" CATEGORIZED_ACCOUNTS = "/_api/account-overview/overview/categorizedAccounts" CHARTDATA_PATH = "/_api/price-chart/stock/{}"