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
isOpenDescription Checks whether the position is currently open.
Signature
public isOpen(): booleanParameters
None.
Returns
boolean:trueif the position is open,falseotherwise.
isClosed
isClosedDescription Checks whether the position is currently closed.
Signature
public isClosed(): booleanParameters
None.
Returns
boolean:trueif the position is closed,falseotherwise.
getStatus
getStatusDescription Retrieves the status of the position.
Signature
public getStatus(): PositionStatus | undefinedParameters
None.
Returns
PositionStatus | undefined: The status of the position, orundefinedif unavailable.
getInputAmount
getInputAmountDescription
Retrieves the input amount of the position as a bigint.
Signature
public getInputAmount(): bigint | undefinedParameters
None.
Returns
bigint | undefined: The input amount, orundefinedif unavailable.
getInputToken
getInputTokenDescription Retrieves the input token details for the position.
Signature
public getInputToken(): TokenDetails | undefinedParameters
None.
Returns
TokenDetails | undefined: The input token details, orundefinedif unavailable.
getOutputToken
getOutputTokenDescription Retrieves the output token details for the position.
Signature
public getOutputToken(): TokenDetails | undefinedParameters
None.
Returns
TokenDetails | undefined: The output token details, orundefinedif unavailable.
getMint
getMintDescription Retrieves the mint address of the output token.
Signature
public getMint(): string | undefinedParameters
None.
Returns
string | undefined: The mint address of the output token, orundefinedif unavailable.
getFilledAmount
getFilledAmountDescription Retrieves the amount of the position that has been filled.
Signature
public getFilledAmount(): bigintParameters
None.
Returns
bigint: The filled amount of the position.
getRemainingAmount
getRemainingAmountDescription Retrieves the remaining amount of the position.
Signature
public getRemainingAmount(): string | undefinedParameters
None.
Returns
string | undefined: The remaining amount, orundefinedif unavailable.
getAggregatePosition
getAggregatePositionDescription Retrieves the aggregate position associated with this position.
Signature
public getAggregatePosition(): SolanaAggregatePosition | undefinedParameters
None.
Returns
SolanaAggregatePosition | undefined: The aggregate position instance, orundefinedif unavailable.
onRealizedProfit
onRealizedProfitDescription Registers a callback to be executed when the realized profit reaches a specified value.
Signature
public onRealizedProfit(
value: number,
callback: (position: Position) => void,
persistent?: boolean
): voidParameters
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
onRealizedLossDescription Registers a callback to be executed when the realized loss reaches a specified value.
Signature
public onRealizedLoss(
value: number,
callback: (position: Position) => void,
persistent?: boolean
): voidParameters
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
onUnrealizedProfitDescription Registers a callback to be executed when the unrealized profit reaches a specified value.
Signature
public onUnrealizedProfit(
value: number,
callback: (position: Position) => void,
persistent?: boolean
): voidParameters
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
onUnrealizedLossDescription Registers a callback to be executed when the unrealized loss reaches a specified value.
Signature
public onUnrealizedLoss(
value: number,
callback: (position: Position) => void,
persistent?: boolean
): voidParameters
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
onRealizedProfitPercentageDescription Registers a callback to be executed when the realized profit percentage reaches a specified value.
Signature
public onRealizedProfitPercentage(
value: number,
callback: (position: Position) => void,
persistent?: boolean
): voidParameters
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
onRealizedLossPercentageDescription Registers a callback to be executed when the realized loss percentage reaches a specified value.
Signature
public onRealizedLossPercentage(
value: number,
callback: (position: Position) => void,
persistent?: boolean
): voidParameters
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
onUnrealizedProfitPercentageDescription Registers a callback to be executed when the unrealized profit percentage reaches a specified value.
Signature
public onUnrealizedProfitPercentage(
value: number,
callback: (position: Position) => void,
persistent?: boolean
): voidParameters
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
onUnrealizedLossPercentageDescription Registers a callback to be executed when the unrealized loss percentage reaches a specified value.
Signature
public onUnrealizedLossPercentage(
value: number,
callback: (position: Position) => void,
persistent?: boolean
): voidParameters
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