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