Browse Source

spruce things up before publishing to jstrong-dev registry

tags/v0.3.0
Jonathan Strong 4 years ago
parent
commit
89089923fd
3 changed files with 60 additions and 2 deletions
  1. +7
    -2
      Cargo.toml
  2. +21
    -0
      LICENSE
  3. +32
    -0
      README.md

+ 7
- 2
Cargo.toml View File

@@ -1,8 +1,13 @@
[package] [package]
name = "markets" name = "markets"
version = "0.2.0"
authors = ["Jonathan Strong <jstrong@tioscapital.com>"]
version = "0.2.1"
authors = ["Jonathan Strong <jonathan.strong@gmail.com>"]
edition = "2018" 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 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html




+ 21
- 0
LICENSE View File

@@ -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.

+ 32
- 0
README.md View File

@@ -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);
```

Loading…
Cancel
Save