pub struct Client { /* private fields */ }Expand description
Typed HTTP client for the Nordnet API. Cheap to clone — wraps a
reqwest::Client and a base URL + optional session.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(base_url: impl Into<String>) -> Result<Self, Error>
pub fn new(base_url: impl Into<String>) -> Result<Self, Error>
Build a client for the given base URL (e.g.
https://public.nordnet.se/api/2). The base URL is used verbatim;
trailing slashes are stripped.
Sourcepub fn with_session(self, session: Session) -> Self
pub fn with_session(self, session: Session) -> Self
Attach (or replace) the authenticated session used for the
Authorization header on subsequent requests.
Sourcepub async fn get<T: DeserializeOwned>(&self, path: &str) -> Result<T, Error>
pub async fn get<T: DeserializeOwned>(&self, path: &str) -> Result<T, Error>
GET <base_url><path> and parse the JSON body as T.
Sourcepub async fn post<T: DeserializeOwned, B: Serialize>(
&self,
path: &str,
body: &B,
) -> Result<T, Error>
pub async fn post<T: DeserializeOwned, B: Serialize>( &self, path: &str, body: &B, ) -> Result<T, Error>
POST a JSON body to <base_url><path> and parse the JSON response.
Sourcepub async fn put<T: DeserializeOwned, B: Serialize>(
&self,
path: &str,
body: &B,
) -> Result<T, Error>
pub async fn put<T: DeserializeOwned, B: Serialize>( &self, path: &str, body: &B, ) -> Result<T, Error>
PUT a JSON body to <base_url><path> and parse the JSON response.
Sourcepub async fn post_form<T: DeserializeOwned, B: Serialize>(
&self,
path: &str,
body: &B,
) -> Result<T, Error>
pub async fn post_form<T: DeserializeOwned, B: Serialize>( &self, path: &str, body: &B, ) -> Result<T, Error>
POST a body to <base_url><path> encoded as
application/x-www-form-urlencoded, and parse the JSON response.
Required for endpoints whose Swagger 2.0 parameter table marks every
body parameter as FormData (e.g. POST /accounts/{accid}/orders).
JSON bodies are silently rejected by these endpoints.
Sourcepub async fn put_form<T: DeserializeOwned, B: Serialize>(
&self,
path: &str,
body: &B,
) -> Result<T, Error>
pub async fn put_form<T: DeserializeOwned, B: Serialize>( &self, path: &str, body: &B, ) -> Result<T, Error>
PUT a body to <base_url><path> encoded as
application/x-www-form-urlencoded, and parse the JSON response.
Required for endpoints whose Swagger 2.0 parameter table marks every
body parameter as FormData (e.g. PUT /accounts/{accid}/orders/{order_id}).
Sourcepub async fn put_empty<T: DeserializeOwned>(
&self,
path: &str,
) -> Result<T, Error>
pub async fn put_empty<T: DeserializeOwned>( &self, path: &str, ) -> Result<T, Error>
PUT <base_url><path> with no request body. The wire request omits
the Content-Type header and sends a zero-length body — this is the
shape Nordnet’s PUT /login (refresh session) expects.
Source§impl Client
impl Client
Sourcepub async fn list_accounts(
&self,
query: ListAccountsQuery,
) -> Result<Vec<Account>, Error>
pub async fn list_accounts( &self, query: ListAccountsQuery, ) -> Result<Vec<Account>, Error>
GET /accounts — Returns a list of accounts to which the user has
access.
Returns an empty Vec on 204 No Content.
§Errors
Error::Unauthorized (401), Error::Forbidden (403),
Error::TooManyRequests (429), Error::ServiceUnavailable
(503).
Sourcepub async fn get_account_info(
&self,
accid: AccountId,
query: AccountInfoQuery,
) -> Result<Vec<AccountInfo>, Error>
pub async fn get_account_info( &self, accid: AccountId, query: AccountInfoQuery, ) -> Result<Vec<AccountInfo>, Error>
GET /accounts/{accid}/info — Returns account information details
for one or more accounts.
accid is one or more account identifier(s). The single-account
accid: AccountId parameter is the strongly-typed shape; multi-
account lookups (the API accepts a comma-separated list in the
path) are deferred to a higher-level helper.
§Errors
Error::BadRequest (400), Error::Unauthorized (401),
Error::Forbidden (403), Error::TooManyRequests (429),
Error::ServiceUnavailable (503).
Sourcepub async fn list_ledgers(
&self,
accid: AccountId,
) -> Result<LedgerInformation, Error>
pub async fn list_ledgers( &self, accid: AccountId, ) -> Result<LedgerInformation, Error>
GET /accounts/{accid}/ledgers — Returns information about the
currency ledgers of an account.
Note: 204 is documented but cannot be mapped to an empty default
because LedgerInformation is a single object (not an array).
In that case the underlying Error::Decode is returned.
§Errors
Error::BadRequest (400), Error::Unauthorized (401),
Error::Forbidden (403), Error::TooManyRequests (429),
Error::ServiceUnavailable (503).
Sourcepub async fn list_positions(
&self,
accid: AccountId,
query: ListPositionsQuery,
) -> Result<Vec<Position>, Error>
pub async fn list_positions( &self, accid: AccountId, query: ListPositionsQuery, ) -> Result<Vec<Position>, Error>
GET /accounts/{accid}/positions — Returns all positions for the
given account.
Returns an empty Vec on 204 No Content.
§Errors
Error::BadRequest (400), Error::Unauthorized (401),
Error::Forbidden (403), Error::TooManyRequests (429),
Error::ServiceUnavailable (503).
Sourcepub async fn get_returns_today(
&self,
accid: AccountId,
query: ReturnsTodayQuery,
) -> Result<Vec<AccountTransactionsToday>, Error>
pub async fn get_returns_today( &self, accid: AccountId, query: ReturnsTodayQuery, ) -> Result<Vec<AccountTransactionsToday>, Error>
GET /accounts/{accid}/returns/transactions/today — Returns
today’s withdrawal/deposit transaction amounts for the given
account.
Returns an empty Vec on 204 No Content.
§Errors
Error::BadRequest (400), Error::Unauthorized (401),
Error::Forbidden (403), Error::TooManyRequests (429),
Error::ServiceUnavailable (503).
Sourcepub async fn list_account_trades(
&self,
accid: AccountId,
query: ListAccountTradesQuery,
) -> Result<Vec<Trade>, Error>
pub async fn list_account_trades( &self, accid: AccountId, query: ListAccountTradesQuery, ) -> Result<Vec<Trade>, Error>
GET /accounts/{accid}/trades — Returns all trades belonging to
the given account.
Renamed from the docs op list_trades to list_account_trades to
coexist with Client::list_tradable_trades and
Client::list_instrument_trades on the same Client impl.
Returns an empty Vec on 204 No Content.
§Errors
Error::BadRequest (400), Error::Unauthorized (401),
Error::Forbidden (403), 404 (documented as “Account not found”;
surfaced via Error::UnexpectedStatus because the foundation
Error enum does not model 404 as a dedicated variant),
Error::TooManyRequests (429),
Error::ServiceUnavailable (503).
Source§impl Client
impl Client
Sourcepub async fn list_countries(&self) -> Result<Vec<Country>, Error>
pub async fn list_countries(&self) -> Result<Vec<Country>, Error>
Return all countries known to the Nordnet system.
Not every returned country supports trading.
Calls GET /countries.
Sourcepub async fn get_country(&self, code: &str) -> Result<Vec<Country>, Error>
pub async fn get_country(&self, code: &str) -> Result<Vec<Country>, Error>
Look up one or more countries by ISO country code.
Multiple codes can be queried in a single call by passing a
comma-separated string (e.g. "SE,NO"). Returns an empty Vec when
the API responds with 204 No Content (no matching countries).
Calls GET /countries/{country}.
Source§impl Client
impl Client
Sourcepub async fn get_attributes(
&self,
filters: AttributesQuery<'_>,
) -> Result<AttributeResults, Error>
pub async fn get_attributes( &self, filters: AttributesQuery<'_>, ) -> Result<AttributeResults, Error>
GET /instrument_search/attributes — Search for attributes
available in the instrument search APIs.
§Errors
Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), Error::ServiceUnavailable
(503).
Sourcepub async fn search_stocklist(
&self,
filters: StocklistQuery<'_>,
) -> Result<StocklistResults, Error>
pub async fn search_stocklist( &self, filters: StocklistQuery<'_>, ) -> Result<StocklistResults, Error>
GET /instrument_search/query/stocklist — Search for stocks.
§Errors
Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), Error::ServiceUnavailable
(503).
Sourcepub async fn search_bullbearlist(
&self,
filters: ListSearchQuery<'_>,
) -> Result<BullBearListResults, Error>
pub async fn search_bullbearlist( &self, filters: ListSearchQuery<'_>, ) -> Result<BullBearListResults, Error>
GET /instrument_search/query/bullbearlist — Search, filter and
sort instruments within the Bull & Bear entity type.
204 No Content is documented for this op; it is mapped to an empty
BullBearListResults (every field defaulted to None).
§Errors
Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), Error::ServiceUnavailable
(503).
Sourcepub async fn search_minifuturelist(
&self,
filters: ListSearchQuery<'_>,
) -> Result<MinifutureListResults, Error>
pub async fn search_minifuturelist( &self, filters: ListSearchQuery<'_>, ) -> Result<MinifutureListResults, Error>
GET /instrument_search/query/minifuturelist — Search, filter and
sort instruments within the Mini Future entity type.
§Errors
Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), Error::ServiceUnavailable
(503).
Sourcepub async fn search_unlimitedturbolist(
&self,
filters: ListSearchQuery<'_>,
) -> Result<UnlimitedTurboListResults, Error>
pub async fn search_unlimitedturbolist( &self, filters: ListSearchQuery<'_>, ) -> Result<UnlimitedTurboListResults, Error>
GET /instrument_search/query/unlimitedturbolist — Search, filter
and sort instruments within the Unlimited Turbo entity type.
§Errors
Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), Error::ServiceUnavailable
(503).
Sourcepub async fn search_optionlist_pairs(
&self,
currency: &str,
expire_date: i64,
underlying_symbol: &str,
) -> Result<OptionListResults, Error>
pub async fn search_optionlist_pairs( &self, currency: &str, expire_date: i64, underlying_symbol: &str, ) -> Result<OptionListResults, Error>
GET /instrument_search/query/optionlist/pairs — Search for the
Option Pair (Put-Call) given an underlying instrument and the
expiration date.
All three parameters are required per the doc:
currency: option currency (e.g."SEK").expire_date: expiration date as a Nordnet UNIX-millis epoch timestamp (integer(int64)per the doc).underlying_symbol: underlying instrument symbol (e.g."ERIC B").
§Errors
Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), Error::ServiceUnavailable
(503).
Source§impl Client
impl Client
Sourcepub async fn lookup(
&self,
lookup_type: &str,
lookup: &str,
) -> Result<Vec<Instrument>, Error>
pub async fn lookup( &self, lookup_type: &str, lookup: &str, ) -> Result<Vec<Instrument>, Error>
GET /instruments/lookup/{lookup_type}/{lookup} — Lookup specific
instruments with predefined fields.
lookup_type must be one of the documented enum values:
market_id_identifier or isin_code_currency_market_id.
lookup is formatted as [market_id]:[identifier] or
[isin]:[currency]:[market_id] respectively. Multiple entries are
comma-separated. Pass-through &str for now.
Returns an empty Vec on 204 No Content.
§Errors
Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), Error::ServiceUnavailable
(503).
Sourcepub async fn list_types(&self) -> Result<Vec<InstrumentType>, Error>
pub async fn list_types(&self) -> Result<Vec<InstrumentType>, Error>
GET /instruments/types — Returns all Nordnet instrument types.
§Errors
Error::Unauthorized (401), Error::TooManyRequests (429),
Error::ServiceUnavailable (503).
Sourcepub async fn get_type(
&self,
instrument_type: &str,
) -> Result<Vec<InstrumentType>, Error>
pub async fn get_type( &self, instrument_type: &str, ) -> Result<Vec<InstrumentType>, Error>
GET /instruments/types/{instrument_type} — Returns information
about one or more Nordnet instrument types.
instrument_type is one or more comma-separated type codes
(pass-through &str).
Returns an empty Vec on 204 No Content.
§Errors
Error::Unauthorized (401), Error::TooManyRequests (429),
Error::ServiceUnavailable (503).
Sourcepub async fn list_underlyings(
&self,
derivative_type: &str,
currency: &str,
) -> Result<Vec<Instrument>, Error>
pub async fn list_underlyings( &self, derivative_type: &str, currency: &str, ) -> Result<Vec<Instrument>, Error>
GET /instruments/underlyings/{derivative_type}/{currency} —
Returns instruments that are underlyings for a specific type of
instruments.
derivative_type is one of leverage or option_pair. currency
is the derivative currency (note the underlying may have a
different currency). Both pass-through &str.
Returns an empty Vec on 204 No Content.
§Errors
Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), Error::ServiceUnavailable
(503).
Sourcepub async fn get_instrument_suitability(
&self,
instrument_id: InstrumentId,
) -> Result<Vec<InstrumentEligibility>, Error>
pub async fn get_instrument_suitability( &self, instrument_id: InstrumentId, ) -> Result<Vec<InstrumentEligibility>, Error>
GET /instruments/validation/suitability/{instrument_id} —
Returns the customer’s trading eligibility for the given
instrument(s).
Renamed from the docs op get_suitability to
get_instrument_suitability to coexist with
tradables::get_suitability on the same Client impl.
Returns an empty Vec on 204 No Content.
§Errors
Error::BadRequest (400), Error::Unauthorized (401),
Error::Forbidden (403; documented for anonymous sessions and
returned with an empty body), Error::TooManyRequests (429),
Error::ServiceUnavailable (503).
Sourcepub async fn get_instrument(
&self,
instrument_id: InstrumentId,
) -> Result<Vec<Instrument>, Error>
pub async fn get_instrument( &self, instrument_id: InstrumentId, ) -> Result<Vec<Instrument>, Error>
GET /instruments/{instrument_id} — Returns instrument information
for the given instrument ID(s).
Returns an empty Vec on 204 No Content.
§Errors
Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), Error::ServiceUnavailable
(503).
Sourcepub async fn list_leverages(
&self,
instrument_id: InstrumentId,
filters: LeveragesQuery<'_>,
) -> Result<Vec<Instrument>, Error>
pub async fn list_leverages( &self, instrument_id: InstrumentId, filters: LeveragesQuery<'_>, ) -> Result<Vec<Instrument>, Error>
GET /instruments/{instrument_id}/leverages — Returns a list of
leverage instruments that have the current instrument as
underlying.
Filters are passed as a LeveragesQuery; pass
&LeveragesQuery::default() for “no filters”.
Returns an empty Vec on 204 No Content.
§Errors
Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), Error::ServiceUnavailable
(503).
Sourcepub async fn get_leverage_filters(
&self,
instrument_id: InstrumentId,
) -> Result<LeverageFilter, Error>
pub async fn get_leverage_filters( &self, instrument_id: InstrumentId, ) -> Result<LeverageFilter, Error>
GET /instruments/{instrument_id}/leverages/filters — Returns
valid leverage instruments filter values for the given underlying.
§Errors
Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), Error::ServiceUnavailable
(503).
Sourcepub async fn list_instrument_trades(
&self,
instrument_id: InstrumentId,
) -> Result<Vec<InstrumentPublicTrades>, Error>
pub async fn list_instrument_trades( &self, instrument_id: InstrumentId, ) -> Result<Vec<InstrumentPublicTrades>, Error>
GET /instruments/{instrument_id}/trades — Returns the public
trades belonging to one or more instruments.
Renamed from the docs op list_trades to list_instrument_trades
to coexist with tradables::list_tradable_trades and the future
accounts::list_trades on the same Client impl.
Returns an empty Vec on 204 No Content.
§Errors
Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), Error::ServiceUnavailable
(503).
Source§impl Client
impl Client
Sourcepub async fn start_login(
&self,
request: &ApiKeyStartLoginRequest,
) -> Result<ChallengeResponse, Error>
pub async fn start_login( &self, request: &ApiKeyStartLoginRequest, ) -> Result<ChallengeResponse, Error>
POST /login/start — Start the authentication challenge.
Returns a ChallengeResponse whose challenge field must be
signed with the caller’s RSA private key (see
nordnet_model::auth::sign_challenge) before being passed to
Client::verify_login. The challenge is valid for 30 seconds.
§Errors
Returns Error::BadRequest (400), Error::TooManyRequests
(429), or Error::ServiceUnavailable (503) per the docs.
Sourcepub async fn verify_login(
&self,
request: &ApiKeyVerifyLoginRequest,
) -> Result<ApiKeyLoginResponse, Error>
pub async fn verify_login( &self, request: &ApiKeyVerifyLoginRequest, ) -> Result<ApiKeyLoginResponse, Error>
POST /login/verify — Complete the login flow with a signed
challenge.
On success the returned ApiKeyLoginResponse carries the
session_key. Convert it to a nordnet_model::auth::Session via
ApiKeyLoginResponse::to_session and attach it with
Client::with_session for subsequent authenticated calls.
§Errors
Returns Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), or Error::ServiceUnavailable
(503) per the docs.
Sourcepub async fn refresh_session(&self) -> Result<LoggedInStatus, Error>
pub async fn refresh_session(&self) -> Result<LoggedInStatus, Error>
PUT /login — Touch the session to keep it alive.
Any other authenticated call also touches the session, so this is only needed when the application is otherwise idle for the full session timeout interval.
§Errors
Returns Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), or Error::ServiceUnavailable
(503) per the docs.
Sourcepub async fn logout(&self) -> Result<LoggedInStatus, Error>
pub async fn logout(&self) -> Result<LoggedInStatus, Error>
DELETE /login — Invalidate the current session.
§Errors
Returns Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), or Error::ServiceUnavailable
(503) per the docs.
Source§impl Client
impl Client
Sourcepub async fn search(
&self,
query: &str,
instrument_group: Option<&[&str]>,
limit: Option<i32>,
offset: Option<i32>,
search_space: Option<&str>,
) -> Result<Vec<MainSearchResponse>, Error>
pub async fn search( &self, query: &str, instrument_group: Option<&[&str]>, limit: Option<i32>, offset: Option<i32>, search_space: Option<&str>, ) -> Result<Vec<MainSearchResponse>, Error>
GET /main_search — Returns the instruments, news, and pages
matching the given search criteria.
§Parameters
query— required search string.instrument_group— optional list of instrument groups to restrict the search to (EQUITY,PINV,FUND,ETF,ETC,WARRANT,DERIVATIVES,INDICATOR,OTHER). WhenNone, results from every group are returned. Encoded as repeatedinstrument_group=...pairs.limit— optional per-group result limit (default 5).offset— optional per-group result offset (default 0).search_space— optional search space (ALL,INSTRUMENTS,NEWS,CMS,BLOG,INSTRUMENTS_NEWS,INSTRUMENTS_CMS,NEWS_CMS,NEWS_BLOG,NEWS_BLOG_CMS). DefaultALL.
§Errors
Returns Error::BadRequest (400), Error::Unauthorized
(401), Error::TooManyRequests (429), or
Error::ServiceUnavailable (503) as documented.
HTTP 204 (No Content) and 404 (No Content) responses are mapped
to an empty Vec<MainSearchResponse> (per the get_country
precedent).
Source§impl Client
impl Client
Sourcepub async fn list_markets(&self) -> Result<Vec<Market>, Error>
pub async fn list_markets(&self) -> Result<Vec<Market>, Error>
GET /markets — Returns information about all tradable markets.
§Errors
Returns Error::Unauthorized (401), Error::TooManyRequests
(429), or Error::ServiceUnavailable (503) as documented.
Sourcepub async fn get_market(&self, id: MarketId) -> Result<Vec<Market>, Error>
pub async fn get_market(&self, id: MarketId) -> Result<Vec<Market>, Error>
GET /markets/{market_id} — Returns information about the market
identified by id.
Returns an empty Vec when the API responds with 204 No Content (no
matching markets).
§Errors
Returns Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), or Error::ServiceUnavailable
(503) as documented.
Source§impl Client
impl Client
Sourcepub async fn get_news_item(&self, id: NewsId) -> Result<Vec<NewsArticle>, Error>
pub async fn get_news_item(&self, id: NewsId) -> Result<Vec<NewsArticle>, Error>
GET /news/{item_id} — Retrieve a news article by ID.
Returns an empty Vec when the API responds with 204 No Content
(no matching article).
§Errors
Returns Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), or Error::ServiceUnavailable
(503) as documented.
Sourcepub async fn list_news_sources(&self) -> Result<Vec<NewsSource>, Error>
pub async fn list_news_sources(&self) -> Result<Vec<NewsSource>, Error>
GET /news_sources — Returns the news sources the user has access to.
§Errors
Returns Error::Unauthorized (401), Error::TooManyRequests
(429), or Error::ServiceUnavailable (503) as documented.
Source§impl Client
impl Client
Sourcepub async fn list_orders(
&self,
accid: AccountId,
deleted: Option<bool>,
) -> Result<Vec<Order>, Error>
pub async fn list_orders( &self, accid: AccountId, deleted: Option<bool>, ) -> Result<Vec<Order>, Error>
GET /accounts/{accid}/orders — Returns all orders belonging to
the given account.
§Parameters
accid— the account identifier.deleted— optional. WhenSome(true), the response includes orders that were deleted today. Defaults tofalseserver-side.
Returns an empty Vec when the API responds with 204 No Content.
§Errors
Returns Error::BadRequest (400), Error::Unauthorized (401),
Error::Forbidden (403; documented with empty body),
Error::TooManyRequests (429), or
Error::ServiceUnavailable (503) per the docs.
Sourcepub async fn place_order(
&self,
accid: AccountId,
request: &PlaceOrderRequest,
) -> Result<OrderReply, Error>
pub async fn place_order( &self, accid: AccountId, request: &PlaceOrderRequest, ) -> Result<OrderReply, Error>
POST /accounts/{accid}/orders — Enters a new order for the
tradable identified by the given market ID + tradable ID.
The Nordnet docs mark every body parameter as Swagger 2.0
FormData, so the request is sent as
application/x-www-form-urlencoded via
Client::post_form. JSON bodies are silently rejected by the
live endpoint. See `` §“Locked decisions” item 9.
§Errors
Returns Error::BadRequest (400), Error::Unauthorized (401),
Error::Forbidden (403), Error::TooManyRequests (429), or
Error::ServiceUnavailable (503) per the docs.
Sourcepub async fn modify_order(
&self,
accid: AccountId,
order_id: OrderId,
request: &ModifyOrderRequest,
) -> Result<OrderReply, Error>
pub async fn modify_order( &self, accid: AccountId, order_id: OrderId, request: &ModifyOrderRequest, ) -> Result<OrderReply, Error>
PUT /accounts/{accid}/orders/{order_id} — Modifies the price
and/or volume of an order.
The Nordnet docs mark every body parameter as Swagger 2.0
FormData, so the request is sent as
application/x-www-form-urlencoded via Client::put_form.
See `` §“Locked decisions” item 9.
§Errors
Returns Error::BadRequest (400), Error::Unauthorized (401),
Error::Forbidden (403),
Error::UnexpectedStatus (404; documented “Order not found”),
Error::TooManyRequests (429), or
Error::ServiceUnavailable (503) per the docs.
Sourcepub async fn activate_order(
&self,
accid: AccountId,
order_id: OrderId,
) -> Result<Vec<OrderReply>, Error>
pub async fn activate_order( &self, accid: AccountId, order_id: OrderId, ) -> Result<Vec<OrderReply>, Error>
PUT /accounts/{accid}/orders/{order_id}/activate — Activates
an inactive order. Sends a body-less PUT per the docs.
The doc parameter table notes that order_id accepts a
comma-separated list and the response is therefore an array of
OrderReply. The single-id call still receives an array (of
length one).
§Errors
Returns Error::BadRequest (400), Error::Unauthorized (401),
Error::Forbidden (403), Error::TooManyRequests (429), or
Error::ServiceUnavailable (503) per the docs.
Sourcepub async fn cancel_order(
&self,
accid: AccountId,
order_id: OrderId,
) -> Result<OrderReply, Error>
pub async fn cancel_order( &self, accid: AccountId, order_id: OrderId, ) -> Result<OrderReply, Error>
DELETE /accounts/{accid}/orders/{order_id} — Deletes an order.
§Errors
Returns Error::BadRequest (400), Error::Unauthorized (401),
Error::Forbidden (403), Error::TooManyRequests (429), or
Error::ServiceUnavailable (503) per the docs.
Source§impl Client
impl Client
Sourcepub async fn get_system_status(&self) -> Result<Status, Error>
pub async fn get_system_status(&self) -> Result<Status, Error>
GET /api/2 — Returns information about the system status.
The path is the API root itself (relative to the configured base URL).
In production the base URL is https://public.nordnet.se/api/2, so
this method issues GET https://public.nordnet.se/api/2/.
Source§impl Client
impl Client
Sourcepub async fn list_tick_sizes(&self) -> Result<Vec<TicksizeTable>, Error>
pub async fn list_tick_sizes(&self) -> Result<Vec<TicksizeTable>, Error>
GET /tick_sizes — Returns a list of all tick size tables.
§Errors
Returns Error::Unauthorized (401), Error::TooManyRequests
(429), or Error::ServiceUnavailable (503) as documented.
Sourcepub async fn get_tick_size(
&self,
id: TickSizeId,
) -> Result<Vec<TicksizeTable>, Error>
pub async fn get_tick_size( &self, id: TickSizeId, ) -> Result<Vec<TicksizeTable>, Error>
GET /tick_sizes/{tick_size_id} — Returns one or more tick size
tables identified by id.
The Nordnet API path parameter technically accepts a comma-separated list of IDs. This method covers the single-ID case. A future helper may be added for multi-ID lookups when needed (Phase 4+).
§Errors
Returns Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), or Error::ServiceUnavailable
(503) as documented.
Source§impl Client
impl Client
Sourcepub async fn get_tradable_info(
&self,
key: &TradableKey,
) -> Result<Vec<TradableInfo>, Error>
pub async fn get_tradable_info( &self, key: &TradableKey, ) -> Result<Vec<TradableInfo>, Error>
GET /tradables/info/{tradables} — Returns trading calendar and
allowed trading types for the given tradable.
Returns an empty Vec when the API responds with 204 No Content
(no matching tradables).
§Errors
Returns Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), or Error::ServiceUnavailable
(503) as documented.
Sourcepub async fn list_tradable_trades(
&self,
key: &TradableKey,
count: Option<&str>,
) -> Result<Vec<TradablePublicTrades>, Error>
pub async fn list_tradable_trades( &self, key: &TradableKey, count: Option<&str>, ) -> Result<Vec<TradablePublicTrades>, Error>
GET /tradables/trades/{tradables} — Returns the public trades
(all trades executed on the marketplace) for the given tradable.
§Parameters
key— the tradable to look up.count— optional. Number of trades to return. The API accepts either a positive integer ("5","10", …) or the literal string"all"; the default is"5". Passed through verbatim.
Returns an empty Vec when the API responds with 204 No Content.
§Errors
Returns Error::BadRequest (400), Error::Unauthorized (401),
Error::TooManyRequests (429), or Error::ServiceUnavailable
(503) as documented.
§Naming
The Nordnet docs call this op list_trades; renamed here to
list_tradable_trades so it can co-exist with the same-named ops
planned for the accounts and instruments groups (see module
doc).
Sourcepub async fn get_suitability(
&self,
key: &TradableKey,
) -> Result<Vec<TradableEligibility>, Error>
pub async fn get_suitability( &self, key: &TradableKey, ) -> Result<Vec<TradableEligibility>, Error>
GET /tradables/validation/suitability/{tradables} — Returns the
customer’s trading eligibility for the given tradable.
Returns an empty Vec when the API responds with 204 No Content.
§Errors
Returns Error::BadRequest (400), Error::Unauthorized (401),
Error::Forbidden (403; documented for anonymous sessions and
returned with an empty body), Error::TooManyRequests (429), or
Error::ServiceUnavailable (503) as documented.