With the development of quantitative trading of blockchain assets, more and more blockchain asset traders have recognized the tool of quantitative trading.
But as a beginner of this circle, he or she may be very confused about many concepts, and confused by various terms, software, information, etc. This article will take you to understand and familiarize with common concepts, and learn about various useful information in the quantitative transaction of blockchain assets from various aspects.
This article will summarize the basic concepts first, and then gives examples on the FMZ Quant Trading Platform corresponding to these basic concepts.

  • Exchange First of all, we need to understand the concept of exchanges. We need to trade the blockchain assets for speculation, investment, etc. Each of them need to be done on an exchange. There are many exchanges currently: senior, emerging, large and small. As for which exchange to conduct programmatic and quantitative trading, it is necessary to filter the information by yourself based on various information.
  • Account of exchange
    Account of exchange, is an account registered and opened at this exchange. Blockchain assets can be stored in this account for trading. Some exchanges can create and set sub-accounts under the main account to facilitate separate transactions and speculation of assets. The creation, mechanism, and use of sub-account applications for each exchange are different. So you need to check the information specifically on the exchange website or consult the exchange customer service. After logging in with an account on the exchange website, usually you can see that the place where blockchain assets can be stored is divided into multiple "accounts" (here is a logical account, not an exchange account). Usually divided into wallet account, currency trading account, financial management account, contract trading account and so on. The specifics may vary from exchang to exchang. Usually, after recharging the blockchain assets (currencies), it is under an account (may be in a wallet account, or to a currency exchange account directly). Therefore, you need to check where the assets are after recharging, and transfer them when you need (for example, when you need to trade in futures).
  • API interface to the exchange system
    Many users who have not used this exchange function may ask: "What is an API interface".
    The API interface is the interface given by the exchange system that allows program operations. Simply put, the exchange gives a channel to allow (real bot script) programs to place orders, cancel orders, check orders, check accounts assets, check positions, and other operations in the exchange system (a certain trading pair on the exchange website, make up your own mind here).
    The exchange API is divided into various types of interfaces, usually there are REST protocol interface and WebSocket protocol interface. Few exchanges also provide the FIX protocol interface. These are just for understanding, mostly we use the REST protocol interface. These interface documents can usually be found in the link with the word API at the bottom of the official website of the exchange. Sometimes it is necessary to check these documents for some interface error information. The API systems of each exchange are quite different, so you need to check the documentation for specific issues. If you're not a strategy developer, these are just for understanding.
  • API KEY of the account
    API KEY of the account must be carefully understood, because it's related to the security of blockchain assets stored in your exchange.
    The above said that the API interface is a channel, then the API KEY can be understood as the pass of the channel. Because of the access channel, you can't allow access to any program, which is very dangerous. Therefore, verification is required, and the API KEY is used to verify the identity. So the API KEY is related to the security of your assets and must be kept properly.
    Usually the API KEY of an exchange is created in the upper right corner of the exchange page, on the account management page (there may also be an exchange placed elsewhere on the web page, find the link with the "API" keyword and click it to find it). The API KEY has two strings, the first string is usually called access key, and the second string is usually called secret key. There are also some exchanges whose API KEY has other information, for example, the OKEX V5 and V3 interfaces have a PassPhrase, which is also a string (a string that needs to be set by yourself to strengthen security verification).
    When setting the API KEY, it is usually necessary to set the permissions of this API KEY, generally, there are permissions such as "transaction" and "withdrawal", which should be set according to the purpose of the API KEY, and the permission to withdraw coins needs to be used with caution. In addition to permissions, API KEY can also set an IP address whitelist. If you use an IP other than this IP address whitelist (IP address concept can be searched on Baidu if you do not understand) to access the interface, access will be denied (that is, networks outside the IP whitelist cannot access or operate your account).
  • Exchange objects
    The concept of exchange object is the concept on the FMZ Quant Trading Platform (FMZ.COM). Simply put, it refers to an object formed by the encapsulation of the exchange interface.
    This object is exchange in the FMZ strategy code, which calling the exchange.GetTicker function, actually it calls the interface for accessing the exchange market data.
    See the FMZ API documentation for details: https://www.fmz.com/api#exchange
    An exchange may have a futures sector and a spot sector. Since the futures exchange object and the spot exchange object defined on FMZ are different types of exchange objects, they are distinguished (the futures exchange object has several more functions than the spot exchange object, such as setting the leverage function, querying the position function etc., check the documentation for details).
    So take Binance exchange for an example, you may see it when configuring on FMZ:
    There are also 2 Huobi.
    /upload/asset/28d58042b7e68089eee80.png If the strategy is to operate on futures exchange objects, add futures, and if you want to operate spot, add spot. The reason for this design is that the exchange may have completely different futures and spot interfaces, and even different interface base addresses, so they are packaged separately. On the FMZ platform, exchange is an exchange object, which represents an exchange account. For details, please refer to: https://www.fmz.com/api#exchanges
  • ### Trading market
    The trading market mentioned here refers to a specific trading bot (imagine a trading page), usually the exchange has multiple sectors, such ascurrency trading, currency leveraged trading, contract trading etc.
  • Trading pairs
    What we usually call a "trading pair" is simply what we buy and sell, for example, we go to the market to buy cabbage. Then "cabbage_money" is the trading pair (underscore _ to split) the buyer pays for the cabbage, and the seller get the money. For a specific trading pair on the exchange, such as BTC_USDT, we buy in this trading pair, which means paying USDT to get BTC. The selling operation is to pay BTC to get USDT.
    Take BTC_USDT as an example, we usually call BTC as the trading currency and USDT as the denomination currency.
    • Trading currency, BaseCurrency.
    • Denomination currency, QuoteCurrency.
  • Spots
    Currency trading, currency leveraged trading, they are classified as spot trading. Spot trading only needs to specify the trading pair to describe which market it is traded on.
    Taking the use of the FMZ Quant Trading Platform for an example, if you want to make a trading pair of BTC to USDT, the trading currency is BTC, and the denomination currency is USDT.
    We use the function of the FMZ platform exchange.SetCurrency("BTC_USDT") to switch the current trading pair to: BTC_USDT.
    For SetCurrency for those who do not understand, refer to: https://www.fmz.com/api#exchange.setcurrency…
    For exchange for those who do not understand, refer to: https://www.fmz.com/api#exchange
  • Contracts (futures, options)
    There is a big difference between contract trading and spot trading. At present, exchange contracts are divided into currency-based contracts and USDT-based contracts. For programmatic trading and quantitative trading, it is necessary to determine not only the trading pair, but also the contract. For example, if we want to trade BTC currency, then there are many BTC currency contracts, including quarterly contracts (delivery due every quarter), weekly contracts (delivery due on Friday every week), perpetual contracts (non-delivery) and so on. If only one transaction pair is used for identification, what kind of contract is made? Therefore, a specific contract code is required to describe and determine.
    In this way, when we describe which contract market to trade in, we need to describe what currency (trading pair) and what contract (contract code) it is.
    • Currency-based contracts
      Contracts that use currency as margin (such as BTC currency-based contracts, which use BTC as margin, and the profit is also BTC), the profit is currency. Usually, the denomination currency of the trading pair of the currency-margined contract is expressed in USD (no need to go into details, most exchanges use this expression). So the trading pair is BTC_USD, and the contract is a quarterly contract. It means that the trading market we are talking about is the BTC's currency-based quarterly contract market.
      On the FMZ Quant Trading Platform, exchange.SetCurrency("BTC_USD") sets the trading pair, and then exchange.SetContractType("quarter") sets the quarterly contract. In this way, the current trading variety is BTC's currency-based quarterly contract.
    • USDT-based Contract
      Contracts that use USDT as margin (such as BTC's USDT-based contracts, which use USDT as margin, and the profit is also USDT), the profit is USDT. Usually, the denomination currency of the trading pair of the USDT-based contract is expressed in USDT. Therefore, the trading pair is BTC_USDT, and the contract is a perpetual contract. It means that the trading market we are talking about is the BTC's USDT-based perpetual contract market.
      On the FMZ Quant Trading Platform, exchange.SetCurrency("BTC_USDT") sets the trading pair, and then exchange.SetContractType("swap") sets the perpetual contract. In this way, the current trading variety is BTC's USDT-based perpetual contract.
  • Orders
    What does the order specifically refer to?
    An order is the order we submit to the exchange when we buy or sell on the exchange. Orders are divided into market orders, limit orders, conditional orders, etc. The most basic attributes of an order are: the object of the order (simply put, what to buy or sell), the quantity of the order (how much to buy or sell), and the price of the order (at what price to buy or sell). If the next order only determines the quantity to buy and sell and what to buy or sell regardless of how much money it is, then such an order is called a market order. Of course, there are also conditional orders (stop-loss orders, iceberg orders, etc.), which are related to the exchange. Some exchanges provide it, while some exchanges do not. For details, you can check the API documentation of the exchange.
    • Spots
      The market price list of spot orders usually need to pay attention to the buy orders. The order quantity of the market price list of spot orders is not the number of currencies, but the amount. Because the market order does not determine the price, only the amount can be used to determine how much to buy. The quantity of the market order sell order is the number of currencies, because even if the price is uncertain, how many currencies to sell can be determined.
    • Contracts
      The order quantity of a contract is special, usually the number of contracts. The contract order interface of the exchange is basically the number of contracts, and there is no interface that takes the number of currencies as the order quantity. Binance's USDT-based BTC perpetual contracts can order BTC perpetual contracts in an amount of 0.01, but it is not the number of currencies, it's the number of contracts, and one contract is exactly one BTC.
      Generally speaking, the order quantity is the number of contracts whether it's market order or limit order.
    • What is taker, maker order?
      A taker order is an order that provides liquidity, simply put, it means that the current market buy price is 10 and the sell price is 11. At this time, I place a buy order with a buy price of 9, or a sell order with a sell price of 12, at this time, I provided an order for the depth of the disk, and this order is maker. Still this example, if I place a buy order at a price of 11, at this time my order will be filled with a sell order at a price of 11 on the market. And I take an order from the market, this buy order I placed at that time was the taker order. For example, the order placing functions exchange.Sell and exchange.Buy encapsulated on the FMZ Quant Trading Platform encapsulate the common limit order and market order interfaces. When placing an order, whether the order is classified as a taker or a maker depends on the price of the order and the market at that time, and whether our order provides liquidity or reduces liquidity.
      When the price is passed in -1 on the FMZ Quant Trading Platform, it is to place a market order, note that the order amount of the spot market order buy order is the amount, then the market order is certainly a reduction in liquidity, and it must be a taker order.
    • Exchange conditional order mandate
      Many exchanges also support conditional orders, such as iceberg order, stop-loss order, take-profit order, post_only: only maker order , fok: complete the deal or cancel immediately, ioc: deal immediately and cancel the remaining, etc.
      These orders can use the exchange.IO function on the FMZ Quant Trading Platform to access the exchange order interface directly to specify the parameters (specify which conditional orders to place) to place an order. For the usage of the exchange.IO function, please refer to the FMZ API documentation: https://www.fmz.com/api#exchange.io…
  • Quantitative trading platform A quantitative trading platform can be regarded as a quantitative trading tool, it may be an online software system, may be a website, may be a local executable program, or it may even be an open source project on GITHUB. Simply put, you can think of it as a tool for quantitative trading.
  • FMZ Quant Trading Platform
    FMZ Quant Trading Platform is an online distributed system. For initial knowledge of the platform and tutorials, please refer to: https://www.fmz.com/bbs-topic/4145
  • Backtesting systems for quantitative trading platforms
    What is a backtesting system?
    Simply put, the backtesting system is to replay the historical data of a certain trading variety, and let a certain strategy be included in the playback, and get the trading performance of this strategy when simulating the historical data playback. Therefore, the backtesting system is just a sandbox environment (like the sand pile played by kids, it can create various things, but it is just a model, not related to the real thing), then the backtesting system can not have any function of the real exchange.
    Backtesting system on FMZ Quant Trading Platform:
    |Bitfinex|Spot exchange objects|Support limited trading pairs, such as: BTC_USD, ETH_USD, LTC_USD etc, note that the trading pair denominated currency is USD, which is USD denominated|
    |Binance|Spot exchange objects|Support limited trading pairs, such as: BTC_USDT, ETH_USDT, ETH_BTC, LTC_BTC etc.|
    |OKEX|Spot exchange objects|vsuch as: BTC_USDT, ETH_USDT, ETH_BTC, LTC_BTC etc.|
    |Huobi|Spot exchange objects|Support limited trading pairs, such as: BTC_USDT, ETH_USDT, ETH_BTC, LTC_BTC etc.|
    |OKEX futures|Futures exchange objects|Support limited trading pairs, such as: BTC_USD, ETH_USD etc, the trading pair denomination currency is USD. After setting the specific contract code (refer to the exchange.SetContractType function), the contract is a currency-based contract|
    |HuobiDM|Futures exchange objects|HuobiDM is Huobi futures (Huobi contracts), supporting limited trading pairs, such as: BTC_USD,ETH_USD etc, the trading pair denomination currency is USD. After setting the specific contract code (refer to the exchange.SetContractType function), the contract is a currency-based contract|
    |BitMEX|Futures exchange objects|The trading pair is: XBT_USD. After setting the specific contract code (refer to the exchange.SetContractType function), the contract is a currency-based contract|
    |Binance futures|Futures exchange objects|Support limited trading pairs, such as: BTC_USDT, ETH_USDT etc, the trading pair denomination currency is USDT. After setting the specific contract code (refer to the exchange.SetContractType function), the contract is a USDT-based contract|
    |Deribit options|Options exchange objects|The trading pair is: BTC_USD, ETH_USD. After setting the specific contract code (refer to the exchange.SetContractType function), the contract is a currency-based contract|
  • API KEY of the quantitative trading platform
    The exchange has API interfaces, and the quantitative trading platform also has API interfaces. Taking the FMZ Quant Trading Platform as an example, the API interface of FMZ is called Extended API, some functions of the FMZ platform can be operated programmatically, for example, create real bots in batches, start real bots in batches, modify the configuration of real bots in batches, etc, for details, please refer to: https://www.fmz.com/api#fmz%E5%B9%B3%E5%8F%B0%E6%89%A9%E5%B1%95api
    The extension API can also be used to do something interesting, such as Using the FMZ Quant Trading Platform extension API to implement TradingView alarm signal trading
  • Programmatic trading script Having said that, what exactly is controlling my exchange account for trading automatically?
    This is the specific embodiment of programmatic trading and quantitative trading - programmatic trading scripts. These real bot programs can be written in various languages. For example, the FMZ Quant Trading Platform supports writing real bot trading strategies in JavaScript, Python, and C++ languages. These script programs carry out various operations such as buying and selling of an account through the API interface of the exchange.
  • The device on which the programmatic trading script runs
    The real bot script program must have a device carrier (in short, the real bot must have a place where it runs). Quantitative transactions usually deploy the real bot program on the Alibaba Cloud server in Hong Kong (of course, you can also use servers from other places, other operators). In view of the fact that many exchanges require overseas network access currently, it is impossible to run many exchange API interfaces by using domestic servers. Generally speaking, if the interface is not accessible, an error timeout will be reported.
    On FMZ platform, you can usually deploy your own software program on the Hong Kong Alibaba Cloud server (the real bot carrier software of the FMZ Quant Trading Platform is called [docker], and the real bot of quantitative trading is run based on the docker software).
    • Equipment systems
      Various operating systems, such as windows/Linux/MAX OS/ARM Linux, etc., are selected according to the actual script.
      On FMZ platform, the server of the Linux system is usually used. The use of the Linux system is not complicated actually. The simple use only needs to master a few commands, these are explained in the FMZ tutorial.
  • Choice of scripting language
    There are too many programming languages, and almost all of them can be used to write real bot script programs.
    Here we will also take the FMZ Quant Trading Platform as an example to understand the advantages of various languages. On FMZ platform, we can write strategies (robot scripts) in the following programming languages
    • JavaScript
      It is easy to use, and it's almost independent from the device environment, it supports the ES6 standard. Strategy program execution speed is second only to C++ strategy. (recommended for beginners on FMZ Quant Trading Platform)
    • Python
      It depends on the device environment to a certain extent, and various libraries can be installed, with a high scalability. (Recommended for students who are familiar with FMZ platform and Python)
    • C++
      The strategy has the fastest execution speed, the highest efficiency, but it's more difficult to use.
      After familiar with it, other programming languages are so easy!.
    • MyLanguage
      MyLanguage supported by FMZ platform is the most basic command.
    • MyLanguage applies to write some trending strategies
    • When a trading signal appears in MyLanguage, while executing a trading order, it can only take orders, and does not support pending orders.
    • MyLanguage is suitable for the strategy of making a single exchange object (only one exchange object can be controlled. Although MyLanguage on FMZ platform supports embedding JS code, it is a bit difficult for beginners, so it will not be talked for now)
    • MyLanguage is only suitable for single-variety strategy. It is recommended to use JavaScript, Python, and C++ for multi-variety strategy design.
    • Information related to the use of the MyLanguage on FMZ platform:
    • Visual module splicing strategy
      The strategy of visual creation is only used to enhance interest and understand program logic. It can be used to create some simple logic, but it is not applicable when the strategy is a little complex, because it is difficult to maintain, expand, and design complex logic.

Leave a Reply

Your email address will not be published. Required fields are marked *