# 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`

**Description**\
Checks whether the position is currently open.

**Signature**

```typescript
public isOpen(): boolean
```

**Parameters**

* None.

**Returns**

* `boolean`: `true` if the position is open, `false` otherwise.

***

#### `isClosed`

**Description**\
Checks whether the position is currently closed.

**Signature**

```typescript
public isClosed(): boolean
```

**Parameters**

* None.

**Returns**

* `boolean`: `true` if the position is closed, `false` otherwise.

***

#### `getStatus`

**Description**\
Retrieves the status of the position.

**Signature**

```typescript
public getStatus(): PositionStatus | undefined
```

**Parameters**

* None.

**Returns**

* `PositionStatus | undefined`: The status of the position, or `undefined` if unavailable.

***

#### `getInputAmount`

**Description**\
Retrieves the input amount of the position as a `bigint`.

**Signature**

```typescript
public getInputAmount(): bigint | undefined
```

**Parameters**

* None.

**Returns**

* `bigint | undefined`: The input amount, or `undefined` if unavailable.

***

#### `getInputToken`

**Description**\
Retrieves the input token details for the position.

**Signature**

```typescript
public getInputToken(): TokenDetails | undefined
```

**Parameters**

* None.

**Returns**

* `TokenDetails | undefined`: The input token details, or `undefined` if unavailable.

***

#### `getOutputToken`

**Description**\
Retrieves the output token details for the position.

**Signature**

```typescript
public getOutputToken(): TokenDetails | undefined
```

**Parameters**

* None.

**Returns**

* `TokenDetails | undefined`: The output token details, or `undefined` if unavailable.

***

#### `getMint`

**Description**\
Retrieves the mint address of the output token.

**Signature**

```typescript
public getMint(): string | undefined
```

**Parameters**

* None.

**Returns**

* `string | undefined`: The mint address of the output token, or `undefined` if unavailable.

***

#### `getFilledAmount`

**Description**\
Retrieves the amount of the position that has been filled.

**Signature**

```typescript
public getFilledAmount(): bigint
```

**Parameters**

* None.

**Returns**

* `bigint`: The filled amount of the position.

***

#### `getRemainingAmount`

**Description**\
Retrieves the remaining amount of the position.

**Signature**

```typescript
public getRemainingAmount(): string | undefined
```

**Parameters**

* None.

**Returns**

* `string | undefined`: The remaining amount, or `undefined` if unavailable.

***

#### `getAggregatePosition`

**Description**\
Retrieves the aggregate position associated with this position.

**Signature**

```typescript
public getAggregatePosition(): SolanaAggregatePosition | undefined
```

**Parameters**

* None.

**Returns**

* `SolanaAggregatePosition | undefined`: The aggregate position instance, or `undefined` if unavailable.

***

#### `onRealizedProfit`

**Description**\
Registers a callback to be executed when the realized profit reaches a specified value.

**Signature**

```typescript
public onRealizedProfit(
  value: number,
  callback: (position: Position) => void,
  persistent?: boolean
): void
```

**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`

**Description**\
Registers a callback to be executed when the realized loss reaches a specified value.

**Signature**

```typescript
public onRealizedLoss(
  value: number,
  callback: (position: Position) => void,
  persistent?: boolean
): void
```

**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`

**Description**\
Registers a callback to be executed when the unrealized profit reaches a specified value.

**Signature**

```typescript
public onUnrealizedProfit(
  value: number,
  callback: (position: Position) => void,
  persistent?: boolean
): void
```

**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`

**Description**\
Registers a callback to be executed when the unrealized loss reaches a specified value.

**Signature**

```typescript
public onUnrealizedLoss(
  value: number,
  callback: (position: Position) => void,
  persistent?: boolean
): void
```

**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`

**Description**\
Registers a callback to be executed when the realized profit percentage reaches a specified value.

**Signature**

```typescript
public onRealizedProfitPercentage(
  value: number,
  callback: (position: Position) => void,
  persistent?: boolean
): void
```

**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`

**Description**\
Registers a callback to be executed when the realized loss percentage reaches a specified value.

**Signature**

```typescript
public onRealizedLossPercentage(
  value: number,
  callback: (position: Position) => void,
  persistent?: boolean
): void
```

**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`

**Description**\
Registers a callback to be executed when the unrealized profit percentage reaches a specified value.

**Signature**

```typescript
public onUnrealizedProfitPercentage(
  value: number,
  callback: (position: Position) => void,
  persistent?: boolean
): void
```

**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`

**Description**\
Registers a callback to be executed when the unrealized loss percentage reaches a specified value.

**Signature**

```typescript
public onUnrealizedLossPercentage(
  value: number,
  callback: (position: Position) => void,
  persistent?: boolean
): void
```

**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`
