import { Broker } from './broker'; import { Order } from './order'; import { TradeOptions } from './interfaces'; export declare class Trade { private readonly broker; private _size; private _entryPrice; private _exitPrice?; private _entryBar; private _exitBar?; private _slOrder?; private _tpOrder?; private _tag?; constructor(broker: Broker, options: TradeOptions); /** * Trade size (volume; negative for short trades). */ get size(): number; /** * Trade entry price. */ get entryPrice(): number; /** * Trade exit price (or undefined if the trade is still active). */ get exitPrice(): number | undefined; /** * Candlestick bar index of when the trade was entered. */ get entryBar(): number; /** * Candlestick bar index of when the trade was exited * (or undefined if the trade is still active). */ get exitBar(): number | undefined; /** * A tag value inherited from the `Order` that opened this trade. * This can be used to track trades and apply conditional logic / subgroup analysis. */ get tag(): Record | undefined; /** * Get stop-loss order. */ get slOrder(): Order | undefined; /** * Get take-profit order. */ get tpOrder(): Order | undefined; /** * Datetime of when the trade was entered. */ get entryTime(): string; /** * Datetime of when the trade was exited. */ get exitTime(): string; /** * True if the trade is long (trade size is positive). */ get isLong(): boolean; /** * True if the trade is short (trade size is negative). */ get isShort(): boolean; /** * Trade profit (positive) or loss (negative) in cash units. */ get pl(): number; /** * Trade profit (positive) or loss (negative) in percent. */ get plPct(): number; /** * Trade total value in cash (volume * price). */ get value(): number; /** * Stop-loss price at which to close the trade. * * This variable is writable. By assigning it a new price value, * you create or modify the existing SL order. * By assigning it `undefined`, you cancel it. */ get sl(): number; /** * Set stop-loss price. */ set sl(price: number); /** * Take-profit price at which to close the trade. * * This property is writable. By assigning it a new price value, * you create or modify the existing TP order. * By assigning it `undefined`, you cancel it. */ get tp(): number; /** * Set take-profit price. */ set tp(price: number); /** * Place new `Order` to close `portion` of the trade at next market price. */ close(portion?: number): void; /** * Replace the trade. */ replace(options: Partial): this; /** * Copy the trade. */ copy(options: Partial): any; private setContingent; }