avanza-mcp 1.1.0__py3-none-any.whl → 1.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- avanza_mcp/__init__.py +3 -1
- avanza_mcp/client/endpoints.py +28 -0
- avanza_mcp/models/__init__.py +87 -7
- avanza_mcp/models/certificate.py +87 -0
- avanza_mcp/models/chart.py +51 -0
- avanza_mcp/models/common.py +15 -0
- avanza_mcp/models/etf.py +92 -0
- avanza_mcp/models/filter.py +51 -0
- avanza_mcp/models/future_forward.py +63 -0
- avanza_mcp/models/instrument_data.py +26 -0
- avanza_mcp/models/warrant.py +88 -0
- avanza_mcp/prompts/__init__.py +2 -1
- avanza_mcp/prompts/workflows.py +488 -0
- avanza_mcp/resources/__init__.py +2 -1
- avanza_mcp/resources/usage.py +503 -0
- avanza_mcp/services/market_data_service.py +313 -0
- avanza_mcp/tools/__init__.py +15 -1
- avanza_mcp/tools/certificates.py +156 -0
- avanza_mcp/tools/etfs.py +151 -0
- avanza_mcp/tools/futures_forwards.py +174 -0
- avanza_mcp/tools/instrument_data.py +135 -0
- avanza_mcp/tools/warrants.py +139 -0
- {avanza_mcp-1.1.0.dist-info → avanza_mcp-1.3.0.dist-info}/METADATA +56 -1
- avanza_mcp-1.3.0.dist-info/RECORD +40 -0
- avanza_mcp-1.1.0.dist-info/RECORD +0 -26
- {avanza_mcp-1.1.0.dist-info → avanza_mcp-1.3.0.dist-info}/WHEEL +0 -0
- {avanza_mcp-1.1.0.dist-info → avanza_mcp-1.3.0.dist-info}/entry_points.txt +0 -0
- {avanza_mcp-1.1.0.dist-info → avanza_mcp-1.3.0.dist-info}/licenses/LICENSE.md +0 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"""Futures and forwards MCP tools."""
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from fastmcp import Context
|
|
6
|
+
|
|
7
|
+
from .. import mcp
|
|
8
|
+
from ..client import AvanzaClient
|
|
9
|
+
from ..models.filter import SortBy
|
|
10
|
+
from ..models.future_forward import (
|
|
11
|
+
FutureForwardMatrixFilter,
|
|
12
|
+
FutureForwardMatrixRequest,
|
|
13
|
+
)
|
|
14
|
+
from ..services import MarketDataService
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@mcp.tool()
|
|
18
|
+
async def list_futures_forwards(
|
|
19
|
+
ctx: Context,
|
|
20
|
+
underlying_instruments: list[str] | None = None,
|
|
21
|
+
option_types: list[str] | None = None,
|
|
22
|
+
end_dates: list[str] | None = None,
|
|
23
|
+
offset: int = 0,
|
|
24
|
+
limit: int = 20,
|
|
25
|
+
sort_field: str = "strikePrice",
|
|
26
|
+
sort_order: Literal["asc", "desc"] = "desc",
|
|
27
|
+
) -> dict:
|
|
28
|
+
"""List available futures and forward contracts.
|
|
29
|
+
|
|
30
|
+
Retrieves a matrix/list of available futures and forward contracts,
|
|
31
|
+
with optional filtering by underlying instruments, option types, and end dates.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
ctx: MCP context for logging
|
|
35
|
+
underlying_instruments: Optional list of underlying instrument IDs
|
|
36
|
+
option_types: Optional list of option types to filter by
|
|
37
|
+
end_dates: Optional list of end dates (YYYY-MM-DD format)
|
|
38
|
+
offset: Number of results to skip (default: 0)
|
|
39
|
+
limit: Maximum number of results (default: 20)
|
|
40
|
+
sort_field: Field to sort by (default: "strikePrice")
|
|
41
|
+
sort_order: Sort order "asc" or "desc" (default: "desc")
|
|
42
|
+
|
|
43
|
+
Returns:
|
|
44
|
+
List of available futures and forwards
|
|
45
|
+
|
|
46
|
+
Examples:
|
|
47
|
+
List all futures/forwards:
|
|
48
|
+
>>> list_futures_forwards()
|
|
49
|
+
|
|
50
|
+
Filter by underlying instrument:
|
|
51
|
+
>>> list_futures_forwards(underlying_instruments=["19002"])
|
|
52
|
+
"""
|
|
53
|
+
ctx.info("Listing futures/forwards")
|
|
54
|
+
|
|
55
|
+
try:
|
|
56
|
+
request = FutureForwardMatrixRequest(
|
|
57
|
+
filter=FutureForwardMatrixFilter(
|
|
58
|
+
underlyingInstruments=underlying_instruments or [],
|
|
59
|
+
optionTypes=option_types or [],
|
|
60
|
+
endDates=end_dates or [],
|
|
61
|
+
callIndicators=[],
|
|
62
|
+
),
|
|
63
|
+
offset=offset,
|
|
64
|
+
limit=limit,
|
|
65
|
+
sortBy=SortBy(field=sort_field, order=sort_order),
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
async with AvanzaClient() as client:
|
|
69
|
+
service = MarketDataService(client)
|
|
70
|
+
result = await service.list_futures_forwards(request)
|
|
71
|
+
|
|
72
|
+
ctx.info("Retrieved futures/forwards list")
|
|
73
|
+
return result.model_dump(by_alias=True, exclude_none=True)
|
|
74
|
+
|
|
75
|
+
except Exception as e:
|
|
76
|
+
ctx.error(f"Failed to list futures/forwards: {str(e)}")
|
|
77
|
+
raise
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@mcp.tool()
|
|
81
|
+
async def get_future_forward_info(ctx: Context, instrument_id: str) -> dict:
|
|
82
|
+
"""Get detailed information about a specific future or forward contract.
|
|
83
|
+
|
|
84
|
+
Provides comprehensive contract data including expiration date, underlying
|
|
85
|
+
instrument, contract specifications, and current pricing.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
ctx: MCP context for logging
|
|
89
|
+
instrument_id: Avanza future/forward ID
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
Detailed contract information
|
|
93
|
+
|
|
94
|
+
Examples:
|
|
95
|
+
Get contract info:
|
|
96
|
+
>>> get_future_forward_info(instrument_id="2224452")
|
|
97
|
+
"""
|
|
98
|
+
ctx.info(f"Fetching future/forward info for ID: {instrument_id}")
|
|
99
|
+
|
|
100
|
+
try:
|
|
101
|
+
async with AvanzaClient() as client:
|
|
102
|
+
service = MarketDataService(client)
|
|
103
|
+
info = await service.get_future_forward_info(instrument_id)
|
|
104
|
+
|
|
105
|
+
ctx.info(f"Retrieved info for: {info.name}")
|
|
106
|
+
return info.model_dump(by_alias=True, exclude_none=True)
|
|
107
|
+
|
|
108
|
+
except Exception as e:
|
|
109
|
+
ctx.error(f"Failed to fetch future/forward info: {str(e)}")
|
|
110
|
+
raise
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
@mcp.tool()
|
|
114
|
+
async def get_future_forward_details(ctx: Context, instrument_id: str) -> dict:
|
|
115
|
+
"""Get extended details about a specific future/forward contract.
|
|
116
|
+
|
|
117
|
+
Provides additional detailed information beyond basic contract info.
|
|
118
|
+
|
|
119
|
+
Args:
|
|
120
|
+
ctx: MCP context for logging
|
|
121
|
+
instrument_id: Avanza future/forward ID
|
|
122
|
+
|
|
123
|
+
Returns:
|
|
124
|
+
Extended contract details
|
|
125
|
+
|
|
126
|
+
Examples:
|
|
127
|
+
Get detailed info:
|
|
128
|
+
>>> get_future_forward_details(instrument_id="2224452")
|
|
129
|
+
"""
|
|
130
|
+
ctx.info(f"Fetching future/forward details for ID: {instrument_id}")
|
|
131
|
+
|
|
132
|
+
try:
|
|
133
|
+
async with AvanzaClient() as client:
|
|
134
|
+
service = MarketDataService(client)
|
|
135
|
+
details = await service.get_future_forward_details(instrument_id)
|
|
136
|
+
|
|
137
|
+
ctx.info("Retrieved future/forward details")
|
|
138
|
+
return details.model_dump(by_alias=True, exclude_none=True)
|
|
139
|
+
|
|
140
|
+
except Exception as e:
|
|
141
|
+
ctx.error(f"Failed to fetch future/forward details: {str(e)}")
|
|
142
|
+
raise
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
@mcp.tool()
|
|
146
|
+
async def get_future_forward_filter_options(ctx: Context) -> dict:
|
|
147
|
+
"""Get available filter options for futures and forwards.
|
|
148
|
+
|
|
149
|
+
Returns the available filter options including underlying instruments,
|
|
150
|
+
option types, end dates, and other filterable parameters.
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
ctx: MCP context for logging
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
Available filter options for futures/forwards
|
|
157
|
+
|
|
158
|
+
Examples:
|
|
159
|
+
Get filter options:
|
|
160
|
+
>>> get_future_forward_filter_options()
|
|
161
|
+
"""
|
|
162
|
+
ctx.info("Fetching future/forward filter options")
|
|
163
|
+
|
|
164
|
+
try:
|
|
165
|
+
async with AvanzaClient() as client:
|
|
166
|
+
service = MarketDataService(client)
|
|
167
|
+
options = await service.get_future_forward_filter_options()
|
|
168
|
+
|
|
169
|
+
ctx.info("Retrieved filter options")
|
|
170
|
+
return options
|
|
171
|
+
|
|
172
|
+
except Exception as e:
|
|
173
|
+
ctx.error(f"Failed to fetch filter options: {str(e)}")
|
|
174
|
+
raise
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"""Additional instrument data MCP tools."""
|
|
2
|
+
|
|
3
|
+
from fastmcp import Context
|
|
4
|
+
|
|
5
|
+
from .. import mcp
|
|
6
|
+
from ..client import AvanzaClient
|
|
7
|
+
from ..services import MarketDataService
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@mcp.tool()
|
|
11
|
+
async def get_number_of_owners(ctx: Context, instrument_id: str) -> dict:
|
|
12
|
+
"""Get the number of owners for any instrument.
|
|
13
|
+
|
|
14
|
+
Returns the current number of Avanza customers who own this instrument.
|
|
15
|
+
Works for stocks, funds, ETFs, certificates, warrants, etc.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
ctx: MCP context for logging
|
|
19
|
+
instrument_id: Avanza instrument ID (orderbookId)
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
Number of owners data:
|
|
23
|
+
- orderbookId: Instrument identifier
|
|
24
|
+
- numberOfOwners: Current owner count
|
|
25
|
+
- timestamp: When data was retrieved
|
|
26
|
+
|
|
27
|
+
Examples:
|
|
28
|
+
Check ownership for a stock:
|
|
29
|
+
>>> get_number_of_owners(instrument_id="5247")
|
|
30
|
+
|
|
31
|
+
Check ownership for an ETF:
|
|
32
|
+
>>> get_number_of_owners(instrument_id="742236")
|
|
33
|
+
"""
|
|
34
|
+
ctx.info(f"Fetching number of owners for ID: {instrument_id}")
|
|
35
|
+
|
|
36
|
+
try:
|
|
37
|
+
async with AvanzaClient() as client:
|
|
38
|
+
service = MarketDataService(client)
|
|
39
|
+
result = await service.get_number_of_owners(instrument_id)
|
|
40
|
+
|
|
41
|
+
if result.numberOfOwners is not None:
|
|
42
|
+
ctx.info(f"Instrument has {result.numberOfOwners} owners")
|
|
43
|
+
else:
|
|
44
|
+
ctx.info("Retrieved number of owners data")
|
|
45
|
+
return result.model_dump(by_alias=True, exclude_none=True)
|
|
46
|
+
|
|
47
|
+
except Exception as e:
|
|
48
|
+
ctx.error(f"Failed to fetch number of owners: {str(e)}")
|
|
49
|
+
raise
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@mcp.tool()
|
|
53
|
+
async def get_short_selling(ctx: Context, instrument_id: str) -> dict:
|
|
54
|
+
"""Get short selling data for an instrument.
|
|
55
|
+
|
|
56
|
+
Returns short selling volume and percentage for the instrument,
|
|
57
|
+
indicating how heavily shorted it is.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
ctx: MCP context for logging
|
|
61
|
+
instrument_id: Avanza instrument ID (orderbookId)
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
Short selling data:
|
|
65
|
+
- orderbookId: Instrument identifier
|
|
66
|
+
- shortSellingVolume: Volume of shares sold short
|
|
67
|
+
- shortSellingPercentage: Percentage of float sold short
|
|
68
|
+
- date: Date of data
|
|
69
|
+
|
|
70
|
+
Examples:
|
|
71
|
+
Check short interest for a stock:
|
|
72
|
+
>>> get_short_selling(instrument_id="5247")
|
|
73
|
+
"""
|
|
74
|
+
ctx.info(f"Fetching short selling data for ID: {instrument_id}")
|
|
75
|
+
|
|
76
|
+
try:
|
|
77
|
+
async with AvanzaClient() as client:
|
|
78
|
+
service = MarketDataService(client)
|
|
79
|
+
result = await service.get_short_selling(instrument_id)
|
|
80
|
+
|
|
81
|
+
ctx.info("Retrieved short selling data")
|
|
82
|
+
return result.model_dump(by_alias=True, exclude_none=True)
|
|
83
|
+
|
|
84
|
+
except Exception as e:
|
|
85
|
+
ctx.error(f"Failed to fetch short selling data: {str(e)}")
|
|
86
|
+
raise
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@mcp.tool()
|
|
90
|
+
async def get_marketmaker_chart(
|
|
91
|
+
ctx: Context, instrument_id: str, time_period: str = "today"
|
|
92
|
+
) -> dict:
|
|
93
|
+
"""Get price chart data for traded products (certificates, warrants, ETFs).
|
|
94
|
+
|
|
95
|
+
Returns OHLC (Open-High-Low-Close) candlestick data with market maker
|
|
96
|
+
information for certificates, warrants, ETFs, and other traded products.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
ctx: MCP context for logging
|
|
100
|
+
instrument_id: Avanza instrument ID (orderbookId)
|
|
101
|
+
time_period: Time period for chart data (default: "today")
|
|
102
|
+
Available: today, one_week, one_month, three_months, six_months,
|
|
103
|
+
one_year, three_years, five_years
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
Chart data with:
|
|
107
|
+
- ohlc: Array of OHLC candlestick data points
|
|
108
|
+
- metadata: Chart resolution and available resolutions
|
|
109
|
+
- from/to: Date range covered
|
|
110
|
+
- marketMaker: Array of market maker data (may be empty)
|
|
111
|
+
|
|
112
|
+
Examples:
|
|
113
|
+
Get today's chart for a certificate:
|
|
114
|
+
>>> get_marketmaker_chart(instrument_id="2090357", time_period="today")
|
|
115
|
+
|
|
116
|
+
Get 1-month chart for an ETF:
|
|
117
|
+
>>> get_marketmaker_chart(instrument_id="5649", time_period="one_month")
|
|
118
|
+
|
|
119
|
+
Get chart for a warrant:
|
|
120
|
+
>>> get_marketmaker_chart(instrument_id="2267542")
|
|
121
|
+
"""
|
|
122
|
+
ctx.info(f"Fetching chart data for ID: {instrument_id}, period: {time_period}")
|
|
123
|
+
|
|
124
|
+
try:
|
|
125
|
+
async with AvanzaClient() as client:
|
|
126
|
+
service = MarketDataService(client)
|
|
127
|
+
result = await service.get_marketmaker_chart(instrument_id, time_period)
|
|
128
|
+
|
|
129
|
+
data_points = len(result.ohlc) if result.ohlc else 0
|
|
130
|
+
ctx.info(f"Retrieved chart with {data_points} data points")
|
|
131
|
+
return result.model_dump(by_alias=True, exclude_none=True)
|
|
132
|
+
|
|
133
|
+
except Exception as e:
|
|
134
|
+
ctx.error(f"Failed to fetch chart data: {str(e)}")
|
|
135
|
+
raise
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"""Warrant MCP tools."""
|
|
2
|
+
|
|
3
|
+
from fastmcp import Context
|
|
4
|
+
|
|
5
|
+
from .. import mcp
|
|
6
|
+
from ..client import AvanzaClient
|
|
7
|
+
from ..models.filter import SortBy
|
|
8
|
+
from ..models.warrant import WarrantFilter, WarrantFilterRequest
|
|
9
|
+
from ..services import MarketDataService
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@mcp.tool()
|
|
13
|
+
async def filter_warrants(
|
|
14
|
+
ctx: Context,
|
|
15
|
+
offset: int = 0,
|
|
16
|
+
limit: int = 20,
|
|
17
|
+
directions: list[str] | None = None,
|
|
18
|
+
sub_types: list[str] | None = None,
|
|
19
|
+
issuers: list[str] | None = None,
|
|
20
|
+
underlying_instruments: list[str] | None = None,
|
|
21
|
+
sort_field: str = "name",
|
|
22
|
+
sort_order: str = "asc",
|
|
23
|
+
) -> dict:
|
|
24
|
+
"""Filter and list warrants (turbos, mini futures, etc.) with pagination.
|
|
25
|
+
|
|
26
|
+
Search through available warrants with filters for direction, sub-type
|
|
27
|
+
(TURBO, MINI, etc.), issuer, and underlying instrument.
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
ctx: MCP context for logging
|
|
31
|
+
offset: Number of results to skip (default: 0)
|
|
32
|
+
limit: Maximum number of results (default: 20, max: 100)
|
|
33
|
+
directions: Filter by direction, e.g., ["long"], ["short"]
|
|
34
|
+
sub_types: Filter by sub-type, e.g., ["TURBO"], ["MINI"]
|
|
35
|
+
issuers: Filter by issuer, e.g., ["Societe Generale"]
|
|
36
|
+
underlying_instruments: Filter by underlying instrument IDs
|
|
37
|
+
sort_field: Field to sort by (default: "name")
|
|
38
|
+
sort_order: Sort order "asc" or "desc" (default: "asc")
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
Filtered list of warrants with stop loss, underlying instrument, etc.
|
|
42
|
+
|
|
43
|
+
Examples:
|
|
44
|
+
List turbo warrants:
|
|
45
|
+
>>> filter_warrants(sub_types=["TURBO"])
|
|
46
|
+
|
|
47
|
+
Find long warrants from specific issuer:
|
|
48
|
+
>>> filter_warrants(directions=["long"], issuers=["Societe Generale"])
|
|
49
|
+
"""
|
|
50
|
+
ctx.info(f"Filtering warrants: offset={offset}, limit={limit}")
|
|
51
|
+
|
|
52
|
+
try:
|
|
53
|
+
filter_req = WarrantFilterRequest(
|
|
54
|
+
filter=WarrantFilter(
|
|
55
|
+
directions=directions or [],
|
|
56
|
+
subTypes=sub_types or [],
|
|
57
|
+
issuers=issuers or [],
|
|
58
|
+
underlyingInstruments=underlying_instruments or [],
|
|
59
|
+
),
|
|
60
|
+
offset=offset,
|
|
61
|
+
limit=min(limit, 100),
|
|
62
|
+
sortBy=SortBy(field=sort_field, order=sort_order),
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
async with AvanzaClient() as client:
|
|
66
|
+
service = MarketDataService(client)
|
|
67
|
+
result = await service.filter_warrants(filter_req)
|
|
68
|
+
|
|
69
|
+
ctx.info(f"Retrieved {len(result.warrants)} warrants")
|
|
70
|
+
return result.model_dump(by_alias=True, exclude_none=True)
|
|
71
|
+
|
|
72
|
+
except Exception as e:
|
|
73
|
+
ctx.error(f"Failed to filter warrants: {str(e)}")
|
|
74
|
+
raise
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@mcp.tool()
|
|
78
|
+
async def get_warrant_info(ctx: Context, instrument_id: str) -> dict:
|
|
79
|
+
"""Get detailed information about a specific warrant.
|
|
80
|
+
|
|
81
|
+
Provides comprehensive warrant data including strike price, barrier level,
|
|
82
|
+
stop loss, underlying instrument details, and current pricing.
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
ctx: MCP context for logging
|
|
86
|
+
instrument_id: Avanza warrant ID
|
|
87
|
+
|
|
88
|
+
Returns:
|
|
89
|
+
Detailed warrant information with strike, barrier, underlying, etc.
|
|
90
|
+
|
|
91
|
+
Examples:
|
|
92
|
+
Get warrant info:
|
|
93
|
+
>>> get_warrant_info(instrument_id="2267542")
|
|
94
|
+
"""
|
|
95
|
+
ctx.info(f"Fetching warrant info for ID: {instrument_id}")
|
|
96
|
+
|
|
97
|
+
try:
|
|
98
|
+
async with AvanzaClient() as client:
|
|
99
|
+
service = MarketDataService(client)
|
|
100
|
+
warrant = await service.get_warrant_info(instrument_id)
|
|
101
|
+
|
|
102
|
+
ctx.info(f"Retrieved info for: {warrant.name}")
|
|
103
|
+
return warrant.model_dump(by_alias=True, exclude_none=True)
|
|
104
|
+
|
|
105
|
+
except Exception as e:
|
|
106
|
+
ctx.error(f"Failed to fetch warrant info: {str(e)}")
|
|
107
|
+
raise
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
@mcp.tool()
|
|
111
|
+
async def get_warrant_details(ctx: Context, instrument_id: str) -> dict:
|
|
112
|
+
"""Get extended details about a specific warrant.
|
|
113
|
+
|
|
114
|
+
Provides additional detailed information beyond basic warrant info.
|
|
115
|
+
|
|
116
|
+
Args:
|
|
117
|
+
ctx: MCP context for logging
|
|
118
|
+
instrument_id: Avanza warrant ID
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
Extended warrant details
|
|
122
|
+
|
|
123
|
+
Examples:
|
|
124
|
+
Get detailed info:
|
|
125
|
+
>>> get_warrant_details(instrument_id="2267542")
|
|
126
|
+
"""
|
|
127
|
+
ctx.info(f"Fetching warrant details for ID: {instrument_id}")
|
|
128
|
+
|
|
129
|
+
try:
|
|
130
|
+
async with AvanzaClient() as client:
|
|
131
|
+
service = MarketDataService(client)
|
|
132
|
+
details = await service.get_warrant_details(instrument_id)
|
|
133
|
+
|
|
134
|
+
ctx.info("Retrieved warrant details")
|
|
135
|
+
return details.model_dump(by_alias=True, exclude_none=True)
|
|
136
|
+
|
|
137
|
+
except Exception as e:
|
|
138
|
+
ctx.error(f"Failed to fetch warrant details: {str(e)}")
|
|
139
|
+
raise
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: avanza-mcp
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: MCP server for Avanza public market data API - Swedish stocks, funds, and more
|
|
5
5
|
License-File: LICENSE.md
|
|
6
6
|
Requires-Python: >=3.12
|
|
@@ -57,12 +57,67 @@ The author of this software is not responsible for any indirect damages (foresee
|
|
|
57
57
|
| `get_fund_description` | Detailed fund description |
|
|
58
58
|
| `get_fund_holdings` | Portfolio allocation (country, sector, top holdings) |
|
|
59
59
|
|
|
60
|
+
### Certificates
|
|
61
|
+
| Tool | Description |
|
|
62
|
+
|------|-------------|
|
|
63
|
+
| `filter_certificates` | Search and filter certificates with pagination |
|
|
64
|
+
| `get_certificate_info` | Get detailed certificate information |
|
|
65
|
+
| `get_certificate_details` | Get extended certificate details |
|
|
66
|
+
|
|
67
|
+
### Warrants
|
|
68
|
+
| Tool | Description |
|
|
69
|
+
|------|-------------|
|
|
70
|
+
| `filter_warrants` | Search and filter warrants (turbos, minis) |
|
|
71
|
+
| `get_warrant_info` | Get detailed warrant information |
|
|
72
|
+
| `get_warrant_details` | Get extended warrant details |
|
|
73
|
+
|
|
74
|
+
### ETFs
|
|
75
|
+
| Tool | Description |
|
|
76
|
+
|------|-------------|
|
|
77
|
+
| `filter_etfs` | Search and filter exchange-traded funds |
|
|
78
|
+
| `get_etf_info` | Get detailed ETF information |
|
|
79
|
+
| `get_etf_details` | Get extended ETF details |
|
|
80
|
+
|
|
81
|
+
### Futures/Forwards
|
|
82
|
+
| Tool | Description |
|
|
83
|
+
|------|-------------|
|
|
84
|
+
| `list_futures_forwards` | List available futures and forwards |
|
|
85
|
+
| `get_future_forward_filter_options` | Get available filter options |
|
|
86
|
+
| `get_future_forward_info` | Get contract information |
|
|
87
|
+
| `get_future_forward_details` | Get extended contract details |
|
|
88
|
+
|
|
89
|
+
### Additional Data
|
|
90
|
+
| Tool | Description |
|
|
91
|
+
|------|-------------|
|
|
92
|
+
| `get_number_of_owners` | Get owner count for any instrument |
|
|
93
|
+
| `get_short_selling` | Get short selling data for instruments |
|
|
94
|
+
| `get_marketmaker_chart` | Get OHLC price chart data for traded products (certificates, warrants, ETFs) |
|
|
95
|
+
|
|
60
96
|
## 💡 MCP Prompts
|
|
61
97
|
|
|
98
|
+
### Analysis Prompts
|
|
62
99
|
- `analyze_stock` - Comprehensive stock analysis workflow
|
|
63
100
|
- `compare_funds` - Multi-fund comparison template
|
|
64
101
|
- `screen_dividend_stocks` - Dividend stock screening
|
|
65
102
|
|
|
103
|
+
### Workflow Prompts (Teach AI Efficient Data Fetching)
|
|
104
|
+
- `search_and_analyze_instrument` - Guide for finding and analyzing instruments efficiently
|
|
105
|
+
- `filter_instruments_efficiently` - Guide for filtering large datasets with pagination
|
|
106
|
+
- `compare_multiple_instruments` - Guide for comparing instruments efficiently
|
|
107
|
+
- `explore_market_segment` - Guide for exploring market segments
|
|
108
|
+
- `get_historical_analysis` - Guide for analyzing historical data
|
|
109
|
+
- `screen_by_criteria` - Guide for screening by custom criteria
|
|
110
|
+
|
|
111
|
+
## 📚 MCP Resources
|
|
112
|
+
|
|
113
|
+
### Documentation Resources
|
|
114
|
+
- `avanza://docs/usage` - Comprehensive usage guide for AI assistants
|
|
115
|
+
- `avanza://docs/quick-start` - Quick reference for common tasks
|
|
116
|
+
|
|
117
|
+
### Instrument Resources
|
|
118
|
+
- `avanza://stock/{instrument_id}` - Get stock information as markdown
|
|
119
|
+
- `avanza://fund/{instrument_id}` - Get fund information as markdown
|
|
120
|
+
|
|
66
121
|
|
|
67
122
|
### Configuration for MCP Clients
|
|
68
123
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
avanza_mcp/__init__.py,sha256=ccShZ9OeQ4V6UgFirUJZI9OV5cD8H93MgIIkfyO-bnw,1002
|
|
2
|
+
avanza_mcp/client/__init__.py,sha256=Yab-cUgQclyZgqdUkl7I15abQjEXVLoTvD3430oxpuY,515
|
|
3
|
+
avanza_mcp/client/base.py,sha256=92WrXDf0oTvE9gLJvEcbNkgbaT3rQkhoCAoGIpbaz0M,12853
|
|
4
|
+
avanza_mcp/client/endpoints.py,sha256=S7LK9Ab2ATHMEZ_680SbPbi5PogzbpGa-2USoMGthjo,2732
|
|
5
|
+
avanza_mcp/client/exceptions.py,sha256=KfVbVUdqdulPMiD0NdLjOaYczKu5pSgvYYrM2ngkgU8,1597
|
|
6
|
+
avanza_mcp/models/__init__.py,sha256=Ve7opIKTgkAgbTaMusyF-8bFY49W_i8ZVEz8S9jTcyQ,2703
|
|
7
|
+
avanza_mcp/models/certificate.py,sha256=JFK5F5cHhiyzlzyqfUJ5bNvCM-5r_bFF02kEugYIWtg,2386
|
|
8
|
+
avanza_mcp/models/chart.py,sha256=hfT5iK4Sz2zxfya7zYHSWSpky1Mz773eVFt7z8PFi_0,1142
|
|
9
|
+
avanza_mcp/models/common.py,sha256=iSwSXI1OcCLF3SK70dyju3w9X1LCE7XeQycQ_L1b1DU,1488
|
|
10
|
+
avanza_mcp/models/etf.py,sha256=RP5rU4E4wZ0z6PiNTdgs3MDJyzflUPrteE5yLKG8WZc,2290
|
|
11
|
+
avanza_mcp/models/filter.py,sha256=qd8BqBY8_sJx2I_BVizMk21eE8SHVTBN60WE74P1R0U,1198
|
|
12
|
+
avanza_mcp/models/fund.py,sha256=zwn2-p-TMRWguT8-scDPEvzkuzrsHffaS8K4pot2AyE,7850
|
|
13
|
+
avanza_mcp/models/future_forward.py,sha256=FbvTqefHfHZ-p2TzXgdDwhfBuscLDar4InjhtyCEvB0,1580
|
|
14
|
+
avanza_mcp/models/instrument_data.py,sha256=-5MJTCFy4W8zVU-oVjTBxWo55SzGG62577X3VyqHgFM,601
|
|
15
|
+
avanza_mcp/models/search.py,sha256=HrP3V2T9Y1LBk_wwnNJdqg6XbHaz96AqvVUQ9iwuNyw,2816
|
|
16
|
+
avanza_mcp/models/stock.py,sha256=KR7SxeaiGe-7Me0-mXuqE37xwyhW94FPn8zjOtpyh8I,6420
|
|
17
|
+
avanza_mcp/models/warrant.py,sha256=k8uzeSOeFxPZuV9CE0vZwvOpmDZwlNto9PzPQKtzJ8o,2324
|
|
18
|
+
avanza_mcp/prompts/__init__.py,sha256=6GOy34A-1ZIhMk7yFyIJ8pHnE8j42aaBRReiuAOVlBE,191
|
|
19
|
+
avanza_mcp/prompts/analysis.py,sha256=uW3P_jdupoNp7QsyjPsjXJjCNlR5646oYyVV9SMwXeM,3694
|
|
20
|
+
avanza_mcp/prompts/workflows.py,sha256=x56DjSRQZvV-yNHGL5BXwgb8MCCyy-rYXrSsLp0KJzw,13414
|
|
21
|
+
avanza_mcp/resources/__init__.py,sha256=IgzNHfy_fXl-oUfzL10HctB8GC5jOUIY58z3uKeXUg8,193
|
|
22
|
+
avanza_mcp/resources/instruments.py,sha256=1pZbQ19NAWNMD_qmBOcniwf988jpFKUK4QiXrdOyYGw,3948
|
|
23
|
+
avanza_mcp/resources/usage.py,sha256=sGtlR_dF-nHvFYEQYYugmispCgeKnT7OiFd_YfDhvNw,13602
|
|
24
|
+
avanza_mcp/services/__init__.py,sha256=hCCYSVLvFglaGfNo4MXQP8mzsKHmV8yG_iNH0VsIsPs,190
|
|
25
|
+
avanza_mcp/services/market_data_service.py,sha256=EEjF1rwUAZ9ejLeLJJu49cntTaHuZ4opApJ8faEj6so,19212
|
|
26
|
+
avanza_mcp/services/search_service.py,sha256=op2BKokwraqoOSv0SdnLMFBJJODyqCAhOaFiCJ1hc30,1930
|
|
27
|
+
avanza_mcp/tools/__init__.py,sha256=CcSU_X1b02HM1DHowhpeLLhcHhs9qT48j2oeJVUm2DI,540
|
|
28
|
+
avanza_mcp/tools/certificates.py,sha256=ZCuvFx6Q3Gg41k_sjALAX0MAvUnfCKqoIfS9JMPlxco,5457
|
|
29
|
+
avanza_mcp/tools/etfs.py,sha256=vrePKncEWK7BQc48MemkzJOs5rxp_1a7cXdoNQRqrv4,4966
|
|
30
|
+
avanza_mcp/tools/funds.py,sha256=qRLYsZH-zNGCI_0KwfgFm1J43Bxlva9ug8mVIp6-Nzs,8781
|
|
31
|
+
avanza_mcp/tools/futures_forwards.py,sha256=mGUhKNaaA_qasY-vK56Y_iy0Xrsdp4of2AZTYYiaA-4,5424
|
|
32
|
+
avanza_mcp/tools/instrument_data.py,sha256=EkE4dPSm1d4m1CeofCBdualwQqbPB8UtxCGonaU_-a8,4562
|
|
33
|
+
avanza_mcp/tools/market_data.py,sha256=qqvnrnYpcvPucZlqvLHODh4DsRF5XPC7WmguDmaEzEk,16474
|
|
34
|
+
avanza_mcp/tools/search.py,sha256=srB7K-9VCJhB6Zvs4aLX_jfFekiMUIkYgOAp5IrCApg,3722
|
|
35
|
+
avanza_mcp/tools/warrants.py,sha256=jLaC3FK5X1DQcU_f5oXXP6asjTTTp2GfhDcE47uF94M,4515
|
|
36
|
+
avanza_mcp-1.3.0.dist-info/METADATA,sha256=h_5cJ6f4AdJVNUXjYqDzObJQLSquipu5m-5BBSZ5viM,6058
|
|
37
|
+
avanza_mcp-1.3.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
38
|
+
avanza_mcp-1.3.0.dist-info/entry_points.txt,sha256=4MF6-imOIBHK-U5DLdRrufwrV3MXfqGG0OIA_e4Jl_M,47
|
|
39
|
+
avanza_mcp-1.3.0.dist-info/licenses/LICENSE.md,sha256=WVxy2qGCtophbFXxeAHHY0IksvRJLsUIuRgcGNtqH5Q,1065
|
|
40
|
+
avanza_mcp-1.3.0.dist-info/RECORD,,
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
avanza_mcp/__init__.py,sha256=z1yGlE_ismfqQcyXrIKXnf9YrQt6f-w3uexCERSl-3I,891
|
|
2
|
-
avanza_mcp/client/__init__.py,sha256=Yab-cUgQclyZgqdUkl7I15abQjEXVLoTvD3430oxpuY,515
|
|
3
|
-
avanza_mcp/client/base.py,sha256=92WrXDf0oTvE9gLJvEcbNkgbaT3rQkhoCAoGIpbaz0M,12853
|
|
4
|
-
avanza_mcp/client/endpoints.py,sha256=9Puu15PHVxmqmvSfIxVDcILztJrZoD2bLX7OlePyplg,1473
|
|
5
|
-
avanza_mcp/client/exceptions.py,sha256=KfVbVUdqdulPMiD0NdLjOaYczKu5pSgvYYrM2ngkgU8,1597
|
|
6
|
-
avanza_mcp/models/__init__.py,sha256=X_kmCaAe3iTq_MZIMr3XupH-yoHn1K_yHpX2aZmQSXE,767
|
|
7
|
-
avanza_mcp/models/common.py,sha256=QDEdMk-OYorPubcyHt__cl-FH9j55NykxLqXppMYENo,1226
|
|
8
|
-
avanza_mcp/models/fund.py,sha256=zwn2-p-TMRWguT8-scDPEvzkuzrsHffaS8K4pot2AyE,7850
|
|
9
|
-
avanza_mcp/models/search.py,sha256=HrP3V2T9Y1LBk_wwnNJdqg6XbHaz96AqvVUQ9iwuNyw,2816
|
|
10
|
-
avanza_mcp/models/stock.py,sha256=KR7SxeaiGe-7Me0-mXuqE37xwyhW94FPn8zjOtpyh8I,6420
|
|
11
|
-
avanza_mcp/prompts/__init__.py,sha256=P7ClxG1itpYEKXGP9nQzqJ1zo2S0QeiHgOsfgwdf7VQ,140
|
|
12
|
-
avanza_mcp/prompts/analysis.py,sha256=uW3P_jdupoNp7QsyjPsjXJjCNlR5646oYyVV9SMwXeM,3694
|
|
13
|
-
avanza_mcp/resources/__init__.py,sha256=jXyXHN_BV7HKkVh-2EfqHui7PzfcPlpEY7GaCWJuDQA,150
|
|
14
|
-
avanza_mcp/resources/instruments.py,sha256=1pZbQ19NAWNMD_qmBOcniwf988jpFKUK4QiXrdOyYGw,3948
|
|
15
|
-
avanza_mcp/services/__init__.py,sha256=hCCYSVLvFglaGfNo4MXQP8mzsKHmV8yG_iNH0VsIsPs,190
|
|
16
|
-
avanza_mcp/services/market_data_service.py,sha256=p3XGoLBU1YmX9EcbqSZOmXrX3NOlaITaVTo6o28vLns,9434
|
|
17
|
-
avanza_mcp/services/search_service.py,sha256=op2BKokwraqoOSv0SdnLMFBJJODyqCAhOaFiCJ1hc30,1930
|
|
18
|
-
avanza_mcp/tools/__init__.py,sha256=NMBh_rZ5q0u3WtQlfUxDVisWqJmtYc-3r2DHasKwMTQ,230
|
|
19
|
-
avanza_mcp/tools/funds.py,sha256=qRLYsZH-zNGCI_0KwfgFm1J43Bxlva9ug8mVIp6-Nzs,8781
|
|
20
|
-
avanza_mcp/tools/market_data.py,sha256=qqvnrnYpcvPucZlqvLHODh4DsRF5XPC7WmguDmaEzEk,16474
|
|
21
|
-
avanza_mcp/tools/search.py,sha256=srB7K-9VCJhB6Zvs4aLX_jfFekiMUIkYgOAp5IrCApg,3722
|
|
22
|
-
avanza_mcp-1.1.0.dist-info/METADATA,sha256=KRuNcKT_yB6uE_SgX9kwVbb5VIqJvljZF9D_JXbRtXk,3816
|
|
23
|
-
avanza_mcp-1.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
24
|
-
avanza_mcp-1.1.0.dist-info/entry_points.txt,sha256=4MF6-imOIBHK-U5DLdRrufwrV3MXfqGG0OIA_e4Jl_M,47
|
|
25
|
-
avanza_mcp-1.1.0.dist-info/licenses/LICENSE.md,sha256=WVxy2qGCtophbFXxeAHHY0IksvRJLsUIuRgcGNtqH5Q,1065
|
|
26
|
-
avanza_mcp-1.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|