1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
//! Models for the `tradables` resource group.
//! Derived strictly from these schema files in the docs:
//! - `TradableInfo.md`
//! - `TradablePublicTrades.md`
//! - `TradableEligibility.md`
//! - `PublicTrade.md`
//! - `CalendarDay.md`
//! - `OrderType.md`
//! Per the project conventions, every referenced type is defined locally here. Cross-group
//! deduplication (e.g. with the structurally similar `instruments` group types)
//! is deferred to Phase 3X.
//!
//! ## Doc notes (for Phase 3X reconciliation)
//! - `TradableEligibility.market_id` is documented as `integer(int32)` while
//! every other `market_id` in the API is `integer(int64)`. We keep the
//! uniform [`MarketId`] newtype (which is `i64`) and flag the asymmetry
//! here. Phase 3X may either widen the docs upstream or introduce a
//! narrower newtype.
//! - `CalendarDay.date` is `string(date)` (YYYY-MM-DD). It is kept as a
//! plain `String` here — wiring `time::Date` would require a custom serde
//! adapter, which is out of scope for the typed binding's first pass.
//! Phase 3X may introduce a strongly-typed wrapper.
//! - `CalendarDay.open` / `CalendarDay.close` and
//! `PublicTrade.tick_timestamp` / `PublicTrade.trade_timestamp` are
//! `integer(int64)` UNIX-millisecond epoch timestamps. They are kept as
//! plain `i64` (no `EpochMillis` newtype exists under
//! `crate::models::shared`).
//! - `PublicTrade.price` is `number(double)`. It is typed as
//! [`rust_decimal::Decimal`] (with the `arbitrary_precision` adapter)
//! — never `f64`. Because of this `PublicTrade` and
//! `TradablePublicTrades` cannot derive [`Eq`].
use crate;
use Decimal;
use ;
/// Tradable lookup key: `[market_id]:[identifier]` (e.g. `11:101` for ERIC B).
/// Constructed by callers and passed to the tradable-keyed resource methods
/// on `nordnet_api::Client`. The wire form (`{market_id}:{identifier}`) is
/// produced by the [`std::fmt::Display`] impl.
/// Multi-key lookups (the API accepts a comma-separated list in the path)
/// are not modelled here — Phase 4 is expected to add a small helper for
/// that shape so the typed API stays single-key by default.
/// Renders the wire form `{market_id}:{identifier}` (e.g. `11:101`) used
/// by the tradable-keyed path segments of the REST API.
/// One trading-calendar day for a tradable.
/// All fields are required.
/// `open` and `close` are UNIX-millisecond epoch timestamps (see module
/// doc note); `date` is a `YYYY-MM-DD` string (see module doc note).
/// One allowed order type for a tradable: a `(name, type)` pair where
/// `name` is the localized label and `type` is the wire code (e.g.
/// `LIMIT`, `STOP_LIMIT`).
/// Both fields are required.
/// Renamed from `OrderType` to `AllowedOrderType` to disambiguate from
/// [`crate::models::orders::OrderType`], which is the closed enum used
/// on the request side of `place_order`. Each is a different concept —
/// the tradable's allowed-set is a per-instrument capability discovered
/// at runtime; the request enum is the value the caller sends.
/// The wire field `type` is a Rust keyword — exposed as `r#type` with
/// `#[serde(rename = "type")]`.
/// Trading calendar and allowed trading types for a single tradable.
/// All fields are required.
/// One public trade executed on the marketplace.
///
/// Cannot derive [`Eq`] because `price` is a `Decimal` (which only
/// implements `PartialEq` after the `arbitrary_precision` adapter).
/// Public trades for a single tradable.
/// Cannot derive [`Eq`]
/// because the nested [`PublicTrade::price`] is a `Decimal`.
/// Customer trading eligibility for a single tradable.
/// All fields are required.
/// Note: `market_id` is documented as `integer(int32)` here while every
/// other `market_id` in the API is `integer(int64)`. We keep the uniform
/// [`MarketId`] (`i64`) newtype — see module doc note.