nautilus_binance/
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//! Binance adapter configuration structures.
17
18use crate::common::enums::{BinanceEnvironment, BinanceProductType};
19
20/// Configuration for Binance data client.
21#[derive(Clone, Debug)]
22pub struct BinanceDataClientConfig {
23    /// Product types to subscribe to.
24    pub product_types: Vec<BinanceProductType>,
25    /// Environment (mainnet or testnet).
26    pub environment: BinanceEnvironment,
27    /// Optional base URL override for HTTP API.
28    pub base_url_http: Option<String>,
29    /// Optional base URL override for WebSocket.
30    pub base_url_ws: Option<String>,
31    /// API key for authenticated endpoints.
32    pub api_key: Option<String>,
33    /// API secret for request signing.
34    pub api_secret: Option<String>,
35}
36
37impl Default for BinanceDataClientConfig {
38    fn default() -> Self {
39        Self {
40            product_types: vec![BinanceProductType::Spot],
41            environment: BinanceEnvironment::Mainnet,
42            base_url_http: None,
43            base_url_ws: None,
44            api_key: None,
45            api_secret: None,
46        }
47    }
48}
49
50/// Configuration for Binance execution client.
51#[derive(Clone, Debug)]
52pub struct BinanceExecClientConfig {
53    /// Product types to trade.
54    pub product_types: Vec<BinanceProductType>,
55    /// Environment (mainnet or testnet).
56    pub environment: BinanceEnvironment,
57    /// Optional base URL override for HTTP API.
58    pub base_url_http: Option<String>,
59    /// Optional base URL override for WebSocket.
60    pub base_url_ws: Option<String>,
61    /// API key for authenticated endpoints (required).
62    pub api_key: String,
63    /// API secret for request signing (required).
64    pub api_secret: String,
65}