Exchange-Specific Notes
-
Futu Securities
Supports Futu Niuniu live trading and simulated (paper) trading. You need to download theFutuOpenDsoftware.
When usingFutuOpenDto access simulated trading, some stock codes are not supported and therefore cannot be traded; however, the Futu Niuniu mobile APP supports simulated trading.
For operations such as configuring the exchange object on the FMZ Quant platform and running theFutuOpenDsoftware, please refer to the Futu Securities Configuration Documentation.-
Interface Call Frequency
TheGetOrder,GetOrders,GetPositions, andGetAccountfunctions use cached data by default, so there is no call frequency limit.
When new data is available,FutuOpenDwill automatically update the data, and the cached data will be synchronized accordingly.Calling the
exchange.IO("refresh", true)function can disable the cache; after disabling the cache, the call frequency is limited to a maximum of 10 queries within every 30 seconds, and exceeding this frequency limit will report an error. -
Stock Codes
For example:600519.SH- HK Hong Kong stocks
- US US stocks
- SH Shanghai stocks
- SZ Shenzhen stocks
Use the
exchange.SetContractType()function in the strategy code to set the stock code, for example:javascriptfunction main() { var info = exchange.SetContractType("600519.SH") // Set to stock 600519.SH (Moutai), account switches to mainland market Log(info) Log(exchange.GetAccount()) // Current stock is Moutai, calling GetAccount function gets account assets for mainland market Log(exchange.GetTicker()) // Get current price information for Moutai stock }pythondef main(): info = exchange.SetContractType("600519.SH") Log(info) Log(exchange.GetAccount()) Log(exchange.GetTicker())rustfn main() { let info = exchange.SetContractType("600519.SH"); // Set to stock 600519.SH (Moutai), account switches to mainland market Log!(info); Log!(exchange.GetAccount()); // Current stock is Moutai, calling GetAccount function gets account assets for mainland market Log!(exchange.GetTicker(None)); // Get current price information for Moutai stock }c++void main() { auto info = exchange.SetContractType("600519.SH"); Log(info); Log(exchange.GetAccount()); Log(exchange.GetTicker()); }The function for setting the trading direction
exchange.SetDirection, the order placement functionsexchange.Buy/exchange.Sell,
the order cancellation functionexchange.CancelOrder, the order query functionexchange.GetOrder, etc., are all used in the same way as in the futures market. -
Account Information Data Format:
UseTrdMarketto define the market, in order to distinguish between theHong Kong market,US market, andMainland market.Excerpted from the
Futu APIdocumentation:const ( TrdMarket_TrdMarket_Unknown TrdMarket = 0 //Unknown market TrdMarket_TrdMarket_HK TrdMarket = 1 //Hong Kong market TrdMarket_TrdMarket_US TrdMarket = 2 //US market TrdMarket_TrdMarket_CN TrdMarket = 3 //Mainland market TrdMarket_TrdMarket_HKCC TrdMarket = 4 //Hong Kong Stock Connect market TrdMarket_TrdMarket_Futures TrdMarket = 5 //Futures market )To obtain account information data, the
exchange.GetAccount()function returns:json{ "Info": [{ "Header": { ... // Omitted "TrdMarket": 1 // Market ID in Info raw data, indicates account assets for Hong Kong market trading }, "Funds": { // Account asset information in this market ... } }, ...], "Stocks": 0, "FrozenStocks": 0, "Balance": 1000000, // Asset value in current market "FrozenBalance": 0 } -
FutuOpenDdistinguishes regions based on the logged-in IP address
Accounts logged in with a non-Mainland IP address will be restricted when obtaining market data. For details, please refer to the officialFutuOpenD(Futu) documentation.
-
-
Interactive Brokers
Configure the exchange:
To use Interactive Brokers, you need to run the "IB Gateway" or "TWS (Trader Workstation)" software in the system environment where the docker (hosting node) is located. Here we take the "TWS" software as an example. After running "TWS" and logging in, click the configuration button in the upper right corner of the software to open the software configuration interface.- Select: "Configuration" -> "API" -> "Settings", do not check the "Read-Only API" option, and you need to check the "Enable ActiveX and Socket Clients" option; note the "Socket port" in the configuration (the default TWS port is 7496 for live / 7497 for simulation).
- On the platform's add exchange page "https://www.fmz.com/m/platforms/add", select Interactive Brokers, and configure the parameters. In the "Server Address" configuration item, fill in the address corresponding to the "TWS" software (such as 127.0.0.1 or localhost) and the port, for example:
localhost:7496.
Supported markets:
- Currently only the US stock market is supported; other markets such as futures and forex are not yet supported.
- Example of US stock market stock code format:
The stock code of Apple Inc. on the NASDAQ exchange:AAPL.US.
The stock code of Tesla, Inc. on the NASDAQ exchange:TSLA.US.
-
Futures_Binance
Supports Binance's Chinese trading pairs:javascriptfunction main() { let ticker = exchange.GetTicker("币安人生_USDT.swap") Log("ticker:", ticker) // {"Info":{...},"Symbol":"币安人生_USDT.swap","Open":0.29622,"High":0.31661, ...} }For the
exchange.IO()switching functions of Binance Futures (dual-side position mode, isolated/cross margin, unified account, STP mode, etc.), please refer to theexchange.IOfunction documentation. -
Futures_HuobiDM
- Switch address:
Useexchange.IO("base", "https://xxx.xxx.xxx")orexchange.SetBase("https://xxx.xxx.xxx")to switch the base address of the exchange interface.
Supports Huobi's Chinese trading pairs:
javascriptfunction main() { let ticker = exchange.GetTicker("币安人生_USDT.swap") Log("ticker:", ticker) // {"Info":{...},"Symbol":"币安人生_USDT.swap","Open":0.29622,"High":0.31661, ...} }For the
exchange.IO()switching functions of Huobi Futures (signHost, isolated/cross margin, one-way/two-way position mode, unified account, etc.), please refer to theexchange.IOfunction documentation. - Switch address:
-
Huobi
-
Switch special trading pairs:
Supports Huobi spot leveraged tokens, for exampleLINK*(-3); the code defined by the exchange islink3susdt, and when setting this trading pair on the FMZ Quant trading platform it is written asLINK3S_USDT.
You can also switch the trading pair within the strategy:javascriptfunction main() { exchange.SetCurrency("LINK3S_USDT") Log(exchange.GetTicker()) }pythondef main(): exchange.SetCurrency("LINK3S_USDT") Log(exchange.GetTicker())rustfn main() { exchange.SetCurrency("LINK3S_USDT"); Log!(exchange.GetTicker(None)); }c++void main() { exchange.SetCurrency("LINK3S_USDT"); Log(exchange.GetTicker()); }
Supports Huobi's Chinese trading pairs:
javascriptfunction main() { let ticker = exchange.GetTicker("币安人生_USDT") Log("ticker:", ticker) // {"Info":{...},"Symbol":"币安人生_USDT","Open":0.29622,"High":0.31661, ...} } -
-
Futures_Bibox
- Unsupported interfaces:
This exchange does not provide interfaces for querying current pending orders or querying market historical trade records, so theGetOrdersandGetTradesfunctions are not supported.
- Unsupported interfaces:
-
BitMEX
- Market order buy
In the BitMEX spot trading order placement interface, the order quantity for a market buy order is not the amount, but the number of coins to trade.
- Market order buy
-
Bitfinex
- Market order buy
In the Bitfinex spot trading order placement interface, the order quantity for a market buy order is not the amount, but the number of coins to trade.
- Market order buy
-
AscendEx
- Market order buy
In the AscendEx spot trading order placement interface, the order quantity for a market buy order is not the amount, but the number of coins to trade.
- Market order buy
-
Futures_Phemex
- K-line interface
The data returned by this exchange's K-line interface does not include the current Bar data. - Switch isolated/cross margin:
This exchange does not provide an interface for switching cross/isolated margin; it needs to be set on the exchange side.
- K-line interface
-
Futures_Aevo
- Order
Iddescription:
This exchange's orderIdconsists of the actualIdand the order timestamp, separated by an English comma, in order to support theexchange.GetOrder(Id)function for querying orders. Since the order timestamp in the data returned by the exchange changes with the order status, if you need to record information such as the orderIdlocally, please separate out the actual orderIdbefore recording it.
- Order
-
Futures_dYdX
Currently supports the dYdX v4 version. Please refer to the dYdX v4 User Guide. -
Futures_Hyperliquid
Please refer to the Hyperliquid User Guide.For the
exchange.IO()switching functions of Hyperliquid Futures (isolated/cross margin, mainnet/testnet, vaultAddress, walletAddress, expiresAfter, etc.), please refer to theexchange.IOfunction documentation. -
Futures_Lighter
- Switch test environment:
The test environment can be selected and set when configuring the exchange object, or you can use theexchange.SetBase()function to modify the REST API endpoint to switch to the test environment.
For the
exchange.IO()switching functions of Futures_Lighter (isolated/cross margin, order expiration time, etc.), please refer to theexchange.IOfunction documentation. - Switch test environment: