FMZ Mobile APP Trading Terminal, empowering your quantitative trading experience
Tags: trading, fmzquant, terminal, cryptocurrency
Published: 2024-05-24 07:42:55

In the field of quantitative trading, simple and easy-to-use quantitative trading tools have always been one of the keys to achieving wealth growth and risk management. However, with increasing market competition, traditional trading tools are no longer sufficient to meet rapidly changing market demands. To maintain a competitive edge for quantitative traders in the constantly evolving digital asset world, FMZ Mobile App has added a significant new feature: Trading Terminal. This feature will not only improve your trading efficiency, but also empower you through custom plugin programs to assist in trading, injecting new vitality into your trading career.

## Beginner's Guide to Trading Terminal:
### What is the FMZ Mobile APP Trading Terminal?
On the FMZ Quant Trading Platform, you can download the FMZ Quant Mobile APP from the [Mobile App download page](https://www.fmz.com/mobile). After downloading and installing, open the FMZ mobile app and log in with your FMZ account.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fh9kjw3dvfc47lax7wce.jpg)

Please note that FMZ Quant is divided into FMZ.COM international site and FMZ.CN China domestic site (supporting different markets). When logging in, you need to choose the corresponding site. Accounts for different sites are independent and not interchangeable.

The FMZ Quantitative Trading Platform mobile APP trading terminal is a quantitative trading tool that encapsulates APIs from major exchanges. It allows quick switching between various exchanges, and with the help of various features of the FMZ platform, it can perform data capture analysis, real-time data monitoring, program-assisted trading, semi-automatic/manual trading operations etc.

### How to access and enable the trading terminal function?
After logging into the FMZ Quant Mobile APP, you can see the "Trading Terminal" function on the main interface. Click to enter the trading terminal interface.

Before FMZ launched its mobile APP trading terminal, FMZ's web version had already launched this feature quite early. Whether it is a web-based trading terminal or a mobile APP-based one, **at least one docker program must be deployed**.
This is because all actual requests sent to exchanges are executed from the docker, not on the mobile app, which is safer. It also avoids disadvantages such as API KEY binding IP addresses and inability to use when mobile IP changes.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1yfvgthv5mp40k1u2mkb.png)

### Detailed Explanation of Trading Terminal Interface
**1. Main Interface of the Trading Terminal:**

After opening the trading terminal, you can see the main interface of the trading terminal. Clicking on the area in red frame will open up "Docker", "Exchange", and "Markets" configuration interfaces.

- Docker: All docker programs deployed under your current FMZ account will be listed here for selection.
- Exchange: The exchange objects (configured with API KEY information etc.) created in your current FMZ account will also appear in corresponding lists for specific operation selections.
- Markets: Set up the trading pair or contract that this trading terminal is going to operate. The input box widget for trading pairs will display selectable trading pairs/contracts based on entered information.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sqmr23nbzslzm70nqqqc.jpg)

**2. Trading Zone:**

The Trading Zone displays market depth data;
Trading widgets can be set with order price, order quantity, order direction, leverage and other settings.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dfmgsuamfn0pbe90e4we.jpg)

The bottom tabs of the main interface display information such as "Orders", "Assets", making your funds, and orders clear at a glance.

**3. K-line Chart:**

If you wish to view the K-line chart while placing an order, a thoughtful design has been implemented here - a collapsible display widget that unfolds the mini K-line chart of the current product.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tjq7rptc8nm79u4t5dj3.png)

If you wish to view the K-line chart in a larger area, display market transaction records, depth information and more, you can click on this K-line icon to jump to the professional K-line chart page.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8zdwhkafc6hh4c5leclc.png)

The professional K-line chart interface:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wvmusnr4qqt43hn1783l.png)

The professional K-line chart interface can also be displayed in landscape mode:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/819r0yompo3i0ovrj83z.png)

### Trading Plugin
What can a trading terminal plugin do?

- Real-time market data calculation and display.
- Order placement and order management.
- Implement risk management.
- Semi-automatic auxiliary trading strategies.

Which programming languages and tools are used to develop plugins?

- python
- javascript
- c++

What can you get?

- Share your plugin with the community for mutual learning with developers.
- Learn from other developers and get inspired.
- Interact with other quantitative trading enthusiasts.

