High frequency trading (HFT) applications require extremely low latencies and high performance to ensure that trades are executed quickly and accurately. As a result, choosing the correct programming language is crucial for the success of an HFT system.
One language that is well-suited for HFT applications is Rust. Rust is a systems programming language that was designed to be fast, safe, and concurrent. In addition, it has a unique ownership and borrowing system that allows for efficient memory management without needing a garbage collector, which can reduce latencies and improve performance.
In addition to its performance benefits, Rust offers strong safety guarantees that can help prevent errors and reduce the risk of financial losses. Its macro system and rich standard library also make it a versatile language that can be used to build a wide range of applications.
Quick setup
- Install rust
- Check version:
rustc --version
- To show active/installed toolchains
rustup show
- To update rust run
rustup update nightly
- To update rust stable toolchain run
To change the default toolchain
rustup
default nightly` - To install specific nightly toolchains
rustup toolchain install nightly-2021-08-20
- Update dependencies in a package
cargo update
Useful dev packages
To install globally via cargo install <package>
- cargo-edit to add
cargo-add
,cargo-rm
,cargo-upgrade
commands - cargo-watch to watch for changes and reload during development
- cargo-outdated to check for outdated packages.
Once installed, simply
cargo outdated
- cargo-expand for macro expansion.
References
Here are a few references for Rust programming:
- Rust lang - entry point to rust language
- Rust book - how rust works and its paradigms
- Rust source code - hosted on github
- Rust reference - for the syntax
- Rust std - standard library documentation
- Rust design patterns - a catalogue of Rust design patterns, anti-patterns and idioms
- Awesome Rust - a curated list of Rust code and resources
- Scientific computing - collections of crates for scientific computing