Skip to content

Commit

Permalink
Added analysis information for an instrument (#122)
Browse files Browse the repository at this point in the history
* Update avanza.py

Added get_analysis() to get analysis data for an instrument

* Update constants.py

Added path for analysis information for an instrument
  • Loading branch information
Unt3r authored Dec 21, 2024
1 parent 5fbf381 commit f9ac1cc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions avanza/avanza.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions avanza/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/{}"
Expand Down

0 comments on commit f9ac1cc

Please sign in to comment.