A Rust wrapper around Jane Street's Trading Bot Competition
This is a repository that tries to provide Rust starter code for Jane Street's Trading Bot competition.
You will mostly be interacting with read_from_exchange
, write_to_exchange
and JaneStJson
.
connect()
establishes a TCP connection to the serversay_hello()
sends the server some initial information (e.g. team name etc.)PortFolio
struct that describes how many of each security your teamread_from_exchange()
reads a line from the server and converts it into a genericJaneStJson
structwrite_to_exchange()
takes in a generic JaneStJson
struct and writes it to the serverJaneStJson
is a generic struct that accommodates for all the data the server may_type
field to make sure exactly which fields will be non-emptyPortFolio
is a hashmap that maps symbols to i32 String -> i32
fn run() -> std::io::Result<()> {
let mut conn = connect()?;
let mut portfolio = say_hello(&mut conn)?;
match read_from_exchange(&mut conn) {
Ok(json) => println!("{:#?}", json),
Err(e) => println!("error reading from connection: {}", e),
}
Ok(())
}
fn main() {
run();
}
see main.rs for more details