nautilus_risk/engine/config.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//! Provides a configuration for `RiskEngine` instances.
17
18use ahash::AHashMap;
19use nautilus_common::throttler::RateLimit;
20use nautilus_core::datetime::NANOSECONDS_IN_SECOND;
21use nautilus_model::identifiers::InstrumentId;
22use rust_decimal::Decimal;
23
24/// Configuration for `RiskEngineConfig` instances.
25#[derive(Debug, Clone)]
26pub struct RiskEngineConfig {
27 pub bypass: bool,
28 pub max_order_submit: RateLimit,
29 pub max_order_modify: RateLimit,
30 pub max_notional_per_order: AHashMap<InstrumentId, Decimal>,
31 pub debug: bool,
32}
33
34impl Default for RiskEngineConfig {
35 /// Creates a new [`RiskEngineConfig`] instance.
36 fn default() -> Self {
37 Self {
38 bypass: false,
39 max_order_submit: RateLimit::new(100, NANOSECONDS_IN_SECOND),
40 max_order_modify: RateLimit::new(100, NANOSECONDS_IN_SECOND),
41 max_notional_per_order: AHashMap::new(),
42 debug: false,
43 }
44 }
45}