Position Information

AdjustVPosition

Adjusts a virtual bot position by processing a simulated order using the defined specifications. Works similarly to PlaceExitLongOrder/PlaceExitShortOrder, but will NOT create a real order; only simulated!

  • AdjustVPosition(price, amount, [ positionId ])

Return Type: Void

CloseVPosition

Closes a virtual bot position entirely by processing a simulated order using the defined specifications. Works similarly to DoExitPosition and PlaceExitPositionOrder, but will NOT create a real order; only simulated! Use this to "clean up" bot positions if required.

  • CloseVPosition(price, [ positionId ])

Return Type: Void

CreatePosition

Creates a bot position by processing a simulated order using the defined specifications. By doing this, profit/loss and position details can be used by the script. Use the returned position ID with PositionContainer() to extract position data.

  • CreatePosition(direction, price, amount, [ market ], [ leverage ], [ positionId ])

Returns the position ID.

Return Type: String

GetAllOpenPositions

Gets all open positions and returns them as PositionContainers.

  • GetAllOpenPositions()

Returns an array of PositionContainers.

Return Type: Dynamic

GetPositionAmount

Gets the total amount open in a specific position.

  • GetPositionAmount([ positionId ])

Returns the total amount open in a specific position.

Return Type: Number

GetPositionDirection

Gets the direction of a specific position.

  • GetPositionDirection([ positionId ])

Returns PositionLong, PositionShort or NoPosition.

Return Type: Enum

GetPositionEnterPrice

Gets the average enter price of an open position.

  • GetPositionEnterPrice([ positionId ])

Returns the average enter price.

Return Type: Number

GetPositionMarket

Gets the market of an open position.

  • GetPositionMarket([ positionId ])

Returns the account, market & leverage as a single string.

Return Type: String

GetPositionProfit

Gets the total realized plus unrealized profit of a specific position.

  • GetPositionProfit([ positionId ], [ targetPrice ])

Returns the total realized plus unrealized profit of a specific position. On spot/margin the result will be in the quote currency. For leverage its in the underlying currency.

Return Type: Number

GetPositionROI

Calculates the ROI based on used margin and unrealized + realized profits.

  • GetPositionROI([ positionId ], [ targetPrice ])

Returns the ROI as a percentage.

Return Type: Number

IsPositionClosed

Checks whether or not a position is closed.

  • IsPositionClosed([ positionId ])

Returns true if position is closed, otherwise false.

Return Type: Boolean

LongAmount

Gets the total amount open in a long position.

  • LongAmount([ market ])

Returns the total amount open in a long position.

Return Type: Number

PositionContainer

Gets all the information from the open bot position.

  • PositionContainer([ positionId ])

Returns an array with position information.

Return Type: Dynamic

ShortAmount

Gets the total amount open in a short position.

  • ShortAmount([ market ])

Returns the total amount open in a short position.

Return Type: Number

Last updated