---
description: >-
  ByteMX is a decentralized exchange allowing trading without the need for a
  username or password.
---

# Trading

### Adding a Wallet[​](https://docs.gmx.io/docs/trading/v2#adding-a-wallet) <a href="#adding-a-wallet" id="adding-a-wallet"></a>

If you do not have a wallet yet, you can use [Rabby](https://rabby.io/).

### Connecting your Wallet[​](https://docs.gmx.io/docs/trading/v2#connecting-your-wallet) <a href="#connecting-your-wallet" id="connecting-your-wallet"></a>

After you have a wallet, you can connect your wallet by pressing the "Connect Wallet" button on the Trade page.

If you see the message: "Your wallet is not connected to XChain", click on "Add XChain" to add the XChain network to your wallet.

Alternatively, you can manually add the network.

### RPC URLs[​](https://docs.gmx.io/docs/trading/v2#rpc-urls) <a href="#rpc-urls" id="rpc-urls"></a>

Since ByteMX is a decentralized exchange, querying of data and submitting of transactions is done through an RPC URL.

There may be times when the RPC URL is not as responsive as it should be, during these times you may notice data being slow to load or not loading on your page.

### Sending Tokens[​](https://docs.gmx.io/docs/trading/v2#sending-tokens) <a href="#sending-tokens" id="sending-tokens"></a>

You will need to have BEXC in your XChain account to start trading.

You can buy BEXC directly on XChain from [ByteSwap](https://trade.byteswap.finance/swap)

### Swaps[​](https://docs.gmx.io/docs/trading/v2#swaps) <a href="#swaps" id="swaps"></a>

ByteMX supports both swaps and leverage trading. For swaps, click on the "Swap" tab on the Trade page, this will open the interface to swap tokens.

For leverage trading, please see the below sections for more information.

### Opening a Position[​](https://docs.gmx.io/docs/trading/v2#opening-a-position) <a href="#opening-a-position" id="opening-a-position"></a>

Click on "Long" or "Short" on the Trade page depending on which side you would like to open a leverage position on.

Long position:

* Earns a profit if the token's price goes up
* Makes a loss if the token's price goes down

Short position:

* Earns a profit if the token's price goes down
* Makes a loss if the token's price goes up

After selecting your side, key in the amount you want to pay and the leverage you want to use.

Below the swap box you would see the "Exit Price", which is the price that is used to calculate profits if you open and then immediately close a position. The exit price will change with the price of the token you are longing or shorting.

#### Selecting a Market[​](https://docs.gmx.io/docs/trading/v2#selecting-a-market) <a href="#selecting-a-market" id="selecting-a-market"></a>

You can select a market by changing the token that you'd like to Long or Short.

#### Selecting a Pool[​](https://docs.gmx.io/docs/trading/v2#selecting-a-pool) <a href="#selecting-a-pool" id="selecting-a-pool"></a>

Multiple pools may be available for your selected market, for example, there may be ETH-USDT pool. You can select which pool you'd like to trade in depending on which collateral you prefer to be backing your positions.

#### Selecting a Collateral[​](https://docs.gmx.io/docs/trading/v2#selecting-a-collateral) <a href="#selecting-a-collateral" id="selecting-a-collateral"></a>

Multiple types of collateral may be available for your selected market, for example, in the ETH-USDT market, you can choose whether your position's collateral is stored as ETH or USDT.

Examples of how this could be used:

* Long ETH with ETH as collateral: You would have be long ETH from your long position as well as from your ETH collateral. It is possible to e.g. open a 0.1 ETH long position for a small amount of ETH while using 1 ETH as collateral for a total of 1.1 ETH exposure.
* Long ETH with USDT as collateral: You would be long ETH only from your long position. This could be useful if switching frequently between longing and shorting.
* Short ETH with ETH as collateral: This could be useful for delta neutral strategies to earn funding fees. For example, if funding is such that longs pay shorts, then a 1 ETH short position could be opened with 1 ETH as collateral.
* Short ETH with USDT as collateral: This could be useful if switching frequently between longing and shorting.

Note that if opening a long position with a non-stablecoin as collateral, your liquidation price may change as the price of your collateral changes.

#### Max Leverage[​](https://docs.gmx.io/docs/trading/v2#max-leverage) <a href="#max-leverage" id="max-leverage"></a>

The max allowed leverage of a pool will decrease as the total open interest of the pool increases, this is to guard the pool against gaming of price impact using high leverage positions. This mainly affects markets with less liquidity but can affect high liquidity markets if the open interest is very large. The interface will show a warning if the max allowed leverage will be exceeded. Note that this only affects opening / increasing of positions, it will not affect positions that have already been opened. For closing / decreasing of positions, if the max allowed leverage would be exceeded when decreasing a position then the order can still be executed, but the collateral within the position would not be reduced.

### Managing Positions[​](https://docs.gmx.io/docs/trading/v2#managing-positions) <a href="#managing-positions" id="managing-positions"></a>

After opening a trade, you would be able to view it under your Positions list, you can also click on "Edit" to deposit or withdraw collateral, this allows you to manage your leverage and liquidation price.

### Closing a Position[​](https://docs.gmx.io/docs/trading/v2#closing-a-position) <a href="#closing-a-position" id="closing-a-position"></a>

You can close a position partially or completely by clicking on the "Close" button in the position row. Closing a position will realise pending profits / losses proportional to the percentage of the position that is closed.

For long positions, profits are paid in the asset you are longing, e.g. if you long ETH your profits will be in ETH.

For short positions, profits will be paid out in the same stablecoin that you used to open the position, e.g. USDT.

You can customize the token to be received by changing the "Receive" token in the "Close Position" menu. Note that this may perform a swap from your profit token to the token you select if needed, the swap fees will be shown in the "Close Position" menu.

The amount of profit and loss for a position, excluding changes in your collateral's value, will be proportional to your position size. For example, if you open a long ETH position of size 10,000 USD and if the price of ETH increases by 10%, the position would have a profit of 1000 USD, if the price of ETH decreases by 10%, the position would have a loss of 1000 USD.

If a short position was opened instead, then if the price of ETH decreased by 10% the position would have a profit of 1000 USD, if the price of ETH increased by 10%, the position would have a loss of 1000 USD.

Leverage for a position is displayed as (position size) / (position collateral). If you'd like to display the leverage as (position size + PnL) / (position collateral) instead, you can customise this in the "Settings" menu by clicking on the "..." icon at the top right of the page.

### Limit Orders[​](https://docs.gmx.io/docs/trading/v2#limit-orders) <a href="#limit-orders" id="limit-orders"></a>

Limit orders can be created by selecting the "Limit" option after selecting whether you would like to open a long or short.

After creating a limit order, it will appear in under the "Orders" tab, you can edit the order and change the trigger price if needed.

Note that limit orders are not guaranteed to execute, this can occur in a few situations including but not exclusive to:

* The mark price which is an aggregate of exchange prices did not reach the specified price
* The mark price was reached but there may not be sufficient liquidity to execute the order
* The mark price was reached but executing the order would result in a position which exceeds the current max leverage
* The mark price was reached but the max allowed leverage would be exceeded

### Stop-Loss / Take-Profit Orders[​](https://docs.gmx.io/docs/trading/v2#stop-loss--take-profit-orders) <a href="#stop-loss--take-profit-orders" id="stop-loss--take-profit-orders"></a>

Stop-loss and take-profit orders can be created by clicking on the "..." button in the position row and selecting the "Trigger Close" option, it can also be by selecting the "TP/SL" tab in the trade box.

After creating a trigger order, it will appear in your position's row as well as under the "Orders" tab, you can edit the order and change the trigger price if needed.

If you close a position manually, the associated trigger orders will remain open, you would need to cancel them manually if you do not want the order to be active when opening future positions.

Note that orders are not guaranteed to execute, this can occur in a few situations including but not exclusive to:

* The mark price which is an aggregate of exchange prices did not reach the specified price

Additionally, trigger orders are market orders and are not guaranteed to execute at the trigger price.

### Order Execution[​](https://docs.gmx.io/docs/trading/v2#order-execution) <a href="#order-execution" id="order-execution"></a>

If a Limit / Stop-Loss / Take-Profit order's trigger price is reached, the order will attempt to be executed, if the price impact is too high and the acceptable price is not met or if there is insufficient liquidity then the order will be in a "frozen" state. Regular orders will be executed at the price closest to the trigger price, for frozen orders, they will be executed at the latest price instead. The acceptable price requirement will still apply, so frozen orders will only be executed at the latest price if the acceptable price can be met.

### Liquidations[​](https://docs.gmx.io/docs/trading/v2#liquidations) <a href="#liquidations" id="liquidations"></a>

If an ETH long position is opened and the position size is larger than the collateral value, then there would be a price at which the position's loss amount is very close to the collateral value.

This is referred to as the Liquidation Price and is calculated as the price at which the (collateral - losses - fees) is less than a certain percentage, which ranges from 0.4% to 1%, depending on the market and pool settings, of your position's size. If the token's price crosses this point, then the position will be automatically closed.

The price used to calculate whether a position is liquidatable is based on the oracle price, and it does not factor in any negative or positive price impact. When the position is liquidated, the actual positive and negative price impact is applied to close the position.

Due to borrowing and funding fees, your liquidation price is not static. Especially if you use leverage greater than 10x and have the position open for more than a few days, it's crucial to actively monitor your liquidation price.

Collateral can be deposited using the "Edit" button in the position row; this will help to improve the liquidation price and reduce the risk of liquidation.

When a position is liquidated, any collateral remaining after deducting losses and fees would be returned to your account.

### Market Types and ADL[​](https://docs.gmx.io/docs/trading/v2#market-types-and-adl) <a href="#market-types-and-adl" id="market-types-and-adl"></a>

Two types of markets are possible in ByteMX.

#### Fully backed markets[​](https://docs.gmx.io/docs/trading/v2#fully-backed-markets) <a href="#fully-backed-markets" id="fully-backed-markets"></a>

An example of a fully back market would be an ETH perp market backed by ETH-USDT where the open interest is limited to be less than the total amount of ETH and USDT tokens in the pool.

For example, if there is 1000 ETH and 1 million USDT in the pool and the max long open interest is limited to 900 ETH and the max short open interest is limited to be 900k USDT, then all profits can always be fully backed regardless of the price of ETH.

#### Synthetic markets[​](https://docs.gmx.io/docs/trading/v2#synthetic-markets) <a href="#synthetic-markets" id="synthetic-markets"></a>

An example of a synthetic market would be a DOGE perp market backed by ETH-USDT. While the max long open interest could be limited to a fraction of the amount of ETH tokens, it may be possible for the profits of long positions to exceed the worth of the tokens in the pool.

For example, if there is 1000 ETH and 1 million USDT in the pool and the max long DOGE open interest is limited to 300 ETH, but the price of DOGE increases 10x while the price of ETH increases only by 2x, in this case the pending profits would exceed the worth of the ETH in the pool.

To avoid this scenario, ADL (Auto-Deleveraging) may take place. When the pending profits exceed the market's configured threshold, profitable positions may be partially or fully closed. This helps to ensure that markets are always solvent and all profits at the time of closing can be fully paid.

### Fees and Rebates[​](https://docs.gmx.io/docs/trading/v2#fees-and-rebates) <a href="#fees-and-rebates" id="fees-and-rebates"></a>

#### Open / Close Fees[​](https://docs.gmx.io/docs/trading/v2#open--close-fees) <a href="#open--close-fees" id="open--close-fees"></a>

The trading fee to open a position is 0.05% or 0.07% of the position size, similarly there is a 0.05% or 0.07% fee when closing the position. This applies for increasing the position size of an existing position and partially decreasing a position size as well.

If the trade increases the balance of longs and shorts then the fee would be 0.05%, otherwise the fee would be 0.07%.

#### Swap Fees[​](https://docs.gmx.io/docs/trading/v2#swap-fees) <a href="#swap-fees" id="swap-fees"></a>

The fees for a normal swap are 0.05% or 0.07% of the swap amount.

If the trade increases the balance of tokens in the pool then the fee would be 0.05%, otherwise the fee would be 0.07%.

The fees for stablecoin swaps are 0.005% and 0.02% of the swap amount.

If the trade increases the balance of tokens in the stablecoin pool then the fee would be 0.005%, otherwise the fee would be 0.02%.

#### Price Impact[​](https://docs.gmx.io/docs/trading/v2#price-impact) <a href="#price-impact" id="price-impact"></a>

There may be a positive or negative price impact for increasing / decreasing positions and for swaps.

If the trade improves the long / short balance or tokens in the pool then there would be a positive price impact, otherwise there would be a negative price impact.

For increasing / decreasing positions, a positive price impact would result in an entry / exit price that is more favourable for your position, e.g. if opening a long position with a positive price impact, the position's entry price would be lower. A negative price impact would result in a entry / exit price that is less favourable, e.g. if opening a long position with a negative price impact, the position's entry price would be higher.

For swaps, a positive price impact would increase the amount of tokens received while a negative price impact would decrease the amount of tokens received.

The price impact values can be viewed on the interface when making a trade.

#### Price Impact Rebates[​](https://docs.gmx.io/docs/trading/v2#price-impact-rebates) <a href="#price-impact-rebates" id="price-impact-rebates"></a>

Under normal circumstances, the long and short open interest should be mostly equal and price impact should be minimal.

However, it is possible in times of volatility for the long and short open interest to be imbalanced leading to a high price impact.

Price impact rebates help to reduce the effect of this. Each market has a maximum price impact as a guideline; if a trade is closed with a price impact higher than this percentage then the additional impact would become claimable after approximately 10 days.

For example, if the maximum price impact for a market is 1% and a trade is closed with 3% negative price impact, then the collateral equivalent to 2% negative price impact would be claimable after a few days on the interface.

The purpose of having a delay of a few days is to guard against price manipulation attempts. In the case of a price manipulation attempt, rebates should be reviewed and only applied to accounts that were not involved in the price manipulation.

Note that this rebate only applies to closing / decreasing of positions; for opening / increasing of positions there is no maximum price impact. For market increase orders, the price impact would be shown on the interface so that users can decide if the impact is acceptable. For limit orders the acceptable price including any price impact must be met for the order to be executed.

#### Funding Fees[​](https://docs.gmx.io/docs/trading/v2#funding-fees) <a href="#funding-fees" id="funding-fees"></a>

There may be positive or negative funding fees while a position is open.

The funding fee rate can be viewed on the interface when making a trade. Note that the rate will change over time based on the balance of longs and shorts.

If you receive positive funding fees for your position, these fees can be claimed by using the "Claim" button in the "Claimable Funding" box of the  Trade page.

#### Adaptive Funding[​](https://docs.gmx.io/docs/trading/v2#adaptive-funding) <a href="#adaptive-funding" id="adaptive-funding"></a>

Funding rates gradually adjust over time based on the long and short ratio.

For example, if the total long open interest is larger than the short open interest then the funding rate that longs pay shorts will gradually increase until the difference between the long and short open interest is below a certain threshold or an upper limit is reached, at which time the funding rate will remain constant.

If in this scenario more shorts are opened or longs are closed such that there are now more shorts than longs then the funding rate that longs pay shorts will gradually decrease until the difference between the long and short open interest is below a certain threshold.

If there remains more shorts than longs then the funding rate will gradually adjust in the other direction such that shorts will pay longs a funding rate that gradually increases until the difference between the long and short open interest is below a certain threshold or an upper limit is reached.

#### Borrowing Fees[​](https://docs.gmx.io/docs/trading/v2#borrowing-fees) <a href="#borrowing-fees" id="borrowing-fees"></a>

To avoid a scenario where liquidity is fully reserved by a user opening equal long and short positions for a small cost, there is a borrowing fee for open positions. If there are more longs than shorts then longs would pay the borrowing fee, if there are more shorts than longs then shorts would pay the borrowing fee. This borrowing fee also helps to incentivise more liquidity to be added in the event that all liquidity is reserved for positions.

The borrowing fee rate can be viewed on the interface when making a trade. Note that the rate will change over time based on the pool utilization percentage.

#### Execution Fee[​](https://docs.gmx.io/docs/trading/v2#execution-fee) <a href="#execution-fee" id="execution-fee"></a>

There are two transactions involved in opening / closing a position:

* User sends the first transaction to request open / close / deposit collateral / withdraw collateral
* Keepers observe the blockchain for these requests then execute them

The cost of the second transaction is displayed in the confirmation box as the "Max Execution Fee". This network cost is paid to the blockchain network when the order is executed. This cost is overestimated to handle potential increases in gas price, when the order is executed, the excess execution fee is sent back to your account. The amount of overestimation can be configured using the "Settings" menu in the top right corner of the page.

#### One-Click Trading[​](https://docs.gmx.io/docs/trading/v2#one-click-trading) <a href="#one-click-trading" id="one-click-trading"></a>

One-Click trading can be enabled through the account menu in the top right of the interface.

Enabling this feature allows trading without requiring a wallet signing popup for each trade.

Safety features:

* Funds from decreasing positions, closing positions, swaps can only be sent back to your wallet account
* Trades can only be created without a signing popup up to the maximum authorized number, e.g. if you authorize 10 allowed actions, then after 10 trades a wallet signing popup is necessary to re-authorize the next 10 trades

Risks:

* This feature works by generating a subaccount that is stored locally on your browser, if your browser is compromised then the key could leak and a malicious user could create trades with high price impact in an attempt to profit from the compromise
* The maximum authorized number of trades would still apply, so even in a compromise, a malicious user can only create trades up to the previously authorized number

This feature can be disabled at anytime by clicking "Deactivate" in the One-Click Trading settings menu.

### Trading Risks[​](https://docs.gmx.io/docs/trading/v2#trading-risks) <a href="#trading-risks" id="trading-risks"></a>

Caution should be exercised when interacting with any smart contract or blockchain application. While risks are attempted to be mitigated through testing, audits and bug bounties, there is always a risk of vulnerabilities in smart contract code.

A non-exhaustive list of risks:

* Smart contract risks
* Liquidations
* ADLs

Additionally, collateral and profits may be backed by bridged or pegged tokens which may not be guaranteed to maintain peg.

### Arbitraging[​](https://docs.gmx.io/docs/trading/v2#arbitraging) <a href="#arbitraging" id="arbitraging"></a>

If pools are imbalanced for swaps or perps, arbitraging can be done to gain a profit while helping to balance the pools.

#### Swaps[​](https://docs.gmx.io/docs/trading/v2#swaps-1) <a href="#swaps-1" id="swaps-1"></a>

For swaps, positive price impact can be arbitraged.

For example, in the ETH-USDT pool, if the USD value of ETH in the pool is more than the USD value of USDT in the pool, then there would be a positive price impact to swap USDT for ETH. This positive price impact would result in additional ETH being received for a USDT to ETH swap.

#### Perps[​](https://docs.gmx.io/docs/trading/v2#perps) <a href="#perps" id="perps"></a>

For perps, positive price impact and funding fees can be arbitraged.

For example, if there are more ETH long positions than short positions then there would be a positive price impact to open ETH short positions, this would result in a better entry price than the current market price. The position would also earn funding fees while it remains open.

If in the same scenario, the ETH long positions close such that there are more shorts than longs, then there would be a positive price impact to close the long position, this would result in a better exit price than the current market price.

For markets where the index token is the same as the collateral token, e.g. using ETH collateral in the ETH perp market, delta neutral positions can be opened by using the collateral token to open a short position. Conversely, when arbitraging with long positions, a 1x long position can be opened using a stablecoin as collateral, this would lead to 1x exposure to the index token.

Note that funding will tend towards zero as the long / shorts become balanced, this should be considered when deciding on the position size to open for arbitrage.

### Direct URLs[​](https://docs.gmx.io/docs/trading/v2#direct-urls) <a href="#direct-urls" id="direct-urls"></a>

The ByteMX frontend supports direct URLs that pre-fill parameters, enabling users to share specific trading configurations.

#### Trade Parameters[​](https://docs.gmx.io/docs/trading/v2#trade-parameters) <a href="#trade-parameters" id="trade-parameters"></a>

**tradeType**[**​**](https://docs.gmx.io/docs/trading/v2#tradetype)

* The type of trade
* Allowed Values: `long`, `short`, `swap`

**mode**[**​**](https://docs.gmx.io/docs/trading/v2#mode)

* The mode of the trade
* Allowed Values: `limit`, `market`, `trigger` and `tpsl`

**from**[**​**](https://docs.gmx.io/docs/trading/v2#from)

* The token used for payment in the trade
* Allowed Values: Valid token symbol supported by the platform such as `eth`, `btc`, etc.

**to or market**[**​**](https://docs.gmx.io/docs/trading/v2#to-or-market)

* The asset to long, short or swap to
* Allowed Values: Valid token symbol supported by the platform such as `eth`, `btc`, etc.

**collateral**[**​**](https://docs.gmx.io/docs/trading/v2#collateral)

* The asset used as collateral for the trade
* Allowed Values: Valid token symbol supported by the platform such as `eth`, `usdt`, etc,

**pool**[**​**](https://docs.gmx.io/docs/trading/v2#pool)

* The liquidity pool where the trade is executed
* Allowed Values: Valid pool name/address supported by the platform such as `eth-usdt, btc-usdt`, etc.

#### BMX Pools Parameters[​](https://docs.gmx.io/docs/trading/v2#gm-pools-parameters) <a href="#gm-pools-parameters" id="gm-pools-parameters"></a>

**operation**[**​**](https://docs.gmx.io/docs/trading/v2#operation)

* Whether to buy or sell BMX tokens
* Allowed Values: `buy` or `sell`

**market**[**​**](https://docs.gmx.io/docs/trading/v2#market)

* The market to buy BMX tokens for
* Allowed Values: Valid market name supported by the platform such as `eth`, `btc`, `swap-only` etc. `swap-only` is used for listing the swap only markets for ByteMX.

**pools**[**​**](https://docs.gmx.io/docs/trading/v2#pools)

* The pool to buy BMX token for

**mode**[**​**](https://docs.gmx.io/docs/trading/v2#mode-1)

* The trade mode
* Allowed Values: `single` or `pair`

**from**[**​**](https://docs.gmx.io/docs/trading/v2#from-1)

* Token used for payment to buy BMX tokens
* Allowed Values: Valid token symbol supported by the platform such as `btc`, `eth`, `usdt`, etc.

**to**[**​**](https://docs.gmx.io/docs/trading/v2#to)

* The token to be received when selling BMX tokens
* Allowed Values: Valid token symbol supported by the platform such as `btc`, `usdt`, etc.
