Introduction
Automation Platform
Botmain DAO
Building Trading Strategies
API References Dev Live Stream
@botmain/execution / Class

TrailingStopLossOrder

Extends Order

A TrailingStopLossOrder to sell sets the initial stop price at a fixed amount below the market price. As the market price rises, the stop price rises by the trailing amount. However, if the market price falls, the stop price remains the same. When the stop price is hit a market order is submitted.

A TrailingStopLossOrder to buy sets the initial stop price at a fixed amount above the market price. As the market price falls, the stop price falls by the trailing amount. However, if the market price rises, the stop price remains the same. When the stop price is hit a market order is submitted.

Constructor

No documentation has been provided.
Presentation
constructor(
	id: string, 
	amount: number, 
	symbol: string, 
	side: OrderSide, 
	stopPrice: number, 
	trailingAmount: number, 
	timeInForce: TimeInForce
): TrailingStopLossOrder;
Parameters
NameTypeDescription
id
overrides Order
string

Same as in parent Order class.

amount
overrides Order
number

Same as in parent Order class.

symbol
overrides Order
string

Same as in parent Order class.

side
overrides Order
OrderSide

Same as in parent Order class.

stopPrice
number

The initial stop price. If undefined, stop price is calculated using trailingAmount only.

trailingAmount
number

The amount that is used to calculate the stop price.

timeInForce
overrides Order
TimeInForce

Same as in parent Order class.

Properties

NameTypeDescription
accountId
inherited from Order
string

Account used to send the order

amount
inherited from Order
number

Order amount in base currency

average
inherited from Order
number

Average filled price

cost
inherited from Order
number

'filled' * 'price' (filled price used where available)

datetime
inherited from Order
Date

Date & time of order placement

exchange
inherited from Order
string

Exchange of the order

fee
inherited from Order
Fee

The fee object for the order

filled
inherited from Order
number

Filled amount of base currency

id
inherited from Order
string

The unique ID of the order. Unique even between different exchanges. Generate using OrderProcessor.getNextValueOrderId()

lastTradeTimestamp
inherited from Order
number

Unix timestamp of the most recent trade on this order

market
inherited from Order
Market

Market of the order

ooReason
inherited from Order
string

Origin reason for the order

parentId
inherited from Order
string

Id of the parent algo order. undefined if the order is issues by a user strategy

portfolio
inherited from Order
string

The name of the portfolio this order belongs to. The default is undefined

price
inherited from Order
number

Price in quote currency (may be empty for market orders)

remaining
inherited from Order
number

Remaining amount pending fill

side
inherited from Order
OrderSide

Side of the order Buy/Sell or BuyCover/SellCover

status
inherited from Order
OrderStatus

Current status of the order

stopPrice
number

The initial stop price. If undefined, stop price is calculated using trailingAmount only.

symbol
inherited from Order
string

Instrument symbol of the order. Ex, "binanceDex-BTC/USDT"

timeInForce
inherited from Order
TimeInForce

Time in Force condition for the order to remain active

timestamp
inherited from Order
number

Timestamp of order placement

trades
inherited from Order
Trade[]

Trade fills associated with this order

trailingAmount
number

The amount that is used to calculate the stop price.

venueId
inherited from Order
string

Id of the order on the exchange