nautilus_model/identifiers/
stubs.rs

1// -------------------------------------------------------------------------------------------------
2//  Copyright (C) 2015-2025 Nautech Systems Pty Ltd. All rights reserved.
3//  https://nautechsystems.io
4//
5//  Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
6//  You may not use this file except in compliance with the License.
7//  You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
8//
9//  Unless required by applicable law or agreed to in writing, software
10//  distributed under the License is distributed on an "AS IS" BASIS,
11//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//  See the License for the specific language governing permissions and
13//  limitations under the License.
14// -------------------------------------------------------------------------------------------------
15
16//! Default implementations and fixture functions to provide stub identifiers for testing.
17
18use nautilus_core::UUID4;
19use rstest::fixture;
20
21use crate::identifiers::{
22    AccountId, ClientId, ClientOrderId, ComponentId, ExecAlgorithmId, InstrumentId, OrderListId,
23    PositionId, StrategyId, Symbol, TradeId, TraderId, Venue, VenueOrderId,
24};
25
26// ---- AccountId ----
27
28#[fixture]
29pub fn account_id() -> AccountId {
30    AccountId::from("SIM-001")
31}
32
33#[fixture]
34pub fn account_ib() -> AccountId {
35    AccountId::from("IB-1234567890")
36}
37
38// ---- ClientId ----
39
40#[fixture]
41pub fn client_id_binance() -> ClientId {
42    ClientId::from("BINANCE")
43}
44
45#[fixture]
46pub fn client_id_dydx() -> ClientId {
47    ClientId::from("COINBASE")
48}
49
50// ---- ClientOrderId ----
51
52#[fixture]
53pub fn client_order_id() -> ClientOrderId {
54    ClientOrderId::from("O-19700101-000000-001-001-1")
55}
56
57// ---- ComponentId ----
58
59#[fixture]
60pub fn component_risk_engine() -> ComponentId {
61    ComponentId::from("RiskEngine")
62}
63
64// ---- ExecAlgorithmId ----
65
66#[fixture]
67pub fn exec_algorithm_id() -> ExecAlgorithmId {
68    ExecAlgorithmId::from("001")
69}
70
71// ---- InstrumentId ----
72
73#[fixture]
74pub fn instrument_id_eth_usdt_binance() -> InstrumentId {
75    InstrumentId::from("ETHUSDT.BINANCE")
76}
77
78#[fixture]
79pub fn instrument_id_btc_usdt() -> InstrumentId {
80    InstrumentId::from("BTCUSDT.COINBASE")
81}
82
83#[fixture]
84pub fn instrument_id_aud_usd_sim() -> InstrumentId {
85    InstrumentId::from("AUDUSD.SIM")
86}
87
88// ---- OrderListId ----
89
90#[fixture]
91pub fn order_list_id_test() -> OrderListId {
92    OrderListId::from("001")
93}
94
95// ---- PositionId ----
96
97#[fixture]
98pub fn position_id_test() -> PositionId {
99    PositionId::from("P-123456789")
100}
101
102// ---- StrategyId ----
103
104#[fixture]
105pub fn strategy_id_ema_cross() -> StrategyId {
106    StrategyId::from("EMACross-001")
107}
108
109// ---- Symbol ----
110
111#[fixture]
112pub fn symbol_eth_perp() -> Symbol {
113    Symbol::from("ETH-PERP")
114}
115
116#[fixture]
117pub fn symbol_aud_usd() -> Symbol {
118    Symbol::from("AUDUSD")
119}
120
121// ---- TradeId ----
122
123#[fixture]
124pub fn trade_id() -> TradeId {
125    TradeId::from("1234567890")
126}
127
128// ---- TraderId ----
129
130#[fixture]
131pub fn trader_id() -> TraderId {
132    TraderId::from("TRADER-001")
133}
134
135// ---- Venue ----
136
137#[fixture]
138pub fn venue_binance() -> Venue {
139    Venue::from("BINANCE")
140}
141
142#[fixture]
143pub fn venue_sim() -> Venue {
144    Venue::from("SIM")
145}
146
147// ---- VenueOrderId ----
148
149#[fixture]
150pub fn venue_order_id() -> VenueOrderId {
151    VenueOrderId::from("001")
152}
153
154// ---- UUID4 ----
155
156#[fixture]
157pub fn uuid4() -> UUID4 {
158    UUID4::from("16578139-a945-4b65-b46c-bc131a15d8e7")
159}