Enums
CommissionType
Bases: Enum
Enumeration for commission calculation types.
This enum defines how commissions are calculated for trades in the backtesting framework.
Attributes:
| Name | Type | Description |
|---|---|---|
PERCENTAGE |
int
|
Commission calculated as percentage of trade value (0). Commission = trade_value * commission_rate |
CASH |
int
|
Commission calculated as fixed cash amount per lot (1). Commission = quantity * commission_rate / lot_size |
Order
dataclass
Dataclass representing a trading order.
This class encapsulates all the information needed to define and track a trading order, including its side, quantity, type, execution conditions, and current status.
Attributes:
| Name | Type | Description |
|---|---|---|
side |
OrderSide
|
Whether this is a buy or sell order. |
quantity |
float64
|
Number of shares/contracts to trade. |
type |
OrderType
|
Order execution type (market or limit). |
price |
float64 | None
|
Limit price for limit orders, None for market orders. |
stop_loss |
float64 | None
|
Stop loss price, if any. |
take_profit |
float64 | None
|
Take profit price, if any. |
status |
OrderStatus
|
Current status of the order. |
timestamp |
datetime
|
Time when the order was created. |
OrderSide
Bases: Enum
Enumeration for order side (buy/sell direction).
This enum defines whether an order is a buy (long) or sell (short) order.
Attributes:
| Name | Type | Description |
|---|---|---|
BUY |
int
|
Represents a buy order (1). |
SELL |
int
|
Represents a sell order (-1). |
OrderStatus
Bases: Enum
Enumeration for order execution status.
This enum tracks the current state of an order during its lifecycle.
Attributes:
| Name | Type | Description |
|---|---|---|
ACTIVE |
int
|
Order is active with stop loss or take profit conditions (0). |
COMPLETE |
int
|
Order has been fully executed and no further actions needed (1). |
PENDING |
int
|
Order is pending execution, waiting for price or time trigger (2). |
OrderType
Bases: Enum
Enumeration for order execution types.
This enum defines how an order should be executed in the market.
Attributes:
| Name | Type | Description |
|---|---|---|
MARKET |
int
|
Market order that executes immediately at current market price (0). |
LIMIT |
int
|
Limit order that executes only at specified price or better (1). |
Source code
src/quantex/backtester/constants.py- Backtester enumssrc/quantex/broker/types.py- Broker type definitions and enums