slouch
Simple OUCH 5.0 client for communication of orders to NASDAQ. Contains strong types for order-related messages and a simple client to send and receive them.
WARNING: Work-in-progress
This crate should be presumed experimental and non-functional until integration testing has been completed. If you are willing and able to assist with integration testing, please leave a response under this issue.
Use
- Add
slouchto your Rust project (v2024or more recent):
- Create an
OuchClientto handle order entry by wrapping a TCP stream that is already logged in to an OUCH account. When the client is created, it will attempt to query the account. Setup will fail if anAccountQueryResponseis not received from the server.
use ;
use OuchClient;
let mut stream = connect;
// TODO: Login to your account as described during OUCH onboarding.
let mut client = new.unwrap;
- Send a request and receive a response.
OuchResponseis an enum that can be matched to extract message values.
use account_query;
use *;
let request = account_query!;
client.send.unwrap;
let response = client.recv.unwrap;
match response
- Each
OuchRequesthas a macro to simplify message creation. Check the documentation comment for a macro to see how it is used.
use ;
let request = enter!;
client.send.unwrap;
- Client logging is provided by the
logcrate and can be enabled through thelogsfeature. An asynchronous version of the client usestokioand can be enabled through theasyncfeature. By default,OuchClientis synchronous and its events are not logged.
# Cargo.toml
[]
= { = "0.0.0", = ["logs", "async"] }
OuchRequestandOuchResponsemay also be used without anOuchClient.
use net;
use ;
// OUCH Server port
let addr = new;
let mut stream = connect.unwrap;
// TODO: Login to your account as described during OUCH onboarding.
let bytes = account_query!.encode;
stream.write_all.unwrap;
let mut buf = vec!;
let n = stream.read.unwrap;
let = parse.unwrap;
Development
Development history and current tasks are tracked in TODO.md.
Developer resources:
Contributions are welcome! Submit issues and pull requests to this repository.