Buy
Syntax
Description
The buy
function generates a buy order for a specified symbol and number of units. It returns an order object containing information about the buy action.
The function also supports additional options to control order generation based on existing open positions.
Returns
The buy
function returns an order object containing information about the buy action. If the order is not generated due to existing open positions, it may return null
Parameters
asset
: asset to be boughtshares
: the number of units (shares, contracts, etc.) to be bought.options?
target
: checks openPositions and generates order to balance portfolioround
: round the number of shares to the nearest whole number