ChartPosition class

Represents an executed open trading position displayed on the chart canvas with real-time unrealized P&L tracking and connected protective TP/SL brackets.

Annotations

Constructors

ChartPosition({required String id, required String symbol, required PositionSide side, required double entryPrice, double quantity = 1.0, double? takeProfitPrice, double? stopLossPrice, required DateTime openedAt, String? customLabel, Map<String, dynamic>? metadata})
const

Properties

customLabel → String?
final
entryPrice → double
final
hashCode → int
The hash code for this object.
no setteroverride
hasStopLoss → bool
no setter
hasTakeProfit → bool
no setter
id → String
final
isLong → bool
no setter
isShort → bool
no setter
metadata → Map<String, dynamic>?
final
openedAt → DateTime
final
quantity → double
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
side → PositionSide
final
stopLossPercentage → double?
Returns protective stop loss distance percentage relative to entry price.
no setter
stopLossPrice → double?
final
symbol → String
final
takeProfitPercentage → double?
Returns target take profit distance percentage relative to entry price.
no setter
takeProfitPrice → double?
final

Methods

copyWith({String? id, String? symbol, PositionSide? side, double? entryPrice, double? quantity, ValueGetter<double?>? takeProfitPrice, ValueGetter<double?>? stopLossPrice, DateTime? openedAt, String? customLabel, Map<String, dynamic>? metadata}) → ChartPosition
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
unrealizedPnL(double currentPrice) → double
Calculates net unrealized profit or loss in absolute currency units.
unrealizedPnLPercentage(double currentPrice) → double
Calculates net unrealized profit or loss percentage relative to entry price.

Operators

operator ==(Object other) → bool
The equality operator.
override