# Muon API

## Introduction

The Muon API is a decentralized, off-chain oracle service that provides cryptographic signatures used by both solvers and 3rd party frontend applications for price validations, solvency checks, and liquidation dispute resolutions. Muon signatures are appended to contract calls like `sendQuote()` and `openPosition()`, then verified on-chain before execution, ensuring that only validated data triggers on-chain actions.

The signatures returned by the Muon API confirm that the quoted price has been validated by the Muon network and that both counterparties meet the platform’s solvency requirements. These endpoints return structured JSON payloads.

## Overview of the Muon API

The Muon API provides a suite of off‑chain services for critical trading operations. Its main capabilities include:

* **Price Validation for a Symbol:** Retrieve signed price data for any supported asset symbol, ensuring the price is authenticated by the Muon network.
* **Unrealized Profit and Loss (uPnL) Calculation:** Compute uPnL for individual parties (`partyA`or `partyB`) or for combined positions.
* **Verification for Settling Prices:** Used to settle unrealized PnL, resolve price disputes, and trigger liquidation or settlement functions securely.

## API Query Endpoints

The Muon app can be queried using these URLs on all supported chains, if one is unresponsive please try another.

* [http**s://muon-oracle1.rasa.capital/v1/**](https://muon-oracle1.rasa.capital/v1/)
* [**https://muon-oracle2.rasa.capital/v1/**](https://muon-oracle2.rasa.capital/v1/)
* [**https://muon-oracle3.rasa.capital/v1/**](https://muon-oracle3.rasa.capital/v1/)
* [**https://muon-oracle4.rasa.capital/v1/**](https://muon-oracle4.rasa.capital/v1/)

Polygon Chain URL:

* [**https://polygon-testnet-oracle.rasa.capital/v1/**](https://polygon-testnet-oracle.rasa.capital/v1/)**:**&#x20;

### \[GET] uPnl\_A

This endpoint calculates and returns the unrealized profit and loss (uPnL) for **partyA**. The signature returned by this endpoint is used in the [`deallocate()`](https://docs.symm.io/contract-documentation/symmio-perps-v0.8.4/facets/account-facet-0.8.4#deallocate) function for partyA to ensure that they meet solvency requirements before funds are released.

**Contract Struct:**

```solidity
struct SingleUpnlSig {
	bytes reqId;
	uint256 timestamp;
	int256 upnl;
	bytes gatewaySignature;
	IMuonSignatureVerifier.SchnorrSign sigs;
}
```

**Request URL Example:**

```
https://muon-oracle4.rasa.capital/v1/?app=symmio&method=uPnl_A&params[partyA]=0x33D689034225A67454980c9D91E35C03a4765B30&params[chainId]=42161&params[symmio]=0x8F06459f184553e5d04F07F868720BDaCAB39395
```

**Parameters:**

* `partyA` (address): The address of partyA.
* `chainId` (uint): The chain id.
* `symmio` (address): The address of the Symmio diamond contract.

**Returns**:

* `chainId` (string): The chain identifier.
* `partyA` (address): The address of partyA.
* `symmio` (address): Address of the Symmio diamond contract.
* `uPnl` (string): The verified unrealized PnL value for partyA.
* `notionalValueSum` (string): Sum of notional values for all positions.
* `nonce` (string): Unique nonce or address used for replay protection (`init.nonceAddress`).
* `timestamp` (uint): The block timestamp at which the data was generated.
* `symbolIds` (string\[]): List of symbol IDs involved in the calculation.
* `symbols` (string\[]): Corresponding asset symbols.
* `symbolIdsPrices` (string\[]): Price values indexed by `symbolIds`.
* `quoteIds` (string\[]): IDs of the quotes used.
* `signature` (bytes): Muon-generated signature (`signatures[0].signature`).
* `owner` (address): Address of the signer (`signatures[0].owner`).
* `nodeSignature` (bytes): Gateway signature appended on contracts (`signatures[0].nodeSignature`).

**Output Schema:**

```json
{
    "success": true,
    "result": {
        "reqId": "0xaac5f0d67661b82592e1cc348821627e4113072cf0d809ddaea569b1bd93db8b",
        "app": "symmio",
        "appId": "67095677696457568621176602095256212877581942797155816526660337292193161013107",
        "method": "uPnl_A",
        "data": {
            "params": {
                "partyA": "0x33D689034225A67454980c9D91E35C03a4765B30",
                "chainId": "42161",
                "symmio": "0x8F06459f184553e5d04F07F868720BDaCAB39395"
            },
            "timestamp": 1745187906,
            "uid": "1ipaks9dcduq98o",
            "result": {
                "chainId": "42161",
                "partyA": "0x33D689034225A67454980c9D91E35C03a4765B30",
                "symmio": "0x8F06459f184553e5d04F07F868720BDaCAB39395",
                "liquidationId": "0x24e881fb2e2a3c86de559c9b181c2687240abb56d36d768c14ce12f1147c4b75",
                "latestBlockNumber": "328484529",
                "uPnl": "434926000148088858",
                "loss": "0",
                "notionalValueSum": "12127366419851911141",
                "nonce": "45",
                "pricesMap": {
                    "AUCTIONUSDT_BYBIT": "11087000000000000000",
                    "SIRENUSDT_BYBIT": "60880000000000000",
                    "UNIUSDT_BYBIT": "5209000000000000000",
                    "HPOS10IUSDT_BYBIT": "46950000000000000",
                    "BTCUSDT-26DEC25_BYBIT": "88773910000000000000000",
                    "ETHUSDT-27MAR26_BYBIT": "1661560000000000000000",
                    //...
                },
                "symbolIds": [
                    "340"
                ],
                "symbols": [
                    "XRPUSDT"
                ],
                "symbolIdsPrices": [
                    "2059392200000000000"
                ],
                "prices": [
                    "2059392200000000000"
                ],
                "quoteIds": [
                    "31742"
                ],
                "markPrices": {
                    "binance": {
                        "AUCTIONUSDT_BYBIT": "11087000000000000000",
                        "SIRENUSDT_BYBIT": "60880000000000000"
                      //...
                        }
                },
                "maxLeverages": {},
                "partyBs": [
                    "0x00c069d68bc7420740460DBC3cc3fFF9b3742421"
                ]
            },
            "signParams": [
                {
                    "name": "appId",
                    "type": "uint256",
                    "value": "67095677696457568621176602095256212877581942797155816526660337292193161013107"
                },
                {
                    "name": "reqId",
                    "type": "bytes",
                    "value": "0xaac5f0d67661b82592e1cc348821627e4113072cf0d809ddaea569b1bd93db8b"
                },
                {
                    "type": "address",
                    "value": "0x8F06459f184553e5d04F07F868720BDaCAB39395"
                },
                {
                    "type": "address",
                    "value": "0x33D689034225A67454980c9D91E35C03a4765B30"
                },
                {
                    "type": "uint256",
                    "value": "45"
                },
                {
                    "type": "int256",
                    "value": "434926000148088858"
                },
                {
                    "type": "uint256",
                    "value": 1745187906
                },
                {
                    "type": "uint256",
                    "value": "42161"
                }
            ],
            "resultHash": "0xd4c85326971cb16d5b454719b2524146c823140b69e09f4513d319c948cfea30",
            "init": {
                "nonceAddress": "0x7Ef0951eC563cA029F433B0Ef94696BB1444ACce"
            }
        },
        "signatures": [
            {
                "owner": "0x8a59b05281ac699321D93974A228E7EC0A2c9357",
                "ownerPubKey": {
                    "x": "0x3fb5a506c907e2f6984e4f7207fc445d3c847474d056adfd4718f17548b72136",
                    "yParity": "0"
                },
                "signature": "0xa0d78b6eef8101e2f655101c6e005f8193d699fc842e308c0555979f44206ac6"
            }
        ],
        "gwAddress": "0xF621f85f20BBe733699306D336230184621dBe60",
        "shieldAddress": "0xF621f85f20BBe733699306D336230184621dBe60",
        "shieldSignature": "0xb52cd057e31e2bd96a39f2bf03fc65b6d56ed4862edb9c9989ba131ce03d8adc71340ad397f9cd3cd0e96a0015cf2ac245a11e1ba138c2cbaefdd09f7e5c4a121c",
        "nodeSignature": "0xb52cd057e31e2bd96a39f2bf03fc65b6d56ed4862edb9c9989ba131ce03d8adc71340ad397f9cd3cd0e96a0015cf2ac245a11e1ba138c2cbaefdd09f7e5c4a121c",
        "confirmed": true
    }
}
```

### \[GET] partyA\_overview

The signature returned by this endpoint produces a **`LiquidationSig`** that is used in the standard liquidation flow via [`liquidatePartyA()`](https://docs.symm.io/contract-documentation/symmio-perps-v0.8.4/facets/liquidations-facet-0.8.4) and [`setSymbolsPrice()`](https://docs.symm.io/contract-documentation/symmio-perps-v0.8.4/facets/liquidations-facet-0.8.4).

**Contract Struct:**

```solidity
struct LiquidationSig {
    bytes reqId;                    // Unique Muon request identifier
    uint256 timestamp;              // Timestamp when the signature was created
    bytes liquidationId;            // Unique identifier for the liquidation event
    int256 upnl;                    // response field: uPnl
    int256 totalUnrealizedLoss;     // response field: loss
    uint256[] symbolIds;            // response field: symbolIds
    uint256[] prices;               // response field: symbolIdsPrices
    bytes gatewaySignature;         // response field: nodeSignature
    SchnorrSign sigs;
}
```

{% hint style="info" %}
**Important:** This method produces signatures verified by `LibMuon.verifyLiquidationSig()`. It does **not** produce signatures for the deferred liquidation flow ([`DeferredLiquidationSig`](https://docs.symm.io/contract-documentation/version-history/contracts-documentation-0.8.3/muonstorage#deferred-liquidation)), which requires a separate Muon Endpoint not yet available.
{% endhint %}

**Request URL Example:**

```
https://muon-oracle4.rasa.capital/v1/?app=symmio&method=partyA_overview&params[partyA]=0x33D689034225A67454980c9D91E35C03a4765B30&params[chainId]=42161&params[symmio]=0x8F06459f184553e5d04F07F868720BDaCAB39395
```

**Parameters:**

* `partyA` (address): The address of partyA.
* `chainId` (uint): The chain id.
* `symmio` (address): The address of the Symmio diamond contract.

**Returns** :

* `chainId`, `partyA`, `symmio`, `uPnl`, `notionalValueSum`, `nonce`, `timestamp`, `symbolIds`, `symbols`, `symbolIdsPrices`, `quoteIds` (same as **uPnl\_A**).
* `signature` (bytes): Muon-generated signature for liquidation (`signatures[0].signature`).
* `owner` (address): Address of the signer (`signatures[0].owner`).
* `nodeSignature` (bytes): Gateway signature appended on contracts.

**Response → Struct field mapping:**

| API Response Field       | Struct Field          |
| ------------------------ | --------------------- |
| `result.liquidationId`   | `liquidationId`       |
| `result.uPnl`            | `upnl`                |
| `result.loss`            | `totalUnrealizedLoss` |
| `result.symbolIds`       | `symbolIds`           |
| `result.symbolIdsPrices` | `prices`              |

**Example API Query**

```bash
https://muon-oracle4.rasa.capital/v1/?app=symmio&method=partyA_overview&params[partyA]=0x33D689034225A67454980c9D91E35C03a4765B30&params[chainId]=42161&params[symmio]=0x8F06459f184553e5d04F07F868720BDaCAB39395
```

**Example Response**

```json
{
    "success": true,
    "result": {
        "reqId": "0x1444f044ea93ebd50ff0498df313adb550aa4e7089b32c41158061f58d8ef4ce",
        "app": "symmio",
        "appId": "67095677696457568621176602095256212877581942797155816526660337292193161013107",
        "method": "partyA_overview",
        "data": {
            "params": {
                "partyA": "0x33D689034225A67454980c9D91E35C03a4765B30",
                "chainId": "42161",
                "symmio": "0x8F06459f184553e5d04F07F868720BDaCAB39395"
            },
            "timestamp": 1745189827,
            "uid": "1ipammt0j6fqdc7",
            "result": {
                "chainId": "42161",
                "partyA": "0x33D689034225A67454980c9D91E35C03a4765B30",
                "symmio": "0x8F06459f184553e5d04F07F868720BDaCAB39395",
                "liquidationId": "0x9ab63fa5515201ab6f7b054e5486e827be192414cf80ab8d6fd313931c46c0c4",
                "latestBlockNumber": "328492046",
                "uPnl": "488043580148088858",
                "loss": "0",
                "notionalValueSum": "12127366419851911141",
                "nonce": "45",
                "pricesMap": {
                    "AUCTIONUSDT_BYBIT": "11166000000000000000",
                    "SIRENUSDT_BYBIT": "61720000000000000",
                    "UNIUSDT_BYBIT": "5223000000000000000",
                    "HPOS10IUSDT_BYBIT": "46930000000000000",
                    //...
                },
                "symbolIds": [
                    "340"
                ],
                "symbols": [
                    "XRPUSDT"
                ],
                "symbolIdsPrices": [
                    "2068100000000000000"
                ],
                "prices": [
                    "2068100000000000000"
                ],
                "quoteIds": [
                    "31742"
                ],
                "markPrices": {
                    "binance": {
                        "AUCTIONUSDT_BYBIT": "11166000000000000000",
                        "SIRENUSDT_BYBIT": "61720000000000000",
                        "UNIUSDT_BYBIT": "5223000000000000000",
                        "HPOS10IUSDT_BYBIT": "46930000000000000",
                        "BTCUSDT-26DEC25_BYBIT": "88929110000000000000000",
                        //...
                    }
                },
                "maxLeverages": {},
                "partyBs": [
                    "0x00c069d68bc7420740460DBC3cc3fFF9b3742421"
                ]
            },
            "signParams": [
                {
                    "name": "appId",
                    "type": "uint256",
                    "value": "67095677696457568621176602095256212877581942797155816526660337292193161013107"
                },
                {
                    "name": "reqId",
                    "type": "bytes",
                    "value": "0x1444f044ea93ebd50ff0498df313adb550aa4e7089b32c41158061f58d8ef4ce"
                },
                {
                    "type": "bytes",
                    "value": "0x9ab63fa5515201ab6f7b054e5486e827be192414cf80ab8d6fd313931c46c0c4"
                },
                {
                    "type": "address",
                    "value": "0x8F06459f184553e5d04F07F868720BDaCAB39395"
                },
                {
                    "type": "string",
                    "value": "verifyLiquidationSig"
                },
                {
                    "type": "address",
                    "value": "0x33D689034225A67454980c9D91E35C03a4765B30"
                },
                {
                    "type": "uint256",
                    "value": "45"
                },
                {
                    "type": "int256",
                    "value": "488043580148088858"
                },
                {
                    "type": "int256",
                    "value": "0"
                },
                {
                    "type": "uint256[]",
                    "value": [
                        "340"
                    ]
                },
                {
                    "type": "uint256[]",
                    "value": [
                        "2068100000000000000"
                    ]
                },
                {
                    "type": "uint256",
                    "value": 1745189827
                },
                {
                    "type": "uint256",
                    "value": "42161"
                }
            ],
            "resultHash": "0xcd6d018dcc61448c2edd19d819ca6c1b215a77ddc9af261a038d05cdcf3ca294",
            "init": {
                "nonceAddress": "0x587C97dA79E26dd1ee902f5846e8e8b37cc67e67"
            }
        },
        "signatures": [
            {
                "owner": "0x8a59b05281ac699321D93974A228E7EC0A2c9357",
                "ownerPubKey": {
                    "x": "0x3fb5a506c907e2f6984e4f7207fc445d3c847474d056adfd4718f17548b72136",
                    "yParity": "0"
                },
                "signature": "0x0c5204c1d436dae334968359f94fb5e93b12ab13d8816fb8d86e556e639a0458"
            }
        ],
        "gwAddress": "0xF621f85f20BBe733699306D336230184621dBe60",
        "shieldAddress": "0xF621f85f20BBe733699306D336230184621dBe60",
        "shieldSignature": "0x5aac29fc1f7987fdd275c4e6ae9f7a38b60f6dd051beaa8543849bc0ce05009472479171aaef906936c012266f3d27210a6eb34927f9110e0a3b65deaab6912e1c",
        "nodeSignature": "0x5aac29fc1f7987fdd275c4e6ae9f7a38b60f6dd051beaa8543849bc0ce05009472479171aaef906936c012266f3d27210a6eb34927f9110e0a3b65deaab6912e1c",
        "confirmed": true
    }
}
```

### \[GET] uPnl\_A\_withSymbolPrice

This endpoint calculates unrealized profit and loss (uPnL) for **partyA** and fetches the price for a specified symbol in one request. It’s used in the [`sendQuoteWithAffiliate()`](https://docs.symm.io/contract-documentation/symmio-perps-v0.8.4/facets/partya-facet-0.8.4#sendquotewithaffiliate) flow when Party A initiates a quote to Party B. See how the signature is formatted for this [here](https://docs.symm.io/exchange-builder-documentation/frontend-builder-technical-guidance/sending-a-quote#upnlsig).

**Contract Struct:**

```solidity
struct SingleUpnlAndPriceSig {
	bytes reqId;
	uint256 timestamp;
	int256 upnl;
	uint256 price;
	bytes gatewaySignature;
	IMuonSignatureVerifier.SchnorrSign sigs;
}
```

**Request URL Example:**

```
https://muon-oracle4.rasa.capital/v1/?app=symmio&method=uPnl_A_withSymbolPrice&params[partyA]=0x33D689034225A67454980c9D91E35C03a4765B30&params[chainId]=42161&params[symbolId]=4&params[symmio]=0x8F06459f184553e5d04F07F868720BDaCAB39395
```

**Parameters:**

* `partyA` (address): The address of partyA.
* `chainId` (uint): The chain id.
* `symbolId` (uint): The ID of the asset symbol to fetch the price for.
* `symmio` (address): The address of the Symmio diamond contract.

**Returns**:

* `chainId` (string): The chain identifier.
* `partyA` (address): The address of partyA.
* `symbolId` (string): The requested symbol ID.
* `price` (string): The signed price value for the requested symbol.
* `uPnl` (string): The verified unrealized PnL value for partyA.
* `notionalValueSum` (string): Sum of notional values for all positions.
* `nonce` (string): Unique nonce or address used for replay protection.
* `timestamp` (uint): The block timestamp at which the data was generated.
* `symbolIds` (string\[]): List of all symbol IDs involved in the position.
* `symbols` (string\[]): Corresponding asset symbols.
* `symbolIdsPrices` (string\[]): Price values indexed by `symbolIds`.
* `quoteIds` (string\[]): IDs of the quotes used.
* `signature` (bytes): Muon-generated signature (`signatures[0].signature`).
* `owner` (address): Address of the signer (`signatures[0].owner`).
* `nodeSignature` (bytes): Gateway signature appended on contracts, verified on-chain before execution.

#### Example Response:

```json
{
    "success": true,
    "result": {
        "reqId": "0xf18addb4dcb95a789848f74566950e7bfdab0f33382a5d635af3604294b534f1",
        "app": "symmio",
        "appId": "67095677696457568621176602095256212877581942797155816526660337292193161013107",
        "method": "uPnl_A_withSymbolPrice",
        "data": {
            "params": {
                "partyA": "0x33D689034225A67454980c9D91E35C03a4765B30",
                "chainId": "42161",
                "symbolId": "4",
                "symmio": "0x8F06459f184553e5d04F07F868720BDaCAB39395"
            },
            "timestamp": 1745192081,
            "uid": "1ipaormab65g838",
            "result": {
                "chainId": "42161",
                "partyA": "0x33D689034225A67454980c9D91E35C03a4765B30",
                "symbolId": "4",
                "price": "2069300000000000000",
                "symmio": "0x8F06459f184553e5d04F07F868720BDaCAB39395",
                "latestBlockNumber": "328500917",
                "uPnl": "495363580148088858",
                "loss": "0",
                "notionalValueSum": "12127366419851911141",
                "nonce": "45",
                "pricesMap": {
                    "AUCTIONUSDT_BYBIT": "11229000000000000000",
                    "SIRENUSDT_BYBIT": "60980000000000000",
                    "UNIUSDT_BYBIT": "5233000000000000000",
                    "HPOS10IUSDT_BYBIT": "47020000000000000",
                    "BTCUSDT-26DEC25_BYBIT": "89132620000000000000000",
                                            //...
                },
                "symbolIds": [
                    "340"
                ],
                "symbols": [
                    "XRPUSDT"
                ],
                "symbolIdsPrices": [
                    "2069300000000000000"
                ],
                "prices": [
                    "2069300000000000000"
                ],
                "quoteIds": [
                    "31742"
                ],
                "markPrices": {
                    "binance": {
                        "AUCTIONUSDT_BYBIT": "11229000000000000000",
                        "SIRENUSDT_BYBIT": "60980000000000000",
                        "UNIUSDT_BYBIT": "5233000000000000000",
                        "HPOS10IUSDT_BYBIT": "47020000000000000",
                                           //...
                    }
                },
                "maxLeverages": {},
                "partyBs": [
                    "0x00c069d68bc7420740460DBC3cc3fFF9b3742421"
                ]
            },
            "signParams": [
                {
                    "name": "appId",
                    "type": "uint256",
                    "value": "67095677696457568621176602095256212877581942797155816526660337292193161013107"
                },
                {
                    "name": "reqId",
                    "type": "bytes",
                    "value": "0xf18addb4dcb95a789848f74566950e7bfdab0f33382a5d635af3604294b534f1"
                },
                {
                    "type": "address",
                    "value": "0x8F06459f184553e5d04F07F868720BDaCAB39395"
                },
                {
                    "type": "address",
                    "value": "0x33D689034225A67454980c9D91E35C03a4765B30"
                },
                {
                    "type": "uint256",
                    "value": "45"
                },
                {
                    "type": "int256",
                    "value": "495363580148088858"
                },
                {
                    "type": "uint256",
                    "value": "4"
                },
                {
                    "type": "uint256",
                    "value": "2069300000000000000"
                },
                {
                    "type": "uint256",
                    "value": 1745192081
                },
                {
                    "type": "uint256",
                    "value": "42161"
                }
            ],
            "resultHash": "0xa9ef52e352135f76e45de5ba98707620eed0aa5558e371d9f11db4ec2eff0f6b",
            "init": {
                "nonceAddress": "0x185d3c71a3383Bb213D175539680087525c2bf75"
            }
        },
        "signatures": [
            {
                "owner": "0x8a59b05281ac699321D93974A228E7EC0A2c9357",
                "ownerPubKey": {
                    "x": "0x3fb5a506c907e2f6984e4f7207fc445d3c847474d056adfd4718f17548b72136",
                    "yParity": "0"
                },
                "signature": "0x6e2c26bd5fe0c183288848a15af25cb5490a1522f449adbd99e4cf1b2f266c41"
            }
        ],
        "gwAddress": "0xF621f85f20BBe733699306D336230184621dBe60",
        "shieldAddress": "0xF621f85f20BBe733699306D336230184621dBe60",
        "shieldSignature": "0x9578961837f44c85076d49d8def17350d532a7601e37a0e1fb36aad3ec57ddf82d2be44c584d68f9b13c461f2b06a4d97e4ee365d18b4a8bbb3275754940a9231c",
        "nodeSignature": "0x9578961837f44c85076d49d8def17350d532a7601e37a0e1fb36aad3ec57ddf82d2be44c584d68f9b13c461f2b06a4d97e4ee365d18b4a8bbb3275754940a9231c",
        "confirmed": true
    }
}
```

### \[GET] uPnl\_B

This endpoint calculates and returns the unrealized profit and loss (uPnL) for **partyB**, used in the [`lockQuote()`](https://docs.symm.io/contract-documentation/version-history/contracts-documentation-0.8.2/facets/partyb-facet#lockquote) flow to verify Party B’s solvency before locking their position. See how this is integrated [here](https://docs.symm.io/liquidity-provider-documentation/building-a-solver-on-symmio/4.-opening-closing-a-position-on-chain).

**Contract Struct:**

```solidity
	struct SingleUpnlSig {
		bytes reqId;
		uint256 timestamp;
		int256 upnl;
		bytes gatewaySignature;
		SchnorrSign sigs;
	}
```

**Parameters:**

* `partyB` (address): The Ethereum address of partyB.
* `partyA` (address): The Ethereum address of partyA (counterparty).
* `chainId` (uint): The chain id.
* `symmio` (address): The address of the Symmio diamond contract.

**Returns**:

* `chainId` (string): The chain identifier.
* `partyB` (address): The address of partyB.
* `partyA` (address): The address of partyA.
* `symmio` (address): Address of the Symmio diamond contract.
* `uPnl` (string): The verified unrealized PnL value for partyB.
* `notionalValueSum` (string): Sum of notional values for all positions.
* `nonce` (string): Unique nonce or address used for replay protection.
* `timestamp` (uint): The block timestamp at which the data was generated.
* `prices` (string\[]): Array of price values corresponding to active symbols.
* `quoteIds` (string\[]): IDs of the quotes used.
* `signature` (bytes): Muon-generated signature (`signatures[0].signature`).
* `owner` (address): Address of the signer (`signatures[0].owner`).
* `nodeSignature` (bytes): Gateway signature appended on contracts, verified on-chain before execution.

**Example API Query**

```bash
https://muon-oracle4.rasa.capital/v1/?app=symmio&method=uPnl_B&params[partyB]=0x00c069d68bc7420740460DBC3cc3fFF9b3742421&params[partyA]=0x33D689034225A67454980c9D91E35C03a4765B30&params[chainId]=42161&params[symmio]=0x8F06459f184553e5d04F07F868720BDaCAB39395
```

#### Example Response:

```json
{
    "success": true,
    "result": {
        "reqId": "0x0e03c1c879ca6c85b159bd34a46145ffc99a0c19b9782ccd7e88d13365114ebf",
        "app": "symmio",
        "appId": "67095677696457568621176602095256212877581942797155816526660337292193161013107",
        "method": "uPnl_B",
        "data": {
            "params": {
                "partyB": "0x00c069d68bc7420740460DBC3cc3fFF9b3742421",
                "partyA": "0x33D689034225A67454980c9D91E35C03a4765B30",
                "chainId": "42161",
                "symmio": "0x8F06459f184553e5d04F07F868720BDaCAB39395"
            },
            "timestamp": 1745192711,
            "uid": "1ipapesuim2pusg",
            "result": {
                "chainId": "42161",
                "partyB": "0x00c069d68bc7420740460DBC3cc3fFF9b3742421",
                "partyA": "0x33D689034225A67454980c9D91E35C03a4765B30",
                "symmio": "0x8F06459f184553e5d04F07F868720BDaCAB39395",
                "latestBlockNumber": "328503367",
                "uPnl": "-527693580148088858",
                "notionalValueSum": "12127366419851911141",
                "nonce": "45",
                "pricesMap": {
                    "AUCTIONUSDT_BYBIT": "11259000000000000000",
                    "SIRENUSDT_BYBIT": "60990000000000000",
                    "UNIUSDT_BYBIT": "5238000000000000000",
                    "HPOS10IUSDT_BYBIT": "47140000000000000",
                    "BTCUSDT-26DEC25_BYBIT": "89252190000000000000000",
                    "ETHUSDT-27MAR26_BYBIT": "1671870000000000000000",
                    //...
                },
                "prices": [
                    "2074600000000000000"
                ],
                "quoteIds": [
                    "31742"
                ],
                "markPrices": {
                    "binance": {
                        "AUCTIONUSDT_BYBIT": "11259000000000000000",
                        "SIRENUSDT_BYBIT": "60990000000000000",
                        "UNIUSDT_BYBIT": "5238000000000000000",
                        "HPOS10IUSDT_BYBIT": "47140000000000000",
                        "BTCUSDT-26DEC25_BYBIT": "89252190000000000000000",
                        "ETHUSDT-27MAR26_BYBIT": "1671870000000000000000",
                        //...
                    }
                }
            },
            "signParams": [
                {
                    "name": "appId",
                    "type": "uint256",
                    "value": "67095677696457568621176602095256212877581942797155816526660337292193161013107"
                },
                {
                    "name": "reqId",
                    "type": "bytes",
                    "value": "0x0e03c1c879ca6c85b159bd34a46145ffc99a0c19b9782ccd7e88d13365114ebf"
                },
                {
                    "type": "address",
                    "value": "0x8F06459f184553e5d04F07F868720BDaCAB39395"
                },
                {
                    "type": "address",
                    "value": "0x00c069d68bc7420740460DBC3cc3fFF9b3742421"
                },
                {
                    "type": "address",
                    "value": "0x33D689034225A67454980c9D91E35C03a4765B30"
                },
                {
                    "type": "uint256",
                    "value": "45"
                },
                {
                    "type": "int256",
                    "value": "-527693580148088858"
                },
                {
                    "type": "uint256",
                    "value": 1745192711
                },
                {
                    "type": "uint256",
                    "value": "42161"
                }
            ],
            "resultHash": "0x9aaf1dd77f5164d40955c0b6c8bf52cf8eaaf7135af7a6216933d158eaa36c10",
            "init": {
                "nonceAddress": "0x270A26B37d77DcFce322F8105fCD1720816ef156"
            }
        },
        "signatures": [
            {
                "owner": "0x8a59b05281ac699321D93974A228E7EC0A2c9357",
                "ownerPubKey": {
                    "x": "0x3fb5a506c907e2f6984e4f7207fc445d3c847474d056adfd4718f17548b72136",
                    "yParity": "0"
                },
                "signature": "0x2f8057fef7af7d7c478c8cef9f5edd09e67700fd61b44125c3a92d018a5356a1"
            }
        ],
        "gwAddress": "0xF621f85f20BBe733699306D336230184621dBe60",
        "shieldAddress": "0xF621f85f20BBe733699306D336230184621dBe60",
        "shieldSignature": "0xdea7f1d31591519792d6137903d2bc5f7df8a8966f09bb5cb1ff55accfabb1b04e0d7d9f16909efd58be54da9aca0426c1c94af9924e292d4a585296d58433761b",
        "nodeSignature": "0xdea7f1d31591519792d6137903d2bc5f7df8a8966f09bb5cb1ff55accfabb1b04e0d7d9f16909efd58be54da9aca0426c1c94af9924e292d4a585296d58433761b",
        "confirmed": true
    }
}
```

### \[GET] uPnl

This endpoint calculates and returns combined unrealized profit and loss (uPnL) data for both parties in a trade, along with individual breakdowns.&#x20;

**Contract Struct:**

```solidity
struct PairUpnlSig {
	bytes reqId;
	uint256 timestamp;
	int256 upnlPartyA;
	int256 upnlPartyB;
	bytes gatewaySignature;
	IMuonSignatureVerifier.SchnorrSign sigs;
}
```

**Parameters:**

* `partyB` (address): The address of partyB.
* `partyA` (address): The address of partyA.
* `chainId` (uint): The chain id.
* `symmio` (address): The address of the Symmio diamond contract.

**Returns** (inside `result.data.result`):

* `chainId` (string): The chain identifier.
* `partyB` (address): The address of partyB.
* `partyA` (address): The address of partyA.
* `symmio` (address): Address of the Symmio diamond contract.
* `uPnlB` (string): The verified unrealized PnL value for partyB.
* `uPnlA` (string): The verified unrealized PnL value for partyA.
* `notionalValueSumB` (string): Sum of notional values for partyB’s positions.
* `notionalValueSumA` (string): Sum of notional values for partyA’s positions.
* `nonceB` (string): Nonce or address used for replay protection for partyB.
* `nonceA` (string): Nonce or address used for replay protection for partyA (same field).
* `timestamp` (uint): The block timestamp at which the data was generated.
* `pricesMap` (object): Map of all symbol price feed values.
* `markPrices` (object): Exchange-specific mark prices.
* `pricesB` (string\[]): Array of price values for partyB.
* `pricesA` (string\[]): Array of price values for partyA.
* `quoteIdsB` (string\[]): Quote IDs used for partyB.
* `quoteIdsA` (string\[]): Quote IDs used for partyA.
* `signature` (bytes): Muon-generated signature (`signatures[0].signature`).
* `owner` (address): Address of the signer (`signatures[0].owner`).
* `nodeSignature` (bytes): Gateway signature appended on contracts, verified on-chain before execution.

**Example API Query**

```bash
https://muon-oracle1.rasa.capital/v1/?app=symmio&method=uPnl&params[partyB]=0x9206D9d8F7F1B212A4183827D20De32AF3A23c59&params[partyA]=0x3B5aC601c7bB74999AB3135fa43cbDBc6aB74570&params[chainId]=8453&params[symmio]=0x91Cf2D8Ed503EC52768999aA6D8DBeA6e52dbe43
```

#### Example Response:

```json
{
    "success": true,
    "result": {
        "reqId": "0xeacebfbc6b01dd2e5438826c4b193b0274ef3898c4e234a60247950aea1fd0ed",
        "app": "symmio",
        "appId": "67095677696457568621176602095256212877581942797155816526660337292193161013107",
        "method": "uPnl",
        "data": {
            "params": {
                "partyB": "0x9206D9d8F7F1B212A4183827D20De32AF3A23c59",
                "partyA": "0x3B5aC601c7bB74999AB3135fa43cbDBc6aB74570",
                "chainId": "8453",
                "symmio": "0x91Cf2D8Ed503EC52768999aA6D8DBeA6e52dbe43"
            },
            "timestamp": 1745193175,
            "uid": "1ipapt23eqpui5i",
            "result": {
                "chainId": "8453",
                "partyB": "0x9206D9d8F7F1B212A4183827D20De32AF3A23c59",
                "partyA": "0x3B5aC601c7bB74999AB3135fa43cbDBc6aB74570",
                "symmio": "0x91Cf2D8Ed503EC52768999aA6D8DBeA6e52dbe43",
                "latestBlockNumber": "29201913",
                "uPnlB": "0",
                "uPnlA": "0",
                "notionalValueSumB": "0",
                "notionalValueSumA": "0",
                "nonceB": "0",
                "nonceA": "0",
                "pricesMap": {
                    "VANRYUSDT_BYBIT": "25370000000000000",
                    "MAXUSDT_BYBIT": "39640000000000000",
                    "1000PEPEUSDT_BYBIT": "7517200000000000",
                    "CRVUSDT_BYBIT": "600800000000000000",
                    "XTERUSDT_BYBIT": "312200000000000000",
                    "10000SATSUSDT_BYBIT": "414500000000000",
                    "DOGSUSDT_BYBIT": "119700000000000",
                    //...
                },
                "maxLeverages": {},
                "markPrices": {
                    "binance": {
                        "VANRYUSDT_BYBIT": "25370000000000000",
                        "MAXUSDT_BYBIT": "39640000000000000",
                        "1000PEPEUSDT_BYBIT": "7517200000000000",
                        "CRVUSDT_BYBIT": "600800000000000000",
                        "XTERUSDT_BYBIT": "312200000000000000",
                        "10000SATSUSDT_BYBIT": "414500000000000",
                        //...
                    }
                },
                "pricesB": [],
                "pricesA": [],
                "quoteIdsB": [],
                "quoteIdsA": []
            },
            "signParams": [
                {
                    "name": "appId",
                    "type": "uint256",
                    "value": "67095677696457568621176602095256212877581942797155816526660337292193161013107"
                },
                {
                    "name": "reqId",
                    "type": "bytes",
                    "value": "0xeacebfbc6b01dd2e5438826c4b193b0274ef3898c4e234a60247950aea1fd0ed"
                },
                {
                    "type": "address",
                    "value": "0x91Cf2D8Ed503EC52768999aA6D8DBeA6e52dbe43"
                },
                {
                    "type": "address",
                    "value": "0x9206D9d8F7F1B212A4183827D20De32AF3A23c59"
                },
                {
                    "type": "address",
                    "value": "0x3B5aC601c7bB74999AB3135fa43cbDBc6aB74570"
                },
                {
                    "type": "uint256",
                    "value": "0"
                },
                {
                    "type": "uint256",
                    "value": "0"
                },
                {
                    "type": "int256",
                    "value": "0"
                },
                {
                    "type": "int256",
                    "value": "0"
                },
                {
                    "type": "uint256",
                    "value": 1745193175
                },
                {
                    "type": "uint256",
                    "value": "8453"
                }
            ],
            "resultHash": "0xc4d234d74949cf04101e79ece159f551b599cdd495364fd338eca5a936914297",
            "init": {
                "nonceAddress": "0xCB5294feF14831E1BF7ac28E527D9EFB06E99B0c"
            }
        },
        "signatures": [
            {
                "owner": "0x8a59b05281ac699321D93974A228E7EC0A2c9357",
                "ownerPubKey": {
                    "x": "0x3fb5a506c907e2f6984e4f7207fc445d3c847474d056adfd4718f17548b72136",
                    "yParity": "0"
                },
                "signature": "0x2c5e4c568638b2289a64fcb76ca8f53002f1050bc662609745794ea108c5beac"
            }
        ],
        "gwAddress": "0xF621f85f20BBe733699306D336230184621dBe60",
        "shieldAddress": "0xF621f85f20BBe733699306D336230184621dBe60",
        "shieldSignature": "0x1f2e752e8fcd1d630218ef0c824f1f69602f4bfb8adc07511052b99e268a415f033a0ac1676759d4791e6c449bad1ef6cbffa76654034c9b7da466d4cafe10dd1c",
        "nodeSignature": "0x1f2e752e8fcd1d630218ef0c824f1f69602f4bfb8adc07511052b99e268a415f033a0ac1676759d4791e6c449bad1ef6cbffa76654034c9b7da466d4cafe10dd1c",
        "confirmed": true
    }
}
```

### \[GET] uPnlWithSymbolPrice

This endpoint computes unrealized profit and loss (uPnL) for both **partyA** and **partyB** and retrieves the price for a specified symbol in a single call. It is used to call [`openPosition()`](https://docs.symm.io/liquidity-provider-documentation/building-a-solver-on-symmio/4.-opening-closing-a-position-on-chain#opening-the-position-script) by solvers to validate asset prices and enforce solvency requirements before executing on-chain transactions.

**Contract Struct:**

```solidity
struct PairUpnlAndPriceSig {
	bytes reqId;
	uint256 timestamp;
	int256 upnlPartyA;
	int256 upnlPartyB;
	uint256 price;
	bytes gatewaySignature;
	IMuonSignatureVerifier.SchnorrSign sigs;
}
```

**Parameters:**

* `partyB` (address): The address of partyB.
* `partyA` (address): The address of partyA.
* `chainId` (uint): The blockchain network identifier.
* `symmio` (address): The address of the Symmio diamond contract.
* `symbolId` (uint): The ID of the asset symbol for which to retrieve the price.

**Returns**:

* `chainId` (string): The chain identifier.
* `partyB` (address): The address of partyB.
* `partyA` (address): The address of partyA.
* `symbolId` (string): The requested symbol ID.
* `price` (string): The signed price value for the requested symbol.
* `uPnlA` (string): The verified unrealized PnL value for partyA.
* `uPnlB` (string): The verified unrealized PnL value for partyB.
* `notionalValueSumA` (string): Sum of notional values for partyA’s positions.
* `notionalValueSumB` (string): Sum of notional values for partyB’s positions.
* `nonceA` (string): Nonce or address used for replay protection for partyA .
* `nonceB` (string): Nonce or address used for replay protection for partyB (same field).
* `timestamp` (uint): The block timestamp at which the data was generated.
* `pricesMap` (object): Map of all symbol price feed values.
* `markPrices` (object): Exchange-specific mark prices.
* `pricesA` (string\[]): Array of active price values for partyA.
* `pricesB` (string\[]): Array of active price values for partyB.
* `quoteIdsA` (string\[]): Quote IDs used for partyA.
* `quoteIdsB` (string\[]): Quote IDs used for partyB.
* `signature` (bytes): Muon-generated signature (`signatures[0].signature`).
* `owner` (address): Address of the signer (`signatures[0].owner`).
* `nodeSignature` (bytes): Gateway signature appended on contracts, verified on-chain before execution.

**Example API Query**

```bash
https://muon-oracle1.rasa.capital/v1/?app=symmio&method=uPnlWithSymbolPrice&params[partyB]=0x9206D9d8F7F1B212A4183827D20De32AF3A23c59&params[partyA]=0x3B5aC601c7bB74999AB3135fa43cbDBc6aB74570&params[chainId]=8453&params[symmio]=0x91Cf2D8Ed503EC52768999aA6D8DBeA6e52dbe43&params[symbolId]=4
```

#### Example Response

```json
{
    "success": true,
    "result": {
        "reqId": "0xac5c6ed705cab31fb58c60af0f1a9012ca786decf22bc8a27e3cf40a56e3e263",
        "app": "symmio",
        "appId": "67095677696457568621176602095256212877581942797155816526660337292193161013107",
        "method": "uPnlWithSymbolPrice",
        "data": {
            "params": {
                "partyB": "0x9206D9d8F7F1B212A4183827D20De32AF3A23c59",
                "partyA": "0x3B5aC601c7bB74999AB3135fa43cbDBc6aB74570",
                "chainId": "8453",
                "symmio": "0x91Cf2D8Ed503EC52768999aA6D8DBeA6e52dbe43",
                "symbolId": "4"
            },
            "timestamp": 1745193997,
            "uid": "1ipaqm4ptnsfj6u",
            "result": {
                "chainId": "8453",
                "partyB": "0x9206D9d8F7F1B212A4183827D20De32AF3A23c59",
                "partyA": "0x3B5aC601c7bB74999AB3135fa43cbDBc6aB74570",
                "symbolId": "4",
                "price": "2082468540000000000",
                "symmio": "0x91Cf2D8Ed503EC52768999aA6D8DBeA6e52dbe43",
                "latestBlockNumber": "29202324",
                "uPnlB": "0",
                "uPnlA": "0",
                "notionalValueSumB": "0",
                "notionalValueSumA": "0",
                "nonceB": "0",
                "nonceA": "0",
                "pricesMap": {
                    "VANRYUSDT_BYBIT": "25600000000000000",
                    "HIVEUSDT_BYBIT": "237400000000000000",
                    "1000PEPEUSDT_BYBIT": "7548000000000000",
                    "CRVUSDT_BYBIT": "605000000000000000",
                    "XTERUSDT_BYBIT": "312500000000000000",
                    "10000SATSUSDT_BYBIT": "414200000000000",
                    "DOGSUSDT_BYBIT": "120000000000000",
                    //...
                },
                "maxLeverages": {},
                "markPrices": {
                    "binance": {
                        "VANRYUSDT_BYBIT": "25600000000000000",
                        "HIVEUSDT_BYBIT": "237400000000000000",
                        "1000PEPEUSDT_BYBIT": "7548000000000000",
                        "CRVUSDT_BYBIT": "605000000000000000",
                        "XTERUSDT_BYBIT": "312500000000000000",
                        "10000SATSUSDT_BYBIT": "414200000000000",
                        //...
                    }
                },
                "pricesB": [],
                "pricesA": [],
                "quoteIdsB": [],
                "quoteIdsA": []
            },
            "signParams": [
                {
                    "name": "appId",
                    "type": "uint256",
                    "value": "67095677696457568621176602095256212877581942797155816526660337292193161013107"
                },
                {
                    "name": "reqId",
                    "type": "bytes",
                    "value": "0xac5c6ed705cab31fb58c60af0f1a9012ca786decf22bc8a27e3cf40a56e3e263"
                },
                {
                    "type": "address",
                    "value": "0x91Cf2D8Ed503EC52768999aA6D8DBeA6e52dbe43"
                },
                {
                    "type": "address",
                    "value": "0x9206D9d8F7F1B212A4183827D20De32AF3A23c59"
                },
                {
                    "type": "address",
                    "value": "0x3B5aC601c7bB74999AB3135fa43cbDBc6aB74570"
                },
                {
                    "type": "uint256",
                    "value": "0"
                },
                {
                    "type": "uint256",
                    "value": "0"
                },
                {
                    "type": "int256",
                    "value": "0"
                },
                {
                    "type": "int256",
                    "value": "0"
                },
                {
                    "type": "uint256",
                    "value": "4"
                },
                {
                    "type": "uint256",
                    "value": "2082468540000000000"
                },
                {
                    "type": "uint256",
                    "value": 1745193997
                },
                {
                    "type": "uint256",
                    "value": "8453"
                }
            ],
            "resultHash": "0xe1c3ceaf76d5e86d82a75a02bda4fc17c8bd12b59f76d73bd19b77fcac64a36c",
            "init": {
                "nonceAddress": "0x43D18Bac62a74933c62b7293b970c3706B3d3995"
            }
        },
        "signatures": [
            {
                "owner": "0x8a59b05281ac699321D93974A228E7EC0A2c9357",
                "ownerPubKey": {
                    "x": "0x3fb5a506c907e2f6984e4f7207fc445d3c847474d056adfd4718f17548b72136",
                    "yParity": "0"
                },
                "signature": "0xfac03111e8a2141f7695dd4473581dff86bb44bdad4c27aa5673c02174fddff2"
            }
        ],
        "gwAddress": "0xF621f85f20BBe733699306D336230184621dBe60",
        "shieldAddress": "0xF621f85f20BBe733699306D336230184621dBe60",
        "shieldSignature": "0xdb9edc2f67728222f905ea07451098e749d3e63f74f466d3f41c98b5c41df1e564bfe0303144b115f2a1fce9f74a37dc7dc5fcbbec30475ef64cb06fcc9f3fee1c",
        "nodeSignature": "0xdb9edc2f67728222f905ea07451098e749d3e63f74f466d3f41c98b5c41df1e564bfe0303144b115f2a1fce9f74a37dc7dc5fcbbec30475ef64cb06fcc9f3fee1c",
        "confirmed": true
    }
}
```

### \[GET] price

The `price` method retrieves and validates the prices of one or more quotes by their quote IDs. It fetches the current mark prices for the symbols underlying each quote and validates them across multiple exchange sources (Binance, Kucoin, Mexc) within tolerance limits. The signature returned by this endpoint produces a [**`QuotePriceSig`** ](https://docs.symm.io/contract-documentation/version-history/contracts-documentation-0.8.2/symm-app-muon/muonstorage#quotepricesig).

This is used in the **partyB liquidation flow** — specifically `liquidatePositionsPartyB()`, where after partyB has been marked as liquidated, individual positions need to be closed at verified market prices. The `QuotePriceSig` provides the attested prices for each quote being liquidated, and the contract validates that the signature timestamp falls within the liquidation timeout window.

**Contract Struct:**

```solidity
/// @notice Muon signature attesting to current prices for a set of quotes
struct QuotePriceSig {
	bytes reqId;
	uint256 timestamp;
	uint256[] quoteIds;
	uint256[] prices;
	bytes gatewaySignature;
	IMuonSignatureVerifier.SchnorrSign sigs;
}
```

**Parameters:**

* `quoteIds` (uint\[]): Array of quote identifiers to fetch prices for.
* `chainId` (uint): The blockchain network identifier.
* `symmio` (address): The address of the Symmio diamond contract.

**Returns:**

* `chainId` (string): The chain identifier.
* `quoteIds` (number\[]): The array of requested quote IDs.
* `symmio` (address): Address of the Symmio diamond contract.
* `symbols` (string\[]): The asset symbols corresponding to each quote.
* `prices` (string\[]): Signed price values for each requested quote.
* `pricesMap` (object): Map of all symbol price feed values.
* `markPrices` (object): Exchange-specific mark prices.
* `maxLeverages` (object): Maximum leverage settings per symbol (if any).
* `signature` (bytes): Muon-generated signature (`signatures[0].signature`).
* `owner` (address): Address of the signer (`signatures[0].owner`).
* `nodeSignature` (bytes): Gateway signature appended on contracts, verified on-chain before execution.

**Example API Query**

```bash
https://muon-oracle4.rasa.capital/v1/?app=symmio&method=price&params[quoteIds]=[130830]&params[chainId]=8453&params[symmio]=0x91Cf2D8Ed503EC52768999aA6D8DBeA6e52dbe43
```

#### Example Response:

```json
{
    "success": true,
    "result": {
        "reqId": "0x45f355e6cb583b890a4d1b5766c0c381360516a46ab4c3754be3c3932ab273ae",
        "app": "symmio",
        "appId": "67095677696457568621176602095256212877581942797155816526660337292193161013107",
        "method": "price",
        "data": {
            "params": {
                "quoteIds": "[130830]",
                "chainId": "8453",
                "symmio": "0x91Cf2D8Ed503EC52768999aA6D8DBeA6e52dbe43"
            },
            "timestamp": 1745194435,
            "uid": "1ipar3gfqap30ui",
            "result": {
                "chainId": "8453",
                "quoteIds": [
                    130830
                ],
                "symmio": "0x91Cf2D8Ed503EC52768999aA6D8DBeA6e52dbe43",
                "latestBlockNumber": "29202543",
                "symbols": [
                    "XRPUSDT"
                ],
                "prices": [
                    "2082600000000000000"
                ],
                "pricesMap": {
                    "AUCTIONUSDT_BYBIT": "11270000000000000000",
                    "SIRENUSDT_BYBIT": "62380000000000000",
                    "UNIUSDT_BYBIT": "5270000000000000000",
                    "HPOS10IUSDT_BYBIT": "47190000000000000",
                    "BTCUSDT-26DEC25_BYBIT": "89429660000000000000000",
                    "ETHUSDT-27MAR26_BYBIT": "1680090000000000000000",
                    "MDTUSDT_BYBIT": "27600000000000000",
                    //...
                },
                "markPrices": {
                    "binance": {
                        "AUCTIONUSDT_BYBIT": "11270000000000000000",
                        "SIRENUSDT_BYBIT": "62380000000000000",
                        "UNIUSDT_BYBIT": "5270000000000000000",
                        "HPOS10IUSDT_BYBIT": "47190000000000000",
                        "BTCUSDT-26DEC25_BYBIT": "89429660000000000000000",
                        "ETHUSDT-27MAR26_BYBIT": "1680090000000000000000",
                        "MDTUSDT_BYBIT": "27600000000000000",
                        //...
                    }
                },
                "maxLeverages": {}
            },
            "signParams": [
                {
                    "name": "appId",
                    "type": "uint256",
                    "value": "67095677696457568621176602095256212877581942797155816526660337292193161013107"
                },
                {
                    "name": "reqId",
                    "type": "bytes",
                    "value": "0x45f355e6cb583b890a4d1b5766c0c381360516a46ab4c3754be3c3932ab273ae"
                },
                {
                    "type": "address",
                    "value": "0x91Cf2D8Ed503EC52768999aA6D8DBeA6e52dbe43"
                },
                {
                    "type": "uint256[]",
                    "value": [
                        130830
                    ]
                },
                {
                    "type": "uint256[]",
                    "value": [
                        "2082600000000000000"
                    ]
                },
                {
                    "type": "uint256",
                    "value": 1745194435
                },
                {
                    "type": "uint256",
                    "value": "8453"
                }
            ],
            "resultHash": "0x8f22295f8c5b078effdd251c3d037e594bf694f1f013eb1c2764c0030939d7d8",
            "init": {
                "nonceAddress": "0x8fed0a83eF0a05D1b6d600370d164e7F7DD96c0E"
            }
        },
        "signatures": [
            {
                "owner": "0x8a59b05281ac699321D93974A228E7EC0A2c9357",
                "ownerPubKey": {
                    "x": "0x3fb5a506c907e2f6984e4f7207fc445d3c847474d056adfd4718f17548b72136",
                    "yParity": "0"
                },
                "signature": "0x45fb206809d9933afa219b0dbdbe53bd5fa15070fed1711436f19f02c8f44378"
            }
        ],
        "gwAddress": "0xF621f85f20BBe733699306D336230184621dBe60",
        "shieldAddress": "0xF621f85f20BBe733699306D336230184621dBe60",
        "shieldSignature": "0x31b0b4394585dc3af6425770b276b622591c62340f4913ca7c0221e24a22f0eb53fcf26d69ce34ad1c3067390679a585e934d7af1c4b97bd8d575ac814b442211c",
        "nodeSignature": "0x31b0b4394585dc3af6425770b276b622591c62340f4913ca7c0221e24a22f0eb53fcf26d69ce34ad1c3067390679a585e934d7af1c4b97bd8d575ac814b442211c",
        "confirmed": true
    }
}
```

### \[GET] settle\_upnl

The `settle_upnl` method is used to verify settlement calculations for one or more open positions (represented by `quoteIds`) for a given party. It finalizes the unrealized profit and loss (uPnl) for these positions and returns the settlement data, including the updated uPnl values, notional sums, and nonces required for verification and on-chain settlement. You can read more about `settleUpnl()` [here](https://docs.symm.io/contract-documentation/symmio-perps-v0.8.4/facets/settlement-facet-0.8.4).

**Contract Struct:**

```solidity
struct SettlementSig {
	bytes reqId;
	uint256 timestamp;
	QuoteSettlementData[] quotesSettlementsData;
	int256[] upnlPartyBs;
	int256 upnlPartyA;
	bytes gatewaySignature;
	IMuonSignatureVerifier.SchnorrSign sigs;
}
```

**Parameters:**

* `partyA` (address): The address of partyA.
* `chainId` (uint): The chainId.
* `symmio` (address): The address of the Symmio diamond contract.
* `quoteIds` (uint\[]): JSON-formatted list of quote IDs to be settled (e.g., `[23249]`).

> **Note**: `latestBlockNumber` is not explicitly required in the example. The Muon backend will fetch the appropriate block data internally.

***

**Returns**:

* `chainId` (string): The chain id.
* `partyA` (address): The address of partyA.
* `symmio` (address): Address of the Symmio diamond contract.

**`quoteSettlementData`**: An array containing settlement information for each `quoteId`.

* Each item includes:
  * `quoteId`
  * `currentPrice`
  * `partyBUpnlIndex`
* `uPnlA` (string): Finalized unrealized PnL for partyA.
* `upnlPartyBs` (array): Finalized uPnL values for each counterparty.
* `notionalValueSumA` (string): Sum of notional values for partyA’s settled positions.
* `notionalValueSumBs` (array): Notional sums for each counterparty.
* `nonceA` (string): Nonce or address used for replay protection for partyA (`init.nonceAddress`).
* `noncePartyBs` (array): Nonces for each counterparty.
* `timestamp` (uint): The block timestamp at which the data was generated.
* `signature` (bytes): Muon-generated signature (`signatures[0].signature`).
* `owner` (address): Address of the signer (`signatures[0].owner`).
* `nodeSignature` (bytes): Gateway signature appended on contracts, verified on-chain before execution.

***

**Example API Query**

```
https://muon-oracle4.rasa.capital/v1/?app=symmio&method=settle_upnl&params[partyA]=0x33D689034225A67454980c9D91E35C03a4765B30&params[chainId]=42161&params[symmio]=0x8F06459f184553e5d04F07F868720BDaCAB39395&params[quoteIds]=[31742]
```

***

**Example Response**

```json
{
    "success": true,
    "result": {
        "reqId": "0x0bcba7d9ac58f05f4ee597e26ccfac51163dc3723ef7a0224c5803a230b104cc",
        "app": "symmio",
        "appId": "67095677696457568621176602095256212877581942797155816526660337292193161013107",
        "method": "settle_upnl",
        "data": {
            "params": {
                "partyA": "0x33D689034225A67454980c9D91E35C03a4765B30",
                "chainId": "42161",
                "symmio": "0x8F06459f184553e5d04F07F868720BDaCAB39395",
                "quoteIds": "[31742]"
            },
            "timestamp": 1745195377,
            "uid": "1ipas097c22o7mh",
            "result": {
                "chainId": "42161",
                "partyA": "0x33D689034225A67454980c9D91E35C03a4765B30",
                "symmio": "0x8F06459f184553e5d04F07F868720BDaCAB39395",
                "latestBlockNumber": "328513907",
                "quoteSettlementData": [
                    [
                        "31742",
                        "2099600000000000000",
                        0
                    ]
                ],
                "uPnlA": "680193580148088858",
                "upnlPartyBs": [
                    "-680193580148088858"
                ],
                "notionalValueSumA": "12127366419851911141",
                "notionalValueSumBs": [
                    "12127366419851911141"
                ],
                "nonceA": "45",
                "noncePartyBs": [
                    "45"
                ]
            },
            "signParams": [
                {
                    "name": "appId",
                    "type": "uint256",
                    "value": "67095677696457568621176602095256212877581942797155816526660337292193161013107"
                },
                {
                    "name": "reqId",
                    "type": "bytes",
                    "value": "0x0bcba7d9ac58f05f4ee597e26ccfac51163dc3723ef7a0224c5803a230b104cc"
                },
                {
                    "type": "address",
                    "value": "0x8F06459f184553e5d04F07F868720BDaCAB39395"
                },
                {
                    "type": "string",
                    "value": "verifySettlement"
                },
                {
                    "type": "uint256[]",
                    "value": [
                        "45"
                    ]
                },
                {
                    "type": "uint256",
                    "value": "45"
                },
                {
                    "type": "bytes",
                    "value": "0x0000000000000000000000000000000000000000000000000000000000007bfe0000000000000000000000000000000000000000000000001d2347136a69000000"
                },
                {
                    "type": "int256[]",
                    "value": [
                        "-680193580148088858"
                    ]
                },
                {
                    "type": "int256",
                    "value": "680193580148088858"
                },
                {
                    "type": "uint256",
                    "value": 1745195377
                },
                {
                    "type": "uint256",
                    "value": "42161"
                }
            ],
            "resultHash": "0xbc5001bb7169d49195c9033b1e66616642d662b284cb8abf3d74e516d20e0ef9",
            "init": {
                "nonceAddress": "0x5d18D9A97789a7EB8C156365A9039DD0A7c9E390"
            }
        },
        "signatures": [
            {
                "owner": "0x8a59b05281ac699321D93974A228E7EC0A2c9357",
                "ownerPubKey": {
                    "x": "0x3fb5a506c907e2f6984e4f7207fc445d3c847474d056adfd4718f17548b72136",
                    "yParity": "0"
                },
                "signature": "0x35b32b00dcf2adf01477ac86b553f3fb60eaef3066af07d7b1b8dc019ee10a0d"
            }
        ],
        "gwAddress": "0xF621f85f20BBe733699306D336230184621dBe60",
        "shieldAddress": "0xF621f85f20BBe733699306D336230184621dBe60",
        "shieldSignature": "0x276c7f533beab07d778622bf43b958110fce73f411f8a0426b032853b2efa863480d704a5ec73ff4476ae91ab3caa329f531f479f115c3b51e7c6278cb3b428f1b",
        "nodeSignature": "0x276c7f533beab07d778622bf43b958110fce73f411f8a0426b032853b2efa863480d704a5ec73ff4476ae91ab3caa329f531f479f115c3b51e7c6278cb3b428f1b",
        "confirmed": true
    }
}
```

### \[GET] priceRange

This endpoint returns a TWAP-style price range (highest, lowest, average) for a given symbol over a specified time window, along with both parties' uPnL. The signature returned by this endpoint is used in the `forceClosePosition()` and `settleAndForceClosePosition()` functions to validate the price conditions required for a force close.

The time window (`t0`, `t1`) must satisfy the force close cooldown constraints defined on-chain: `t0` must be >= `quote.statusModifyTimestamp + forceCloseFirstCooldown`, and `t1` must be <= `min(quote.deadline, block.timestamp - forceCloseSecondCooldown)`. Both should be rounded to the nearest minute (start up, end down).

**Contract Struct:**

```solidity
/// @notice Muon signature with highest/lowest prices over a time window and both parties' UPNL
struct HighLowPriceSig {
	bytes reqId;
	uint256 timestamp;
	uint256 symbolId;
	uint256 highest;
	uint256 lowest;
	uint256 averagePrice;
	uint256 startTime;
	uint256 endTime;
	int256 upnlPartyB;
	int256 upnlPartyA;
	uint256 currentPrice;
	bytes gatewaySignature;
	IMuonSignatureVerifier.SchnorrSign sigs;
}
```

Request URL Example:

```
https://muon-oracle4.rasa.capital/v1/?app=symmio&method=priceRange&params[t0]=1722499980&params[t1]=1722510960&params[partyA]=0x8a16596ddbc26152d27ec32d3d0760fc7cc38582&params[partyB]=0x9206D9d8F7F1B212A4183827D20De32AF3A23c59&params[chainId]=42161&params[symmio]=0x8F06459f184553e5d04F07F868720BDaCAB39395&params[symbolId]=49
```

Parameters:

* `t0` (uint): Start of the price observation window.
* `t1` (uint): End of the price observation window .
* `partyA` (address): The address of partyA.
* `partyB` (address): The address of partyB.
* `chainId` (uint): The chain id.
* `symmio` (address): The address of the Symmio diamond contract.
* `symbolId` (uint): The symbol ID for the asset being priced.

Returns:

* `chainId` (string): The chain identifier.
* `partyA` (address): The address of partyA.
* `partyB` (address): The address of partyB.
* `symmio` (address): Address of the Symmio diamond contract.
* `symbolId` (string): The symbol ID for the priced asset.
* `startTime` (uint): Start of the observation window.
* `endTime` (uint): End of the observation window.
* `lowest` (string): Lowest price observed in the time window.
* `highest` (string): Highest price observed in the time window.
* `mean` (string): Average price over the time window. Maps to `averagePrice` in the contract struct.
* `price` (string): Current price at the time of the signature. Maps to `currentPrice` in the contract struct.
* `uPnlB` (string): PartyB's unrealized PnL.
* `uPnlA` (string): PartyA's unrealized PnL.
* `notionalValueSumB` (string): Sum of notional values for partyB's positions.
* `notionalValueSumA` (string): Sum of notional values for partyA's positions.
* `nonceB` (string): PartyB's nonce.
* `nonceA` (string): PartyA's nonce.
* `pricesB` (string\[]): Price values for partyB's positions.
* `pricesA` (string\[]): Price values for partyA's positions.
* `quoteIdsB` (string\[]): Quote IDs for partyB's positions.
* `quoteIdsA` (string\[]): Quote IDs for partyA's positions.
* `nonce` (string): Unique nonce or address used for replay protection (`init.nonceAddress`).
* `timestamp` (uint): The block timestamp at which the data was generated.
* `signature` (bytes): Muon-generated signature (`signatures[0].signature`).
* `owner` (address): Address of the signer (`signatures[0].owner`).
* `nodeSignature` (bytes): Gateway signature appended on contracts (`nodeSignature`).

#### **Contract Struct:**

```solidity
struct HighLowPriceSig {
    bytes reqId;
    uint256 timestamp;
    uint256 symbolId;
    uint256 highest;
    uint256 lowest;
    uint256 averagePrice;   // response field: mean
    uint256 startTime;
    uint256 endTime;
    int256 upnlPartyB;      // response field: uPnlB
    int256 upnlPartyA;      // response field: uPnlA
    uint256 currentPrice;   // response field: price
    bytes gatewaySignature;  // response field: nodeSignature
    SchnorrSign sigs;
}
```

#### **Example Response:**

```json
{
    "success": true,
    "result": {
        "reqId": "0x3f89c1c976733c0e1e7beb417f2ca89ab2a7fd08d609138e590ae44bf72cfeed",
        "app": "symmio",
        "appId": "67095677696457568621176602095256212877581942797155816526660337292193161013107",
        "method": "priceRange",
        "data": {
            "params": {
                "t0": "1722499980",
                "t1": "1722510960",
                "partyA": "0x8a16596ddbc26152d27ec32d3d0760fc7cc38582",
                "partyB": "0x9206D9d8F7F1B212A4183827D20De32AF3A23c59",
                "chainId": "42161",
                "symmio": "0x8F06459f184553e5d04F07F868720BDaCAB39395",
                "symbolId": "49"
            },
            "timestamp": 1770927301,
            "uid": "1jh9ns8kr1esl3s",
            "result": {
                "chainId": "42161",
                "partyB": "0x9206D9d8F7F1B212A4183827D20De32AF3A23c59",
                "partyA": "0x8a16596ddbc26152d27ec32d3d0760fc7cc38582",
                "symmio": "0x8F06459f184553e5d04F07F868720BDaCAB39395",
                "symbolId": "49",
                "startTime": 1722499980,
                "endTime": 1722500040,
                "lowest": "59800000000000000",
                "highest": "59900000000000000",
                "mean": "59850000000000000",
                "price": "8100000000000000",
                "latestBlockNumber": "431425913",
                "uPnlB": "0",
                "uPnlA": "0",
                "notionalValueSumB": "0",
                "notionalValueSumA": "0",
                "nonceB": "0",
                "nonceA": "0",
                "pricesB": [],
                "pricesA": [],
                "quoteIdsB": [],
                "quoteIdsA": []
            },
            "signParams": [
                {
                    "name": "appId",
                    "type": "uint256",
                    "value": "67095677696457568621176602095256212877581942797155816526660337292193161013107"
                },
                {
                    "name": "reqId",
                    "type": "bytes",
                    "value": "0x3f89c1c976733c0e1e7beb417f2ca89ab2a7fd08d609138e590ae44bf72cfeed"
                },
                {
                    "type": "address",
                    "value": "0x8F06459f184553e5d04F07F868720BDaCAB39395"
                },
                {
                    "type": "address",
                    "value": "0x9206D9d8F7F1B212A4183827D20De32AF3A23c59"
                },
                {
                    "type": "address",
                    "value": "0x8a16596ddbc26152d27ec32d3d0760fc7cc38582"
                },
                {
                    "type": "uint256",
                    "value": "0"
                },
                {
                    "type": "uint256",
                    "value": "0"
                },
                {
                    "type": "int256",
                    "value": "0"
                },
                {
                    "type": "int256",
                    "value": "0"
                },
                {
                    "type": "uint256",
                    "value": "49"
                },
                {
                    "type": "uint256",
                    "value": "8100000000000000"
                },
                {
                    "type": "uint256",
                    "value": 1722499980
                },
                {
                    "type": "uint256",
                    "value": 1722500040
                },
                {
                    "type": "uint256",
                    "value": "59800000000000000"
                },
                {
                    "type": "uint256",
                    "value": "59900000000000000"
                },
                {
                    "type": "uint256",
                    "value": "59850000000000000"
                },
                {
                    "type": "uint256",
                    "value": 1770927301
                },
                {
                    "type": "uint256",
                    "value": "42161"
                }
            ],
            "resultHash": "0x5bc32350c7f4fe37987ed8453116f2baa7ddd44869957d2afd183f13ac0b2206",
            "init": {
                "nonceAddress": "0x36DC239bd0Ff302359a1B5D28Ce224a314418c0E"
            }
        },
        "signatures": [
            {
                "owner": "0x90F79bf6EB2c4f870365E785982E1f101E93b906",
                "ownerPubKey": {
                    "x": "0x20b871f3ced029e14472ec4ebc3c0448164942b123aa6af91a3386c1c403e0eb",
                    "yParity": "0"
                },
                "signature": "0x93f76f79df15b0b0432ae8d0cb3b62f993af72896489516972bb2c4d5693a620"
            }
        ],
        "gwAddress": "0xefE3160999Af7B7D5e9aEd8707BF6112cD42BCC5",
        "shieldAddress": "0xefE3160999Af7B7D5e9aEd8707BF6112cD42BCC5",
        "shieldSignature": "0x7d0406066a3a13040127a5080deb2b5e2080e6f2d87cba458f78f1d513d62e5c7258fd782e0629693b085a3a5136045615b121a7f0793be5b49c1375485c4e651b",
        "nodeSignature": "0x7d0406066a3a13040127a5080deb2b5e2080e6f2d87cba458f78f1d513d62e5c7258fd782e0629693b085a3a5136045615b121a7f0793be5b49c1375485c4e651b",
        "confirmed": true
    }
}
```

### Contract Structs Without API Endpoints

The following signature structs are defined in `MuonStorage` but do not currently have corresponding Muon API methods. They are documented here for reference.

#### DeferredLiquidationSig

Used for **deferred liquidation** — proving a user was insolvent at a specific historical block, even after the standard `upnlValidTime` window has expired (provided the user's nonce hasn't changed). This is an extended version of `LiquidationSig` with three additional fields capturing the state at the point of insolvency. Read more in the [0.8.3 changelog](https://docs.symm.io/contract-documentation/version-history/contracts-documentation-0.8.3/muonstorage#deferred-liquidation).

```solidity
/// @notice Muon signature for deferred liquidation with historical insolvency data
struct DeferredLiquidationSig {
	bytes reqId; // Unique identifier for the liquidation request
	uint256 timestamp; // Timestamp when the liquidation signature was created
	uint256 liquidationBlockNumber; // Block number at which the user became insolvent
	uint256 liquidationTimestamp; // Timestamp when the user became insolvent
	uint256 liquidationAllocatedBalance; // User's allocated balance at the time of insolvency
	bytes liquidationId; // Unique identifier for the liquidation event
	int256 upnl; // User's unrealized profit and loss at the time of insolvency
	int256 totalUnrealizedLoss; // Total unrealized loss of the user at the time of insolvency
	uint256[] symbolIds; // List of symbol IDs involved in the liquidation
	uint256[] prices; // Corresponding prices of the symbols involved in the liquidation
	bytes gatewaySignature; // Signature from the gateway for verification
	IMuonSignatureVerifier.SchnorrSign sigs; // Schnorr signature for additional verification
}

```

**Used by:** `deferredLiquidatePartyA()`, `deferredSetSymbolsPrice()`&#x20;

***

#### UnifiedSettlementSig

Used for unified settlement across multiple partyAs against a single partyB.&#x20;

```solidity
struct UnifiedSettlementSig {
	bytes reqId;
	uint256 timestamp;
	UnifiedQuoteSettlementData[] quotesSettlementsData;
	// PartyB being settled (single - all quotes belong to this partyB)
	address partyB;
	// PartyB UPNL - structure depends on mode
	// For crossPartyB: use upnlPartyB (aggregated)
	// For normal: use upnlPartyBPerPartyA[partyAIndex]
	int256 upnlPartyB; // Aggregated UPNL (crossPartyB mode)
	int256[] upnlPartyBPerPartyA; // Per-partyA UPNLs (normal mode)
	// PartyA data (supports multiple)
	address[] partyAs;
	int256[] upnlPartyAs;
	bytes gatewaySignature;
	IMuonSignatureVerifier.SchnorrSign sigs;
}
```

#### PairUpnlAndPricesSig

Both parties' uPnl with prices for **multiple** symbols (arrays).&#x20;

```solidity
struct PairUpnlAndPricesSig {
    bytes reqId;
    uint256 timestamp;
    int256 upnlPartyA;
    int256 upnlPartyB;
    uint256[] symbolIds;
    uint256[] prices;
    bytes gatewaySignature;
    IMuonSignatureVerifier.SchnorrSign sigs;
}
```

#### SingleUpnlWithPendingBalanceSig

Extends `SingleUpnlSig` with a pending balance field.

```solidity
struct SingleUpnlWithPendingBalanceSig {
    bytes reqId;
    uint256 timestamp;
    int256 upnl;
    uint256 pendingBalance;
    bytes gatewaySignature;
    IMuonSignatureVerifier.SchnorrSign sigs;
}
```
