sell

Generates a new sell order

(sell {asset} shares options?)

Returns

The sell function returns an order object containing information about the sell action. If the order is not generated due to existing open positions, it may return null

Parameters

{asset} (asset) - asset to be sold

shares (number) - the number of units (shares, contracts, etc.) to be sold.

options (optional, object) - target: checks openPositions and generates order to balance portfolio

Examples

(sell {AAPL} 1)            ;; sells one share of AAPL
;;=> order {symbol: "AAPL", action: "sell", units: 1, ....}

;; openPositions = [{symbol: "AAPL", side: "short", units: 1}]
(sell {AAPL} 1 {target: true})
;; will not generate a order because openPositions allready has
;; 1 share of AAPL short

Was this helpful?