From 89089923fd8783b02bc155127c185365db4653f5 Mon Sep 17 00:00:00 2001 From: Jonathan Strong Date: Thu, 19 Mar 2020 02:59:03 -0400 Subject: [PATCH] spruce things up before publishing to jstrong-dev registry --- Cargo.toml | 9 +++++++-- LICENSE | 21 +++++++++++++++++++++ README.md | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 LICENSE create mode 100644 README.md diff --git a/Cargo.toml b/Cargo.toml index 6dc4b08..0e2b1ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,13 @@ [package] name = "markets" -version = "0.2.0" -authors = ["Jonathan Strong "] +version = "0.2.1" +authors = ["Jonathan Strong "] edition = "2018" +description = "kind of like the http crate, except about tradeable markets" +homepage = "https://git.jstrong.dev/jstrong/markets" +repository = "https://git.jstrong.dev/jstrong/markets" +readme = "README.md" +license = "LICENSE" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d69ea9d --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Jonathan Strong + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..917f283 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# markets + +Market-specific primitives in Rust. WIP. + +```rust +use markets::crypto::{Exchange, Currency, Ticker, Side}; + +#[derive(Serialize, Deserialize)] +pub struct Trade { + pub exch: Exchange, // 4-character symbol (bmex, btfx, etc.) + pub ticker: Ticker, // i.e. btc/usd + pub side: Side, // Bid/Ask + pub price: f64, + pub size: f64, + pub time: u64, // unix nanos +} + +let json = r#" + { + "exch": "bmex", + "ticker": "btc_usd", + "side": "bid", + "price": 7890.12345, + "size": 12.345, + "time": 1584600884388889367 + } +"#; + +let trade: Trade = serde_json::from_str(&json).unwrap(); + +assert_eq!(trade.ticker.base, Currency::btc); +```