Skip to content

Commit

Permalink
tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
jordy25519 committed Dec 15, 2023
1 parent eac9352 commit 0449118
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,3 @@ $> curl localhost:8080/v2/orders -X DELETE -H 'content-type: application/json'
$> curl localhost:8080/v2/orderbooks -N -X GET -H 'content-type: application/json' -d '{"market":{"id":3,"type":"perp"}'
```


# TODO:
- implement orderbook ws stream
- integration tests for the endpoints
16 changes: 9 additions & 7 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ mod tests {
let cases = [
("0.1234", 123_400u64, 0_u16),
("123", 123_000_000_000, 1),
("1.23", 12_300_000_000, 1),
("1.23", 1_230_000_000, 1),
("5.123456789", 512_345_678, 4),
];
for (input, expected, market_index) in cases {
Expand All @@ -391,18 +391,20 @@ mod tests {
#[test]
fn order_from_sdk_order() {
let cases = [
("0.1234", 123_400u64, 0_u16),
("123", 12_300_000_000, 1),
("5.123456789", 512_345_678, 4),
(123_4000u64, Decimal::from_str("1.23400").unwrap(), 0_u16),
(123_000_000_000, Decimal::from_str("123.0").unwrap(), 1),
(512_345_678, Decimal::from_str("5.12345678").unwrap(), 4),
];
for (input, expected, market_index) in cases {
let o = drift_sdk::types::Order {
base_asset_amount: 100000000,
price: 10000000,
base_asset_amount: input,
price: input,
market_index,
market_type: MarketType::Spot,
..Default::default()
};
let gateway_order = Order::from_sdk_order(o, Context::MainNet);
// assert_eq!(gateway_order.amount, expected);
assert_eq!(gateway_order.amount, expected);
}
}
}

0 comments on commit 0449118

Please sign in to comment.