Solana Position
SolanaPosition Object Documentation
The SolanaPosition
class represents an individual trading position on Solana within the Roboqo platform. It extends the EventEmitter
class to allow event-driven interactions and provides methods for retrieving position details, tracking profit/loss conditions, and subscribing to real-time updates.
Methods
isOpen
isOpen
Description Checks whether the position is currently open.
Signature
Parameters
None.
Returns
boolean
:true
if the position is open,false
otherwise.
isClosed
isClosed
Description Checks whether the position is currently closed.
Signature
Parameters
None.
Returns
boolean
:true
if the position is closed,false
otherwise.
getStatus
getStatus
Description Retrieves the status of the position.
Signature
Parameters
None.
Returns
PositionStatus | undefined
: The status of the position, orundefined
if unavailable.
getInputAmount
getInputAmount
Description
Retrieves the input amount of the position as a bigint
.
Signature
Parameters
None.
Returns
bigint | undefined
: The input amount, orundefined
if unavailable.
getInputToken
getInputToken
Description Retrieves the input token details for the position.
Signature
Parameters
None.
Returns
TokenDetails | undefined
: The input token details, orundefined
if unavailable.
getOutputToken
getOutputToken
Description Retrieves the output token details for the position.
Signature
Parameters
None.
Returns
TokenDetails | undefined
: The output token details, orundefined
if unavailable.
getMint
getMint
Description Retrieves the mint address of the output token.
Signature
Parameters
None.
Returns
string | undefined
: The mint address of the output token, orundefined
if unavailable.
getFilledAmount
getFilledAmount
Description Retrieves the amount of the position that has been filled.
Signature
Parameters
None.
Returns
bigint
: The filled amount of the position.
getRemainingAmount
getRemainingAmount
Description Retrieves the remaining amount of the position.
Signature
Parameters
None.
Returns
string | undefined
: The remaining amount, orundefined
if unavailable.
getAggregatePosition
getAggregatePosition
Description Retrieves the aggregate position associated with this position.
Signature
Parameters
None.
Returns
SolanaAggregatePosition | undefined
: The aggregate position instance, orundefined
if unavailable.
onRealizedProfit
onRealizedProfit
Description Registers a callback to be executed when the realized profit reaches a specified value.
Signature
Parameters
value
(number
): The profit threshold to trigger the callback.callback
((position: Position) => void
): The function to execute when the condition is met.persistent
(boolean
, optional): Whether the callback should persist after being triggered.
Returns
void
onRealizedLoss
onRealizedLoss
Description Registers a callback to be executed when the realized loss reaches a specified value.
Signature
Parameters
value
(number
): The loss threshold to trigger the callback.callback
((position: Position) => void
): The function to execute when the condition is met.persistent
(boolean
, optional): Whether the callback should persist after being triggered.
Returns
void
onUnrealizedProfit
onUnrealizedProfit
Description Registers a callback to be executed when the unrealized profit reaches a specified value.
Signature
Parameters
value
(number
): The profit threshold to trigger the callback.callback
((position: Position) => void
): The function to execute when the condition is met.persistent
(boolean
, optional): Whether the callback should persist after being triggered.
Returns
void
onUnrealizedLoss
onUnrealizedLoss
Description Registers a callback to be executed when the unrealized loss reaches a specified value.
Signature
Parameters
value
(number
): The loss threshold to trigger the callback.callback
((position: Position) => void
): The function to execute when the condition is met.persistent
(boolean
, optional): Whether the callback should persist after being triggered.
Returns
void
onRealizedProfitPercentage
onRealizedProfitPercentage
Description Registers a callback to be executed when the realized profit percentage reaches a specified value.
Signature
Parameters
value
(number
): The profit percentage threshold to trigger the callback.callback
((position: Position) => void
): The function to execute when the condition is met.persistent
(boolean
, optional): Whether the callback should persist after being triggered.
Returns
void
onRealizedLossPercentage
onRealizedLossPercentage
Description Registers a callback to be executed when the realized loss percentage reaches a specified value.
Signature
Parameters
value
(number
): The loss percentage threshold to trigger the callback.callback
((position: Position) => void
): The function to execute when the condition is met.persistent
(boolean
, optional): Whether the callback should persist after being triggered.
Returns
void
onUnrealizedProfitPercentage
onUnrealizedProfitPercentage
Description Registers a callback to be executed when the unrealized profit percentage reaches a specified value.
Signature
Parameters
value
(number
): The profit percentage threshold to trigger the callback.callback
((position: Position) => void
): The function to execute when the condition is met.persistent
(boolean
, optional): Whether the callback should persist after being triggered.
Returns
void
onUnrealizedLossPercentage
onUnrealizedLossPercentage
Description Registers a callback to be executed when the unrealized loss percentage reaches a specified value.
Signature
Parameters
value
(number
): The loss percentage threshold to trigger the callback.callback
((position: Position) => void
): The function to execute when the condition is met.persistent
(boolean
, optional): Whether the callback should persist after being triggered.
Returns
void
Last updated