# This wallet in SigmaFi

`GET /sigmafi/portfolio` · Lithos client API · SigmaFi Bonds · requires the `api_key` header

Source: https://lithosprotocol.org/docs/api/get-sf-portfolio

This wallet's open orders, the bonds it borrows on, and the bond assets it holds with what the vault holds for each.

## Responses

### 200: The portfolio

`SFPortfolio`

- `height` (integer, required)
- `orders` (SFOrderView[], required)
  - `boxId` (string, required)
  - `terms` (SFTerms, required): A bond's terms, as its order states them and the bond carries them.
    - `kind` (string, required): The bond's kind. Every SigmaFi V2 bond is `zero-coupon`.
    - `principalNanoErgs` (string): Agreed nanoERG lent; for a token loan, the principal box's floor. Read directly from a bond's R6.
    - `principalToken` (SFTokenAmount)
      - `tokenId` (string, required)
      - `amount` (string, required): Base units.
    - `repayment` (string, required): What the borrower repays, in nanoERG or in base units of `repayToken`.
    - `repayToken` (string): The token a token loan is repaid in. Absent when repaid in ERG.
    - `collateralNanoErgs` (string, required): Borrower collateral nanoERG, excluding the lender-funded reserve.
    - `collateralTokens` (SFTokenAmount[], required)
    - `maturityHeight` (integer · int64): Repayment is open strictly below it. Absent for an on-close order until it is filled.
    - `durationBlocks` (integer · int64): An on-close order's term, counted from its fill.
    - `batchingFee` (string, required): Lender-funded reserve selected on fill; zero on unfilled orders. Refunded on repayment.
    - `liquidation` (string): The liquidation script's name. Absent when this client does not know it.
    - `liquidationHash` (string, required)
  - `borrower` (string): The address the principal goes to, when this client can tell.
  - `mine` (boolean, required)
  - `refusal` (string): Why this client would not fill it. Absent when it would.
  - `creationHeight` (integer, required)
- `borrowing` (SFBondView[], required): Bonds whose collateral returns to this wallet on repayment.
  - `boxId` (string, required)
  - `assetId` (string, required): The bond asset whose holder is paid.
  - `terms` (SFTerms, required): A bond's terms, as its order states them and the bond carries them.
  - `verified` (boolean, required): Whether this is the bond its asset's genesis order created.
  - `verification` (string): Why it is not verified.
  - `status` (string, required, one of open, matured)
  - `blocksLeft` (integer · int64, required): Blocks before repayment closes. 0 once matured.
  - `borrowerIsMe` (boolean, required)
  - `creationHeight` (integer, required)
- `lending` (SFHolding[], required): Bond assets this wallet holds.
  - `assetId` (string, required)
  - `bond` (SFBondView)
  - `vault` (SFVaultView[], required)
    - `boxId` (string, required)
    - `bondId` (string): The bond this box settles.
    - `assetId` (string, required)
    - `nanoErgs` (string, required)
    - `tokens` (SFTokenAmount[], required)
  - `claimable` (boolean, required): Whether a claim goes through now. The bond's own settlement output is known and unspent.
- `truncated` (boolean, required)

### 403: Missing or wrong api_key.

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

### 503: Node or index unavailable. Never returns a partial answer.

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

## Example request

```bash
curl -X GET "http://localhost:9000/sigmafi/portfolio" \
  -H "api_key: $LITHOS_API_KEY"
```

## Example response

```json
{
  "height": 0,
  "orders": [
    {
      "boxId": "string",
      "terms": {
        "kind": "string",
        "principalNanoErgs": "string",
        "principalToken": {
          "tokenId": "string",
          "amount": "string"
        },
        "repayment": "string",
        "repayToken": "string",
        "collateralNanoErgs": "string",
        "collateralTokens": [
          {
            "tokenId": "string",
            "amount": "string"
          }
        ],
        "maturityHeight": 0,
        "durationBlocks": 0,
        "batchingFee": "string",
        "liquidation": "string",
        "liquidationHash": "string"
      },
      "borrower": "string",
      "mine": true,
      "refusal": "string",
      "creationHeight": 0
    }
  ],
  "borrowing": [
    {
      "boxId": "string",
      "assetId": "string",
      "terms": {
        "kind": "string",
        "principalNanoErgs": "string",
        "principalToken": {
          "tokenId": "string",
          "amount": "string"
        },
        "repayment": "string",
        "repayToken": "string",
        "collateralNanoErgs": "string",
        "collateralTokens": [
          {
            "tokenId": "string",
            "amount": "string"
          }
        ],
        "maturityHeight": 0,
        "durationBlocks": 0,
        "batchingFee": "string",
        "liquidation": "string",
        "liquidationHash": "string"
      },
      "verified": true,
      "verification": "string",
      "status": "open",
      "blocksLeft": 0,
      "borrowerIsMe": true,
      "creationHeight": 0
    }
  ],
  "lending": [
    {
      "assetId": "string",
      "bond": {
        "boxId": "string",
        "assetId": "string",
        "terms": {
          "kind": "string",
          "principalNanoErgs": "string",
          "principalToken": {
            "tokenId": "string",
            "amount": "string"
          },
          "repayment": "string",
          "repayToken": "string",
          "collateralNanoErgs": "string",
          "collateralTokens": [
            {
              "tokenId": "string",
              "amount": "string"
            }
          ],
          "maturityHeight": 0,
          "durationBlocks": 0,
          "batchingFee": "string",
          "liquidation": "string",
          "liquidationHash": "string"
        },
        "verified": true,
        "verification": "string",
        "status": "open",
        "blocksLeft": 0,
        "borrowerIsMe": true,
        "creationHeight": 0
      },
      "vault": [
        {
          "boxId": "string",
          "bondId": "string",
          "assetId": "string",
          "nanoErgs": "string",
          "tokens": [
            {
              "tokenId": "string",
              "amount": "string"
            }
          ]
        }
      ],
      "claimable": true
    }
  ],
  "truncated": true
}
```
