Skip to content
All library documents

Writing FMZ Trading Strategies in Rust: APIs, Lifecycle, and Dependencies

Article FMZ guides

Summary

This guide explains practical differences between writing FMZ trading strategies in Rust and JavaScript. Rust API calls that can fail return a result type, so the strategy must handle errors, for example by matching success explicitly or using the platform retry macro. The guide also describes the strategy entry point, optional initialization and shutdown hooks, and which logging and utility features are macros versus ordinary functions.

It covers how interface parameters are injected as typed global constants, how to parse JSON returned by platform APIs, and options for constructing JSON output. For external crates, dependencies are declared in source-file frontmatter. The compilation environment lacks system OpenSSL, so the guide recommends TLS libraries implemented in Rust and points to the built-in dialing function for WebSocket connections. This is platform implementation documentation rather than trading research: it explains how to build and operate strategy code, but provides no trading method, market analysis, or performance evidence.

Key ideas

  • Potentially failing Rust API calls return results that strategies should handle explicitly.
  • The platform calls the strategy entry point and can invoke optional startup and shutdown hooks.
  • Several platform utilities are Rust macros, while others are regular functions.
  • Configured strategy parameters are injected as global constants with types based on their values.
  • The guide describes JSON parsing and recommends Rust-based TLS dependencies in the compilation environment.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.