Trading at Uniwhale

Good Sanai
Uniwhale
Published in
6 min readDec 18, 2022

We shared in our last articles how we design our oracle infrastructure and how our Liquidity Pool works.

Our preparation to launch on the BNB Chain testnet is now almost complete, so I would like to go through our app and explain what you should expect when we launch.

Please bear in mind this is a testnet launch, whose purpose is to fine-tune user experience and fix bugs, so we look forward to your testing it out and providing us with feedbacks!

Trade up to 200X, directly from your wallet

We offer perpetual futures with up to 200X leverage on BTC, ETH, and many mainstream crypto assets.

We do not have custody of your assets. Your assets stay with you and the margins posted are locked in a dedicated smart contract.

At the testnet launch, you will be able to

  • open positions using market orders (limit orders coming soon);
  • set/update stop-loss and/or profit-target for the open positions;
  • monitor the market and your open positions, and;
  • close the open positions (partial close-out is also supported) and review the trade history.

Faucet

Before you can begin, you need some TBNB (to pay gas fee) and USDU (for margining). USDU is our own mock stablecoin that will be used during the testnet. On the mainnet, we expect to use USDT as the base stablecoin.

You can get some TBNB on the official BNB Chain Faucet, which gives you 0.5 TBNB a day.

Once you have the TBNB, then you need to swap some of it to USDU, so you can post margins on Uniwhale. There will be a swap (TBNB => USDU) page available on our app when we launch on the testnet.

Now that you have the necessary tokens, it’s time to try out our app!

Margining

All positions are margined in USDU.

You can add and remove margins to outstanding positions. When margins are updated to an outstanding position, the relevant liquidation price is also adjusted.

When we go mainnet, multiple stablecoins will be accepted as eligible margins. These will be swapped automatically to USDT.

Market Order

Market orders are filled at the best price offered by the Liquidity Pool. Stop Loss price and/or Profit Target price can be added to Market Order, which will trigger an automatic close of the position if the condition is satisfied.

Fee and Market Impact

Prices offered by the Liquidity Pool embed two types of transaction costs — Fee and Market Impact.

Long/Short Open Price = Oracle Price x (1 +/- Fee +/- Market Impact)

Long/Short Close Price = Oracle Price x (1 -/+ Fee -/+ Market Impact)

Fee is 0.10% (to get fee discount, join our community and get whitelisted!) Market Impact is calculated dynamically as a function of outstanding positions on the platform and the position size. It is a deterministic charge simulating the impact a new position would have on the market.

Market Impact (%) = (long/short outstanding positions on the platform + Position size) / 1% depth above/below

1% depth above/below is benchmarked to the corresponding liquidity at leading exchanges and regularly updated.

Opening a position

Opening a position will transfer the required margin to a dedicated on-chain contract, whose sole purpose is to hold trader margins.

To open a position, you need to enter the margin you want to put up together with the leverage you are looking for.

When we launch mainnet, you will be able to post margin in many stablecoins, which will then be automatically swapped into USDT using a third-party DEX (e.g. PancakeSwap), with the maximum amount of the stablecoin to meet the USDT margin requirement specified by you.

Your execution price is deterministically calculated (see Fee and Market Impact above) based on the latest oracle price, but, especially during a fast-moving market, there can be a gap between the screen price and the actual execution price (primarily due to changes in oracle price and outstanding positions on the platform).

To mitigate this risk, you can specify Slippage when opening a position, so that the actual execution meets your execution price requirement.

Closing a position

Closing a position will calculate the PnL based on the best price offered by the Liquidity Pool and transfer it to the trader, together with the margin posted.

When we launch mainnet, you may request the PnL to be transferred in a stablecoin other than USDT, in which case the PnL (together with the margin) will be swapped into the requested stablecoin using a third-party DEX (e.g. PancakeSwap), with the minimum amount of the stablecoin specified by you, and transferred to you.

You can not lose more than the margin posted.

Your execution price is deterministically calculated (see Fee and Market Impact) based on the latest oracle price, but, especially during a fast-moving market, there can be a gap between the screen price and the actual execution price (primarily due to changes in oracle price and outstanding positions on the platform).

To mitigate this risk, you can specify Limit Price when closing a position, so that the actual execution meets your execution price requirement. Specifying a Market Price will simply accept the actual execution price.

Liquidation

Outstanding positions are subject to liquidation if the relevant liquidation price is breached according to the price oracle (“Index Price”).

Outstanding positions eligible for liquidation are liquidated at the earliest chance, to protect the users and the platform.

Liquidation closes the relevant position. It is subject to a liquidation penalty. In order to avoid the liquidation penalty, you are advised to close a position before liquidation is triggered.

Risk management

Trading at uniwhale is subject to the following constraints:

  • Leverage cannot exceed 200x.
  • A trader can carry at most 3 open positions for each pair.
  • A trader can carry at most 3 open positions across pairs.
  • A trader can carry at most $100,000 of margin across pairs.
  • Minimum position (after leverage) is $100.
  • A position is subject to the maximum percentage PnL, determined as a function of your margin and leverage (see Maximum Percentage PnL below).
  • The maximum possible PnL of all open positions (long and short) across the platform cannot exceed the prevailing market value of Liquidity Pool.

Maximum Percentage PnL

At Uniwhale, we must ensure that the platform always stays solvent as positions are opened and closed. That means the counterparty to all the trades, ie. the Liquidity Pool, must be able to meet the maximum possible PnL of all open positions (long and short) across the platform.

Because the maximum possible PnL of long/short open positions, by default, is unlimited/very large, respectively, we apply the so-called “Maximum Percentage PnL” to each position, which limits the maximum possible PnL of each position and therefore allows us to determine the maximum possible PnL of all open positions.

To determine Maximum Percentage PnL, we take into consideration the leverage of a position, and the higher the leverage a position has, the higher its Maximum Percentage PnL subject to a cap and a floor, i.e.

Maximum Percentage PnL = Max(Floor, Min(Cap, Leverage / Maximum Percentage PnL Factor))

The above makes sense because generally, you would expect a higher potential return with a higher leverage than with a lower leverage.

It also allows the Liquidity Pool to run a far better capital efficiency because the pool then allocates relatively (per leverage) more capital to those with higher leverage than those with lower leverage.

Any questions?

As I shared in our introduction, user experience is something we care about greatly. UI/UX is as important a part, if not more important, we offer to our community, as the smart contracts that drive the trading.

When you try out our testnet, I hope you feel the same — that the whole experience is smooth and intuitive, without clutteredness.

Many more features will be added as we ramp up to a mainnet launch, based on your feedbacks, so please make your voice heard!

To get involved and stay updated on all Uniwhale related matters:

--

--

Good Sanai
Uniwhale

Chief Architect | Smart Contract Builder | Risk Management | ex-Wallstreet Quant