trading.optimizer.analysis.builder
trading.optimizer.analysis.builder
OpenPosition
dataclass
OpenPosition(quantity: units = 0, entry_time: datetime | None = None, entry_price: USD | None = None)
A single open position when building trade points.
Attributes:
| Name | Type | Description |
|---|---|---|
quantity |
units
|
The units for the position. |
entry_time |
datetime | None
|
The time in which the trade was entered. |
entry_price |
USD | None
|
The price in which the trade was entered at. |
build_context
build_context(data: ExecutionData) -> AnalysisContext
Builds an AnalysisContext for a single backtest.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
ExecutionData
|
The |
required |
Returns:
| Name | Type | Description |
|---|---|---|
AnalysisContext |
AnalysisContext
|
The context to compute metrics for the backtest. |
Source code in src\contango\trading\optimizer\analysis\builder.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |