Exchange-Specific Notes
-
Futu Securities
Supports Futu NiuNiu live trading and paper trading. You need to download theFutuOpenDsoftware.
When usingFutuOpenDto access paper trading, some stock codes are not supported and therefore cannot be traded, but the Futu NiuNiu mobile APP can perform paper trading.
For configuring exchange objects on the FMZ Quant platform and runningFutuOpenDsoftware, please refer to the Futu Securities Configuration Guide.-
API Call Frequency
ForGetOrder,GetOrders,GetPositions, andGetAccountfunctions, cached data is used 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.Calling
exchange.IO("refresh", true)function can disable caching. If caching is disabled, the call frequency is limited to a maximum of 10 queries per 30 seconds, and exceeding the frequency limit will result in an error. -
Stock Codes
Example:600519.SH- HK Hong Kong stocks
- US US stocks
- SH Shanghai stocks
- SZ Shenzhen stocks
Use the
exchange.SetContractType()function in 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())c++void main() { auto info = exchange.SetContractType("600519.SH"); Log(info); Log(exchange.GetAccount()); Log(exchange.GetTicker()); }The usage of the
exchange.SetDirectionfunction for setting trading direction,exchange.Buy/exchange.Sellorder functions,exchange.CancelOrdercancel order function,exchange.GetOrderquery order function, etc., are the same as in the futures market. -
Account Information Data Format:
UseTrdMarketto define the market, used to distinguish betweenHong Kong market,US market, andMainland market.Excerpt from
Futu APIdocumentation:javascriptconst ( 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 )When getting 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 login IP address
For accounts logged in from non-mainland IP addresses, there are restrictions when obtaining market data. Please refer to the officialFutuOpenD(Futu) documentation for details.
-
-
Interactive Brokers
Configuring the Exchange:
Using Interactive Brokers requires running "IB Gateway" or "TWS (Trader Workstation)" software on the system where the docker is located. Taking "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 check the "Enable ActiveX and Socket Clients" option. Note the "Socket Port" in the configuration (TWS default port is 7496 for live/7497 for paper trading).
- 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 port, for example:
localhost:7496.
Supported Markets:
- Currently only supports the US stock market, other futures, forex, and other markets are not supported yet.
- US stock market stock code format examples:
Apple Inc.'s stock code on the NASDAQ exchange:AAPL.US.
Tesla, Inc.'s stock code 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 Binance Futures
exchange.IO()switching functions (hedge mode, isolated/cross margin, unified account, STP mode, etc.), please refer to theexchange.IOfunction documentation. -
Futures_HuobiDM
- Switching 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 Huobi Futures
exchange.IO()switching functions (signHost, isolated/cross margin, one-way/hedge position mode, unified account, etc.), please refer to theexchange.IOfunction documentation. - Switching Address:
-
Huobi
-
Switching Special Trading Pairs:
Supports Huobi spot leveraged tokens, for example:LINK*(-3), the exchange-defined code is:link3susdt, when setting this trading pair on the FMZ Quant Trading platform, write it asLINK3S_USDT.
You can also switch trading pairs in the strategy:javascriptfunction main() { exchange.SetCurrency("LINK3S_USDT") Log(exchange.GetTicker()) }pythondef main(): exchange.SetCurrency("LINK3S_USDT") Log(exchange.GetTicker())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:
The exchange does not support querying current pending orders or querying market historical trade records, soGetOrdersandGetTradesfunctions are not supported.
- Unsupported Interfaces:
-
BitMEX
- Market Order Buy
In the BitMEX spot trading order interface, the order quantity for market buy orders is not the amount, but the number of trading coins.
- Market Order Buy
-
Bitfinex
- Market Order Buy
In the Bitfinex spot trading order interface, the order quantity for market buy orders is not the amount, but the number of trading coins.
- Market Order Buy
-
AscendEx
- Market Order Buy
In the AscendEx spot trading order interface, the order quantity for market buy orders is not the amount, but the number of trading coins.
- 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. - Switching 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 order timestamp, separated by a comma. This is 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 orderIdand other information locally, please separate out the actual orderIdfor recording.
- Order
-
Futures_dYdX
Currently supports dYdX v4 version, please refer to dYdX v4 User Guide. -
Futures_Hyperliquid
Please refer to Hyperliquid User Guide.For Hyperliquid Futures
exchange.IO()switching functions (isolated/cross margin, mainnet/testnet, vaultAddress, walletAddress, expiresAfter, etc.), please refer to theexchange.IOfunction documentation. -
Futures_Lighter
- Switching Test Environment:
The test environment can be set by checking the option 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 Futures_Lighter
exchange.IO()switching functions (isolated/cross margin, order expiration time, etc.), please refer to theexchange.IOfunction documentation. - Switching Test Environment: