# Get All Positions

<mark style="color:green;">**`GET`**</mark> `https://api.sfox.com/v1/margin/loans`

Retrieve a list of your account's positions.

{% hint style="info" %}
[**Rate Limit**](/rest-api/rate-limits.md)**: 10 requests per 10 seconds**
{% endhint %}

### Query Parameters

<table><thead><tr><th width="286">Name</th><th width="100">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>status</code></strong></td><td>string</td><td><p>Filter response by position status</p><p><code>active</code> (default) = active positions</p><p><code>closed</code> = settlement history</p></td></tr><tr><td><strong><code>pair</code></strong></td><td>string</td><td>Filter response by currency pair associated with the position i.e. <code>btcusd</code></td></tr><tr><td><strong><code>loan_currency</code></strong></td><td>string</td><td>Filter response by loan currency i.e. <code>btc</code></td></tr><tr><td><strong><code>collateral_currency</code></strong></td><td>string</td><td>Filter response by collateral currency i.e. <code>btc</code></td></tr><tr><td><strong><code>margin_type</code></strong></td><td>string</td><td><p>Filter response by margin type</p><p><code>PTS_SHORT</code> = short positions</p><p><code>PTS_LONG</code> = long positions</p></td></tr><tr><td><strong><code>from</code></strong></td><td>string</td><td>Starting UNIX timestamp (in millis)<br></td></tr><tr><td><strong><code>to</code></strong></td><td>string</td><td>Ending UNIX timestamp (in millis)<br></td></tr><tr><td><strong><code>page_size</code></strong></td><td>string</td><td>The number of positions sent in the request. Default/Max = 100</td></tr><tr><td><strong><code>page_cursor</code></strong></td><td>string</td><td>The last Position Id of the previous page. The request will contain orders following the cursor.</td></tr></tbody></table>

### Response Body

<table><thead><tr><th width="311">Key</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>id</code></strong></td><td>Position ID</td></tr><tr><td><strong><code>status</code></strong></td><td>The status of the position<br><code>ACTIVE</code> : Outstanding pending settlement<br><code>CLOSED</code> : Settled</td></tr><tr><td><strong><code>date_added</code></strong></td><td>Date and time the position was opened</td></tr><tr><td><strong><code>date_loan_closed</code></strong></td><td>The date and time the position was settled (<code>null</code> if position is active)</td></tr><tr><td><strong><code>loan_currency</code></strong></td><td>Currency borrowed</td></tr><tr><td><strong><code>current_loan_qty</code></strong></td><td>The amount currently awaiting settlement including interest if applicable</td></tr><tr><td><strong><code>collateral_currency</code></strong></td><td>Order proceeds currency</td></tr><tr><td><strong><code>pair</code></strong></td><td>Currency pair traded to open the position</td></tr><tr><td><strong><code>interest_rate</code></strong></td><td>The annualized interest rate of the borrowed currency</td></tr><tr><td><strong><code>interest_qty</code></strong></td><td>The amount of interest that has been charged to this position in terms of the currency borrowed</td></tr><tr><td><strong><code>margin_type</code></strong></td><td>Long or short</td></tr><tr><td><strong><code>order_id</code></strong></td><td>The ID of the order that opened the position</td></tr><tr><td><strong><code>proceeds</code></strong></td><td>Proceeds of the collateral currency as a result of this position</td></tr><tr><td><strong><code>vwap</code></strong></td><td>Open Price. The fill price of the order that opened the position</td></tr></tbody></table>

### Responses

<details>

<summary><mark style="color:green;">200</mark></summary>

```json
{
    "data": [
        {
            "id": 3835,
            "status": "CLOSED",
            "date_added": "2022-06-30T01:01:55.000Z",
            "date_loan_closed": "2022-06-30T01:02:47.000Z",
            "loan_currency": "btc",
            "collateral_currency": "usd",
            "pair": "btcusd",
            "original_collateral_qty": 2101.94565,
            "current_collateral_qty": 0,
            "original_loan_qty": 0.1,
            "current_loan_qty": 0,
            "interest_qty": 0,
            "interest_rate": 0.1,
            "margin_type": "MARGIN_SHORT",
            "order_id": 1127584,
            "proceeds": 0
        },
        {
            "id": 3836,
            "status": "CLOSED",
            "date_added": "2022-06-30T02:46:57.000Z",
            "date_loan_closed": "2022-07-01T02:41:01.000Z",
            "loan_currency": "btc",
            "collateral_currency": "usd",
            "pair": "btcusd",
            "original_collateral_qty": 2107.60095,
            "current_collateral_qty": 0,
            "original_loan_qty": 0.1,
            "current_loan_qty": 0,
            "interest_qty": 0,
            "interest_rate": 0.1,
            "margin_type": "MARGIN_SHORT",
            "order_id": 1127591,
            "proceeds": 0
        }
    ]
}
```

</details>

### Example Requests

{% tabs %}
{% tab title="Shell" %}

```bash
curl -H 'Authorization: Bearer <API_TOKEN>' \
https://api.sfox.com/v1/margin/loans
```

{% endtab %}

{% tab title="NodeJS" %}

```javascript
const axios = require('axios');

axios({
  method: 'get',
  url: 'https://api.sfox.com/v1/margin/loans',
  headers: {
    'Authorization': 'Bearer <API_KEY>'
  }
}).then(response => {
  console.log(response)
}).catch(err => {
  console.error(err)
});
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

data = requests.get(
  "https://api.sfox.com/v1/margin/loans",
  headers={
    "Authorization": "Bearer <API_KEY>",
  }
)
print(data)
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sfox.com/rest-api/shorting/get-all-positions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