### Give an Example Based on a Real-life Application Scenario:
In the FMZ community, a user has put forward such a request:

> Use js to traverse all U contract currencies of the Binance exchange, and open a position of 10u (long) for each currency. How is this code written?

This requirement scenario can be implemented with trading terminal plugins actually, and running plugin strategies on the trading terminal is free of charge. Compared to long-term live trading strategies, using trading terminal plugins as an aid is undoubtedly a good choice.

Let's see how to design and implement the user's request.

Firstly, we need to create a trading terminal plugin and add three parameters to its strategy:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/agy3yxmkowin1wavzou3.png)

Then start writing the plugin program:

```
function main() {
    let exName = exchange.GetName()
    if (exName != "Futures_Binance") {
        return "not support!"
    }

    let apiBase = "https://fapi.binance.com"
    if (isSimulate) {
        apiBase = "https://testnet.binancefuture.com"        
        Log("Switch base address:", apiBase)
    }
    exchange.SetBase(apiBase)
    
    try {
        var obj = JSON.parse(HttpQuery(apiBase + "/fapi/v1/exchangeInfo"))
    } catch (e) {
        Log(e)
    }
    
    let pairs = []
    for (var i in obj.symbols) {
        if (obj.symbols[i]["status"] !== "TRADING" || obj.symbols[i]["quoteAsset"] !== "USDT") {
            continue
        }
        let = pair = obj.symbols[i]["baseAsset"] + "_" + obj.symbols[i]["quoteAsset"]
        pairs.push(pair)
    }
    
    let markets = _C(exchange.GetMarkets)
    for (var i in pairs) {
        // /*
        // For testing purposes, only 10 varieties are opened here. If all varieties are needed, this comment content can be deleted.
        if (i >= 9) {
            break
        }
        // */

        let pair = pairs[i]
        exchange.SetCurrency(pair)
        exchange.SetContractType("swap")
        let ticker = exchange.GetTicker()
        if (!ticker) {
            continue 
        }
        
        let = amountPrecision = markets[pair + ".swap"]["AmountPrecision"]
        exchange.SetDirection("buy")
        let amount = _N(qty / ticker.Last, amountPrecision)
        if (amount > 0) {
            exchange.Buy(-1, amount)
        }

        Sleep(100)
    }

    // Obtain all positions
    let pos = exchange.IO("api", "GET", "/fapi/v2/positionRisk")
    if (!pos) {
        return 
    }
    
    // View positions
    return pos.filter(item => Number(item.positionAmt) != 0)
}
```
After the trading terminal plugin is written, it can be tested:

In the trading terminal of the mobile APP, click on the '...' button to open the list of trading terminal plugins. All plugins in the strategy library of your current FMZ account will be displayed in this list for selection and use.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tlbt0o60abo0gb5wcfxe.png)

After completing the operation on the mobile APP, we use the following code to query the position of Binance's simulation bot:

```
function main() {
    let apiBase = "https://testnet.binancefuture.com"
    exchange.SetBase(apiBase)

    let pos = exchange.IO("api", "GET", "/fapi/v2/positionRisk")
    if (!pos) {
        return 
    }

    // View positions
    return pos.filter(item => Number(item.positionAmt) != 0)
}
```
Data found:

