Positions Object
Positions Object Documentation
The Positions
class provides methods for tracking and managing aggregate trading positions within the Roboqo platform. It enables retrieving aggregate positions for specific mints, subscribing to position updates, and managing position tracking callbacks. This class extends the Subscribable
class, allowing it to emit updates when position changes occur.
Methods
getAggregatePosition
getAggregatePosition
Description Retrieves the aggregate position for a specific mint.
Signature
Parameters
mint
(string
): The mint address for which to retrieve the aggregate position.
Returns
SolanaAggregatePosition | undefined
: An instance representing the aggregate position for the specified mint, orundefined
if no position exists.
getAggregatePositions
getAggregatePositions
Description Retrieves all aggregate positions currently tracked.
Signature
Parameters
None.
Returns
SolanaAggregatePosition[]
: An array ofSolanaAggregatePosition
instances representing all tracked aggregate positions.
watchAggregatePosition
watchAggregatePosition
Description Subscribes to updates for an aggregate position based on the specified mint. The callback function will be invoked whenever the position updates.
Signature
Parameters
mint
(string
): The mint address to watch for aggregate position updates.callback
((pnl: AggregatePosition<BigNumber>) => void
): A function that will be invoked with the updated position when changes occur.
Returns
Promise<void>
: Resolves when the subscription is successfully registered.
unwatchAggregatePosition
unwatchAggregatePosition
Description Unsubscribes from updates for an aggregate position based on the specified mint. The specified callback will be removed from the subscription list.
Signature
Parameters
mint
(string
): The mint address for which to stop receiving aggregate position updates.callback
((pnl: AggregatePosition<BigNumber>) => void
): The callback function to remove from the subscription list.
Returns
Promise<void>
: Resolves when the unsubscription is successfully processed.
Last updated