Expand description
§nordnet-api
Typed REST bindings for the Nordnet External API v2.
HTTP-shaped surface only. Wire-typed inputs/outputs (request and response
structs, ID newtypes, the Ed25519 login primitives) live in the sibling
nordnet-model crate; this crate
composes them with reqwest-backed HTTP plumbing.
Covers the full non-deprecated REST surface (~42 operations across 12
resource groups). Every operation has a wiremock integration test in-tree.
§Install
cargo add nordnet-api§Usage
use nordnet_api::Client;
use nordnet_api::resources::accounts::ListAccountsQuery;
use nordnet_model::auth::Session;
let client = Client::new("https://public.nordnet.se/api/2")?
.with_session(Session {
session_key: std::env::var("NORDNET_SESSION_KEY").unwrap(),
expires_in: 3600,
});
let accounts = client.list_accounts(ListAccountsQuery::default()).await?;
for a in accounts {
println!("{:?}", a);
}Authentication is the v2 SSH-key flow: POST /login/start returns a
challenge, the caller signs the raw UTF-8 bytes with an Ed25519 key, and
POST /login/verify returns a session_key. The login primitives live in
nordnet-model::auth.
§Resource groups
Each group is a module under resources;
every operation hangs off Client and carries a #[doc(alias = "METHOD /path")]
so rustdoc search resolves raw HTTP paths.
| Group | Ops | Coverage |
|---|---|---|
accounts | 6 | accounts, info, ledgers, positions, returns, trades |
countries | 2 | list + lookup by ISO code |
instrument_search | 6 | attributes + stock/bullbear/minifuture/turbo/option searches |
instruments | 9 | lookup, types, underlyings, leverages, suitability, trades |
login | 4 | start, verify, refresh, logout |
main_search | 1 | unified instruments/news/CMS search |
markets | 2 | list + lookup by ID |
news | 2 | article fetch + sources |
orders | 5 | list, place, modify, activate, cancel |
root | 1 | system status |
tick_sizes | 2 | list + lookup by ID |
tradables | 3 | info, trades, suitability |
§Companion crates
nordnet-model— wire-typed inputs/outputs (no I/O).nordnet-feed— streaming public + private feeds.nordnet-cli—nordnetbinary built on top.
§License
Dual-licensed under MIT OR Apache-2.0.
Re-exports§
Modules§
- client
- HTTP client for the Nordnet External API.
- error
- Error type for the Nordnet API client.
- pagination
- Offset/limit pagination helpers.
- resources