Skip to main content

nautilus_tardis/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//! Tardis adapter constants.
17
18use std::{num::NonZeroU32, sync::LazyLock};
19
20use nautilus_network::ratelimiter::quota::Quota;
21
22/// The Tardis adapter identifier string.
23pub const TARDIS: &str = "TARDIS";
24
25/// Environment variable name for the Tardis API key.
26pub const TARDIS_API_KEY: &str = "TARDIS_API_KEY";
27
28/// Environment variable name for the Tardis Machine WebSocket URL.
29pub const TARDIS_MACHINE_WS_URL: &str = "TARDIS_MACHINE_WS_URL";
30
31/// Rate limit key for Tardis REST API requests.
32pub const TARDIS_REST_RATE_KEY: &str = "tardis_rest";
33
34/// Default rate limit for Tardis REST API (10 requests per second).
35pub static TARDIS_REST_QUOTA: LazyLock<Quota> = LazyLock::new(|| {
36    Quota::per_second(NonZeroU32::new(10).expect("non-zero")).expect("valid quota")
37});
38
39/// Maximum reconnection delay for the Tardis Machine WebSocket in seconds.
40pub const WS_MAX_RECONNECT_DELAY_SECS: u64 = 30;
41
42/// Initial reconnection delay for the Tardis Machine WebSocket in seconds.
43pub const WS_INITIAL_RECONNECT_DELAY_SECS: u64 = 1;
44
45/// Heartbeat (ping) interval for the Tardis Machine WebSocket in seconds.
46pub const WS_HEARTBEAT_INTERVAL_SECS: u64 = 10;