#fix #api #finance #trading #ctrade

ctrader-fix

A rust implementation of the cTrader FIX API

16 releases

new 0.4.8 Jun 1, 2023
0.4.7 May 31, 2023
0.3.10 May 16, 2023

#14 in Finance

Download history 26/week @ 2023-05-08 225/week @ 2023-05-15 14/week @ 2023-05-22 215/week @ 2023-05-29

480 downloads per month

MIT license

125KB
3K SLoC

cTrader FIX API in Rust

This repository is an unofficial Rust implementation of the FIX API in Rust for the cTrader trading platform

Built using the async runtime library, it provides an asynchronous and simple interface for interacting with the cTrader platform through the Financial Information eXchange (FIX) protocol.

This project is now ready for use. However, please note that it is still under active development and bugs may exist.

Cargo Features

This crate allows you to use tokio runtime featured in async-std by specifying features in your Cargo.toml. By default, it uses async-std with the attributes feature.

To use the crate with the default configuration, add the following line to your Cargo.toml:

ctrader-fix = "0.4.8"

To use a specific Tokio configuration, specify the feature like this:

ctrader-fix = { version = "0.4.8", features = ["tokio1"] }

Available Features

  • default: Uses async-std with the unstable feature.
  • tokio1: Uses async-std with the unstable and tokio1 features.
  • tokio02: Uses async-std with the unstable and tokio02 features.
  • tokio03: Uses async-std with the unstable and tokio03 features.

Please note that you should only enable one of these features at a time.

Progress

Below is the current progress on the development of this project:

  • Base FixApi implementation ✅
  • Base requests ✅
  • Example code ✅
    • Connect ✅
    • Send logon ✅
    • Send logout ✅
    • Disconnect ✅
  • Handle responses ✅
    • Implement response structure ✅
    • Implement response handler - notify ✅
  • Add Error struct using thiserror
  • MarketClient ✅
    • Internal Market data Callback ✅
    • Parsing response message ✅
    • Subscribe the symbol for spot ✅
    • Implement the check the request has accepted method ✅
    • Test for parsing market datas ✅
    • Unsubscribe the symbol for spot ✅
    • Subscribe the symbol for depth ✅
    • Unsubscribe the symbol for depth ✅
    • Parsing the spot market data in callback ✅
    • Add quote spot data method ✅
    • Parsing the depth market data in callback ✅
    • Parsing the incremental market data in callback ✅
    • Market data handler in example code ✅
    • Fix callback method for subscription ✅
  • FIXED identify with message type and id ✅
  • FIXED the issue of heartbeat ✅
  • TradeClient ✅
    • Add fetch methods ✅
    • Implement fetch_security_list to fetch the security list ✅
    • Implement fetch_positions ✅
    • Implement fetch_all_order_status ✅
    • Implement new_market_order ✅
    • Implement new_limit_order ✅
    • Implement new_stop_order ✅
    • Implement parse_func for ExecutionReport ✅
    • Implement cancel_order ✅
    • Implement replace_order ✅
    • Implement adjust_position_size ✅
    • Implement close_position ✅
    • Added timeout in request methods ✅
    • FIXED issue unhandled trade message (deadlock) ✅
    • Add handler for trade execution ✅
    • FIXED data parsing issue in Socket ✅
    • Removed unnecessary arguments for new order methods ✅
  • Added support for ResendRequest ✅
  • Fixed issue - removed the heartbeat task from TradeClient. (provider send the recurring HB at the interval) ✅

License

This project is licensed under the MIT License - see the LICENSE file for details.

Dependencies

~3–9MB
~165K SLoC