Exchange
The Exchange page is used to manage and display currently configured exchanges. In the FMZ Quant Trading Platform, "Exchange" is a core concept that refers to an object containing API key configurations, communication protocols, and interface encapsulations for fund accounts that can be operated by strategy programs.
On the Exchange Management page, click the "Add Exchange" button to navigate to the Add Exchange page, where you can select and fill in configuration information according to your needs. All configuration information is encrypted locally and stored on the FMZ Quant Trading Platform, so the platform does not record any plaintext data.
Exchange Object
Configured exchanges correspond to the exchange object at the strategy code level. For details, please refer to exchange in the "Syntax Manual".
When configuring backtesting or live trading, you can add multiple exchanges. Therefore, at the strategy code level, there exists an exchanges object array (array of exchange objects). For details, please refer to exchanges in the "Syntax Manual".
Using Exchange Objects
In strategy code, you can call exchange objects to perform operations such as account queries, market data retrieval, order placement, and order cancellation. Using JavaScript as an example:
javascript
function main() {
let account = exchange.GetAccount() // Query account information
let ticker = exchange.GetTicker() // Get ticker market data
let id = exchange.Buy(1000, 1) // Price is 1000, order quantity is 1
exchange.CancelOrder(id) // If the order is not filled, it can be cancelled
}