Skip to content

Commit

Permalink
Bug fix for price precision from #2
Browse files Browse the repository at this point in the history
  • Loading branch information
golden-lucky-monkey committed Jun 2, 2022
1 parent be4da3d commit 7168233
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub(crate) fn convert_increment_to_precision(increment: rust_decimal::Decimal) -
let mut precision = 0;
let mut incr = increment;

while incr != rust_decimal::Decimal::from(1) {
while incr < rust_decimal::Decimal::from(1) {
incr *= rust_decimal::Decimal::from(10);
precision += 1;
}
Expand Down
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ async fn main() {

// Set precision for price
let price_precision = helpers::convert_increment_to_precision(
future_result.price_increment);
future_result.price_increment
);

// Set precision for order

Expand Down

0 comments on commit 7168233

Please sign in to comment.