Skip to main content

nautilus_architect_ax/common/
consts.rs

1// -------------------------------------------------------------------------------------------------
2//  Copyright (C) 2015-2026 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//! Core constants shared across the AX Exchange adapter components.
17
18use std::sync::LazyLock;
19
20use nautilus_model::identifiers::{ClientId, Venue};
21use ustr::Ustr;
22
23/// Venue identifier string.
24pub const AX: &str = "AX";
25
26/// Static venue instance.
27pub static AX_VENUE: LazyLock<Venue> = LazyLock::new(|| Venue::new(Ustr::from(AX)));
28
29/// Static client ID instance.
30pub static AX_CLIENT_ID: LazyLock<ClientId> = LazyLock::new(|| ClientId::new(Ustr::from(AX)));
31
32/// Order tag identifying orders placed by NautilusTrader.
33pub const AX_NAUTILUS_TAG: &str = "Nautilus";
34
35// HTTP endpoints
36pub const AX_HTTP_URL: &str = "https://gateway.architect.exchange/api";
37pub const AX_HTTP_SANDBOX_URL: &str = "https://gateway.sandbox.architect.exchange/api";
38
39// HTTP order management endpoints (separate base URL)
40pub const AX_ORDERS_URL: &str = "https://gateway.architect.exchange/orders";
41pub const AX_ORDERS_SANDBOX_URL: &str = "https://gateway.sandbox.architect.exchange/orders";
42
43// Market data WebSocket endpoints
44pub const AX_WS_PUBLIC_URL: &str = "wss://gateway.architect.exchange/md/ws";
45pub const AX_WS_SANDBOX_PUBLIC_URL: &str = "wss://gateway.sandbox.architect.exchange/md/ws";
46
47// Orders WebSocket endpoints (requires Bearer token authentication)
48pub const AX_WS_PRIVATE_URL: &str = "wss://gateway.architect.exchange/orders/ws";
49pub const AX_WS_SANDBOX_PRIVATE_URL: &str = "wss://gateway.sandbox.architect.exchange/orders/ws";
50
51// Authentication token TTL (seconds)
52pub const AX_AUTH_TOKEN_TTL_DATA_SECS: i32 = 86_400;
53pub const AX_AUTH_TOKEN_TTL_EXEC_SECS: i32 = 3_600;
54
55/// Timeout for awaiting account registration during execution client connect.
56pub const AX_ACCOUNT_REGISTRATION_TIMEOUT_SECS: f64 = 30.0;
57
58/// Default lookback for funding rate polling (days).
59pub const AX_FUNDING_RATE_LOOKBACK_DAYS: i64 = 7;
60
61/// Maximum lookback span (days) accepted by the AX `/fills` endpoint.
62pub const AX_FILLS_MAX_LOOKBACK_DAYS: i64 = 7;
63
64// Error message substrings for detecting specific rejection reasons
65pub const AX_POST_ONLY_REJECT: &str = "post-only order would cross the book";