Mastering Everything - Introduction to FMZ New Version of Trading Terminal (with TRB Arbitrage Source Code)
Tags: arbitrage, trading, code, fmzquant
Published: 2024-05-29 06:46:31

After many weeks of intense development, the new version of FMZ's trading terminal is online finally. It is supported by both the web page and the mobile APP. It is definitely the most powerful and convenient. Everyone is welcome to experience and give feedback. The trading terminal is still evolving.

### The Original Intention of Improving The Trading Terminal
The trading terminal of FMZ Quant only had a simple trading interface at the begining, which was only for temporary use by programmed traders. But after so many years, users have more and more exchange accounts and sub-accounts. It is very inconvenient to log in to the exchange for management. They need to switch accounts frequently and cannot operate on the same page. In order to solve the problem, FMZ took advantage of the flexibility of the framework to develop a new enhanced version of the trading terminal to facilitate everyone's needs such as assisting transactions and managing multiple accounts.

### Introduction to the New Version of Trading Terminal
  1. Docker-Exchange-Trading Pair Group Binding
This function is the core function of the trading terminal. Click on the small square with color and number in the upper right corner of each module to enter the page below. The number represents the group ID, and the color makes it easy to visually determine which group it belongs to. Click to enter the group details to set up the group.

Users can set up groups for commonly used exchanges and trading pairs in advance (for KEY bound to IP, pay attention to binding the correct docker). If the group binding information of a module is modified, the group information on the terminal page will be refreshed. After the grouping is completed, the data will be saved and can be used directly next time you enter.

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

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

  2. Free layout of transaction information plug-in
This is another core feature. Click the puzzle icon in the upper right corner to operate. Information generally required for trading such as K-line data, order book, transaction order flow, account information, position information, orders, etc. The trading terminal displays various information on the trading interface into separate module plug-ins, which can be added and used as needed. Individual module layouts are also draggable and resizable. Combined with the previous group binding function, the flexibility is maximized. For example, you can watch the K-line prices of different currencies in multiple trading accounts at the same time, or you can trade different exchanges on one page.

Imagine that: With a large-screen monitor, you can stare at more than a dozen currencies at the same time, and open multiple sub-accounts to trade at any time. There is no need to switch browser tabs or switch accounts. This is also very convenient for manual traders.

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

  3. Tool plugin
Click on the tool in the system plug-in, and you can see the plug-in officially prepared by FMZ, which can be understood as a small program. Such as the cool order flow display chart, one-click query of the capital rate summary of mainstream exchanges, etc. It is highly recommended that everyone try it. Users can also write their own plug-ins and define the functions they want. See the article (https://www.fmz.com/digest-topic/5957) for detailed introduction.

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

  4. Other details
For market information, mainstream exchanges support obtaining websocket data push through the browser. The experience is consistent with logging into the exchange, and data updates quickly and instantly. Some information can also be refreshed at fixed periods, such as account information, etc., by accessing the API through the docker and then returning it. Defined layouts can be imported and exported.

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

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

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

### TRB Arbitrage in Action
In order to write this article, I prepared a set of arbitrage layouts for display. Unexpectedly, I encountered a rare arbitrage market in TRB as soon as I set it up. Since the Binance TRB funding rate is charged once every 4 hours, each time -2%, while the OKX charge is once every 8 hours, each time -1.5% (later changed to -2%), so if you go long on Binance permanently, go short on OKX permanently. Theoretically, you can get 2*6-1.5*3 = 7.5% of the capital rate income of a single exchange every day.

Due to the excellent liquidity of the OKX and Binance trading pairs, large positions can be opened. However, the low circulation of TRB is actually highly controlled. Everyone knows what happens next. The big drama at the beginning of 2024: Binance went from more than 250 to a maximum of 555, and OKX once rose to 738. Such a huge price difference and increase, even 1x leverage arbitrage still faces the risk of liquidation. During this period, the price difference that was once stable was 50 USDT. At this time, if you go long Binance and go short OKX on the perpetual contract, you can get a very stable price difference arbitrage opportunity.

I woke up and the spread had reduced to 30-20. If such an arbitrage opportunity is operated manually, one needs to go back and forth between OKX and Binance, and the price difference changes all the time. Even a delay of a few seconds is very disadvantageous, and the exclusive arbitrage layout of my trading terminal comes in handy. I watch TRB's market prices on OKX and Binance on one page at the same time, and put the trading modules together so that I can open positions at close to the same time.

In the end, the price difference fell back to less than 10, so I didn't have to be so anxious to close the position, and I wrote a small strategy to close the position, and gradually closed it when the price difference was 5 yuan. I was too timid to open a large position, and finally made about 5,000U. This small strategy to assist in arbitrage between Binance and OKX perpetual has been made public. It can automatically check and open and close positions according to the set price difference. When the market changes quickly, it is faster and more stable than manual operation. Public address: https://www.fmz.com/strategy/437254.

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

### Summary
A workman must first sharpen his tools if he is to do his work well. The new version of FMZ trading terminal is such a sharp tool, which is not only convenient for programmed traders, but also for manual traders. And feedback is welcome.

From: https://blog.mathquant.com/2024/01/05/mastering-everything-introduction-to-fmz-new-version-of-trading-terminal-with-trb-arbitrage-source-code.html