Setting up a Hedger with Symmio

Overview

This document provides a quick guide on setting up a hedger with the SYMMIO platform.

Prerequisites

Read Symmio's Smart Contracts: Understanding the smart contracts is essential. Start by reading through the contracts to familiarize yourself with their functions and events. Smart contract documentation (0.8.2) can be found here.

Steps to Set Up a Hedger with SYMM

Smart Contracts and Event Handling

To become familiar with the infrastructure it's recommended to develop a bot to read and handle events from the smart contracts. This bot should listen for specific events and then take appropriate actions depending on the function.

Symmio's smart contracts rely on data verification from the Muon network to ensure the validity of asset prices and unrealized profit and loss for parties. This process involves invoking methods on the Muon app before any action is executed on the contract. You can read more about Muon queries here.

To accept quotes, you need an address that is whitelisted to act as partyB on the contract side. Please contact our developers to get whitelisted.

Setting Up a Mock Frontend

After getting familiar with the smart contracts and developing your event-handling bot, the next step is to set up a mock frontend.

  1. Obtain a Mock Frontend:

    • Contact Symmio's development team to get access to a mock frontend. This frontend will allow you to send intents and simulate various user actions.

  2. Send Intents:

    • Use the mock frontend to send intents to your bot. You can use these intents to test how your bot handles different events and actions.

  3. Write a Script to Accept Intents:

    • Develop a script that will process and accept the intents sent from the mock frontend.

Building the Position Manager / Internal Solving Strategy

This involves creating an internal strategy for solving positions based on market conditions and your hedging needs. Hedging strategies are private and may vary. Develop your unique strategy based on your risk management and market analysis.

Building the Broker Order Pusher

When a quote is seen that adheres to the solving strategy, it's standard procedure to call lockQuote() on the contract side, then open a position elsewhere (Binance, etc.) to hedge the position before calling openPosition() on the contract. This process can also be done in parallel with Instant Execution, where a user delegates the access of their account to the solver to enable faster trading. To ensure these transactions succeed it's vital to create a module for reliable RPC calls, or use a service like Gelato Relayer.

Build the On-Chain Balance Manager

One of the services that hedger should run is a position manager to keep tabs on solvency to prevent being liquidated across positions. Create a balance manager to track and manage the health of your positions on-chain which can adjust the collateral balances within each trade.

Setting up Endpoints/Websockets

To ensure effective communication with frontends and users, you'll need to set up various APIs and Websockets.

REST APIs

Set up APIs to provide essential data such as:

  • Available Markets: Lists the markets that the hedger is offering.

  • Total Open Interest: Provides data on the total open interest across different markets.

  • Error Codes: Provides a list of potential error codes and their meanings.

  • User Position Data: Returns data related to a user's position with the hedger.

Websockets

Configure Websockets to provide real-time updates:

  • Funding Rate: Reflects the current funding rate charged on each symbol.

  • User Position State: Notifies users about the state of their position.

For an exhaustive list and detailed examples of endpoints and Websockets, please refer to this documentation.

Build a Position Monitor & Validator

Finally set up monitoring and developer alerts to maintain uptime and reliability.

Last updated

Logo

All rights to the people (c) 2023 Symmetry Labs A.G.