nautilus_binance/spot/
enums.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//! Binance Spot-specific enumerations.
17
18use serde::{Deserialize, Serialize};
19
20/// Spot order type enumeration.
21#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
22#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
23pub enum BinanceSpotOrderType {
24    /// Limit order.
25    Limit,
26    /// Market order.
27    Market,
28    /// Stop loss (triggers market sell when price drops to stop price).
29    StopLoss,
30    /// Stop loss limit (triggers limit sell when price drops to stop price).
31    StopLossLimit,
32    /// Take profit (triggers market sell when price rises to stop price).
33    TakeProfit,
34    /// Take profit limit (triggers limit sell when price rises to stop price).
35    TakeProfitLimit,
36    /// Limit maker (post-only, rejected if would match immediately).
37    LimitMaker,
38    /// Unknown or undocumented value.
39    #[serde(other)]
40    Unknown,
41}
42
43/// Spot order response type.
44#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
45#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
46pub enum BinanceOrderResponseType {
47    /// Acknowledge only (fastest).
48    Ack,
49    /// Result with order details.
50    Result,
51    /// Full response with fills.
52    #[default]
53    Full,
54}
55
56/// Cancel/replace mode for order modification.
57#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
58#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
59pub enum BinanceCancelReplaceMode {
60    /// Stop if cancel fails.
61    StopOnFailure,
62    /// Continue with new order even if cancel fails.
63    AllowFailure,
64}