```
[{
	"symbol": "ETCUSDT",
	"entryPrice": "16.17",
	"unRealizedProfit": "0.08567881",
	"positionSide": "LONG",
	"updateTime": 1698420908103,
	"isolated": false,
	"breakEvenPrice": "16.176468",
	"leverage": "20",
	"adlQuantile": 3,
	"positionAmt": "0.65",
	"markPrice": "16.30181356",
	"liquidationPrice": "0",
	"maxNotionalValue": "400000",
	"marginType": "cross",
	"notional": "10.59617881",
	"isolatedMargin": "0.00000000",
	"isAutoAddMargin": "false",
	"isolatedWallet": "0"
}, {
	"positionAmt": "105",
	"markPrice": "0.09371526",
	"liquidationPrice": "0",
	"leverage": "20",
	"maxNotionalValue": "90000",
	"positionSide": "LONG",
	"isolatedWallet": "0",
	"symbol": "TRXUSDT",
	"updateTime": 1698420906668,
	"breakEvenPrice": "0.094497784",
	"isolatedMargin": "0.00000000",
	"isolated": false,
	"entryPrice": "0.09446",
	"adlQuantile": 1,
	"unRealizedProfit": "-0.07819770",
	"isAutoAddMargin": "false",
	"notional": "9.84010230",
	"marginType": "cross"
}, {
	"unRealizedProfit": "-0.00974456",
	"isAutoAddMargin": "false",
	"notional": "9.97449543",
	"isolatedWallet": "0.50309216",
	"updateTime": 1698420905377,
	"markPrice": "67.85371047",
	"isolatedMargin": "0.49334760",
	"adlQuantile": 2,
	"symbol": "LTCUSDT",
	"entryPrice": "67.92",
	"liquidationPrice": "64.91958163",
	"maxNotionalValue": "250000",
	"positionSide": "LONG",
	"isolated": true,
	"positionAmt": "0.147",
	"breakEvenPrice": "67.947168",
	"leverage": "20",
	"marginType": "isolated"
}, {
	"liquidationPrice": "1613.23261508",
	"marginType": "isolated",
	"isolated": true,
	"symbol": "ETHUSDT",
	"entryPrice": "1784.27",
	"markPrice": "1783.35661952",
	"isAutoAddMargin": "false",
	"positionSide": "LONG",
	"notional": "8.91678309",
	"leverage": "10",
	"maxNotionalValue": "30000000",
	"isolatedWallet": "0.89551774",
	"adlQuantile": 1,
	"positionAmt": "0.005",
	"breakEvenPrice": "1784.983708",
	"unRealizedProfit": "-0.00456690",
	"isolatedMargin": "0.89095084",
	"updateTime": 1698420900362
}, {
	"positionAmt": "17.1",
	"marginType": "cross",
	"isolatedWallet": "0",
	"adlQuantile": 2,
	"liquidationPrice": "0",
	"maxNotionalValue": "250000",
	"positionSide": "LONG",
	"isolated": false,
	"symbol": "EOSUSDT",
	"breakEvenPrice": "0.6432572",
	"updateTime": 1698420904257,
	"isolatedMargin": "0.00000000",
	"isAutoAddMargin": "false",
	"notional": "10.34550000",
	"entryPrice": "0.643",
	"markPrice": "0.60500000",
	"unRealizedProfit": "-0.64980000",
	"leverage": "20"
}, {
	"isolated": false,
	"adlQuantile": 1,
	"liquidationPrice": "0",
	"maxNotionalValue": "10000000",
	"notional": "9.73993328",
	"leverage": "20",
	"updateTime": 1698420901638,
	"symbol": "BCHUSDT",
	"entryPrice": "250.0",
	"markPrice": "243.49833219",
	"isAutoAddMargin": "false",
	"positionSide": "LONG",
	"positionAmt": "0.040",
	"breakEvenPrice": "250.1",
	"isolatedMargin": "0.00000000",
	"unRealizedProfit": "-0.26006671",
	"marginType": "cross",
	"isolatedWallet": "0"
}]
```
It can be seen that 6 positions have been opened, this is because when placing actual orders on the simulation bot, it's easy to trigger limit prices; in addition, due to the order amount of 10U, it's easy to trigger the minimum order amount limit of trading pairs; therefore a few trading pairs were not successfully ordered. 
If you need to use this in reality, more practical situations should be considered in order to optimize this plugin for better usage. The code here is only used for teaching and communication purposes.

### Other Interesting Built-in Plugins on FMZ
The FMZ Quant Trading Platform mobile app trading terminal has many interesting plugins. Come and explore together!

https://www.fmz.com/upload/asset/16b436307a4ce5c246c2.mp4

### The End
The new trading terminal feature of the FMZ mobile app will become your powerful assistant in the digital asset market, allowing you to respond more flexibly to market fluctuations and opportunities. No longer limited to traditional trading strategies, through custom plugin programs, you can create smarter, more efficient trading strategies that are better adapted to the market. Let's start this exciting new chapter of quantitative trading together and enhance your trading skills and profits.

From: https://blog.mathquant.com/2023/10/30/fmz-mobile-app-trading-terminal-empowering-your-quantitative-trading-experience.html