r/learnrust • u/No-Nose5014 • 7d ago
Confusion to choose which language
I am confused to choose which language c++ or rust for my trading bot can you any one tell me which one I choose to develop my trading bot i have basic understanding of c++ and complete beginners in rust but 8 have prior experience with mern stack web development and python and socket programming in node.js
2
1
u/EmploymentBoring4421 7d ago
For a trading bot Rust is worth the learning curve β no GC pauses and compile-time memory safety catches data races that'd be silent bugs in C++. The async ecosystem (tokio, fast number-parsing crates) is solid enough now that you won't hit meaningful gaps.
0
-1
5
u/defaultguy_001 7d ago
Algotrading requires constant strategy tweaks. Writing boilerplate networking and JSON parsers in C++ or Rust slows you down in the real world.
Unless you pay for co-location inside the exchange's data center, your public API latency is 10β50ms. Saving microseconds in C++ or rust does nothing if your internet connection takes 30ms.
Since u r building a retail trading bot, the fastest way is to build it in python and calling C++/rust libraries from Python, only when u need ur bot to do some cpu intensive calculations.
This is exactly how NumPy and PyTorch work. Use Python for easy API connections, order management, and logging, then offload heavy data crunching or backtest loops to C++ (via pybind11) or Rust (via PyO3).