Muon API Queries
Introduction
The Muon API is designed to provide signed data for SYMM 3rd Party frontends, a platform that enables users to trade assets and perpetual contracts (perps) without the need for Know Your Customer (KYC) procedures. By utilizing their Ethereum wallet, users can participate in trading activities on Cloverfield.
Muon acts as an intermediary service, facilitating the generation and signing of data that is required for trading. This documentation will provide an overview of the app codebase, explaining its key components and functionalities.
Overview of the Muon API
The Muon API is designed to provide various data related to parties, unrealized profit and loss (uPnl) and price data. It offers separate uPnl calculations for individual parties, namely "partyA" and "partyB," as well as combined uPnl calculations for both parties together. Additionally, the API allows fetching the prices of given quotes. The following sections provide technical documentation of each method.
API Query Endpoints
The Muon app can be queried using specific URLs, each corresponding to different networks:
https://muon-oracle2.rasa.capital/v1/: Base, Mantle
https://muon-oracle3.rasa.capital/v1/: BSC, Blast
https://muon-oracle4.rasa.capital/v1/: BSC, Blast
uPnl_A
uPnl_A
The uPnl_A
method in the Muon app is designed to verify and validate the unrealized profit and loss (uPnl) for partyA
based on a set tolerance level.
Input Parameters
partyA
: The address of partyA.chainId
: The chain identifier.symmio
: Address of the Symmio diamond.latestBlockNumber
: The latest block number to fetch data for.
Returned Data Structure
symmio
: Address of the Symmio diamond.partyA
: The address of partyA.nonce
: Unique nonce for the transaction to prevent replay attacks.uPnl
: The verified uPnl value for partyA as obtained from the request data.timestamp
: The blockchain timestamp at which the request data was generated.chainId
: The chain identifier.
Example API Query
Example Response
partyA_overview
partyA_overview
The partyA_overview
method in the Muon API provides a comprehensive overview of partyA
's trading status, including the unrealized profit and loss (uPnl), loss, notional value sum, and other relevant financial data. This method ensures detailed insight into partyA
's trading performance and current market position.
Input Parameters
partyA
: The address of partyA.chainId
: The chain identifier.symmio
: Address of the Symmio diamond.latestBlockNumber
: The latest block number to fetch data for.
Returned Data Structure
symmio
: Address of the Symmio diamond.partyA
: The address of partyA.nonce
: Unique nonce for the transaction to prevent replay attacks.uPnl
: The verified uPnl value for partyA as obtained from the request data.timestamp
: The blockchain timestamp at which the request data was generated.
Example API Query
Example Response
uPnl_A_withSymbolPrice
uPnl_A_withSymbolPrice
The uPnl_A_withSymbolPrice
method in the Muon API calculates the unrealized profit and loss (uPnl) for partyA
and fetches the current price of a specified symbol.
Input Parameters
partyA
: The address of partyA.chainId
: The chain identifier.symbolId
: The identifier of the trading symbol.symmio
: Address of the Symmio diamond.latestBlockNumber
: The latest block number to fetch data for.
Returned Data Structure
chainId
: The chain identifier.partyA
: The address of partyA.symbolId
: The identifier of the trading symbol.price
: The current price of the specified symbol.symmio
: Address of the Symmio diamond.latestBlockNumber
: The latest block number at the time of the query.Additional data included as the
result
.
Example API Query
Example Response:
uPnl_B
uPnl_B
The uPnl_B
method within the Muon API calculates the unrealized profit and loss (uPnl) specifically for partyB
in relation to partyA
.
Input Parameters
partyB
: The address of partyB.partyA
: The address of partyA.chainId
: The chain identifier.symmio
: Address of the Symmio diamond.latestBlockNumber
: The latest block number to fetch data for.
Returned Data Structure
chainId
: The chain identifier.partyB
: The address of partyB.partyA
: The address of partyA.symmio
: Address of the Symmio diamond.latestBlockNumber
: The latest block number at the time of the query.Additional data included as the
result
.
Example API Query
Example Response:
uPnl
uPnl
The uPnl
method within the Muon API calculates the combined unrealized profit and loss (uPnl) for both partyB
and partyA
. This method provides a comprehensive view of the financial performance and interactions between the two parties.
Input Parameters
partyB
: The address of partyB.partyA
: The address of partyA.chainId
: The chain identifier.symmio
: Address of the Symmio diamond.latestBlockNumber
: The latest block number to fetch data for.
Returned Data Structure
chainId
: The chain identifier.partyB
: The address of partyB.partyA
: The address of partyA.symmio
: Address of the Symmio diamond.latestBlockNumber
: The latest block number at the time of the query.Additional data included as the
result
.
Example API Query
Example Response:
uPnlWithSymbolPrice
The uPnlWithSymbolPrice
method within the Muon API calculates the combined unrealized profit and loss (uPnl) for both partyB
and partyA
and fetches the current price of a specified symbol. This method provides comprehensive financial performance metrics for both parties and the latest symbol price.
Input Parameters
partyB
: The address of partyB.partyA
: The address of partyA.chainId
: The chain identifier.symbolId
: The identifier of the trading symbol.symmio
: Address of the Symmio diamond.latestBlockNumber
: The latest block number to fetch data for.
Returned Data Structure
chainId
: The chain identifier.partyB
: The address of partyB.partyA
: The address of partyA.symbolId
: The identifier of the trading symbol.price
: The current price of the specified symbol.symmio
: Address of the Symmio diamond.latestBlockNumber
: The latest block number at the time of the query.Additional data included as the
result
.
Example API Query
Example Response
price
price
The price
method within the Muon API fetches the current prices of specified quotes. This method provides up-to-date pricing information for a list of trading symbols.
Input Parameters
quoteIds
: A JSON-formatted list of quote identifiers.chainId
: The chain identifier.symmio
: Address of the Symmio diamond.latestBlockNumber
: The latest block number to fetch data for.
Returned Data Structure
chainId
: The chain identifier.quoteIds
: The list of quote identifiers.symmio
: Address of the Symmio diamond.latestBlockNumber
: The latest block number at the time of the query.Additional price data as included in the
result
fromfetchPrices
.
Example API Query
Example Response:
Last updated