Skip to content

Commit 73bbc44

Browse files
committed
Consistently use UnixNanos default
1 parent 4f8d463 commit 73bbc44

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

nautilus_core/core/src/nanos.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,13 +296,13 @@ mod tests {
296296
#[rstest]
297297
#[should_panic(expected = "Error subtracting with underflow")]
298298
fn test_overflow_sub() {
299-
let _ = UnixNanos::from(0) - UnixNanos::from(1); // This should panic due to underflow
299+
let _ = UnixNanos::default() - UnixNanos::from(1); // This should panic due to underflow
300300
}
301301

302302
#[rstest]
303303
#[should_panic(expected = "Error subtracting with underflow")]
304304
fn test_overflow_sub_u64() {
305-
let _ = UnixNanos::from(0) - 1_u64; // This should panic due to underflow
305+
let _ = UnixNanos::default() - 1_u64; // This should panic due to underflow
306306
}
307307

308308
#[rstest]

nautilus_core/model/src/data/bar.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ pub mod stubs {
333333
low: Price::from("1.00002"),
334334
close: Price::from("1.00003"),
335335
volume: Quantity::from("100000"),
336-
ts_event: UnixNanos::from(0),
336+
ts_event: UnixNanos::default(),
337337
ts_init: UnixNanos::from(1),
338338
}
339339
}
@@ -544,8 +544,8 @@ mod tests {
544544
low: Price::from("1.00002"),
545545
close: Price::from("1.00003"),
546546
volume: Quantity::from("100000"),
547-
ts_event: UnixNanos::from(0),
548-
ts_init: UnixNanos::from(0),
547+
ts_event: UnixNanos::default(),
548+
ts_init: UnixNanos::from(1),
549549
};
550550

551551
let bar2 = Bar {
@@ -555,8 +555,8 @@ mod tests {
555555
low: Price::from("1.00002"),
556556
close: Price::from("1.00003"),
557557
volume: Quantity::from("100000"),
558-
ts_event: UnixNanos::from(0),
559-
ts_init: UnixNanos::from(0),
558+
ts_event: UnixNanos::default(),
559+
ts_init: UnixNanos::from(1),
560560
};
561561
assert_eq!(bar1, bar1);
562562
assert_ne!(bar1, bar2);

nautilus_core/model/src/data/trade.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ pub mod stubs {
147147
size: Quantity::from("1.00000000"),
148148
aggressor_side: AggressorSide::Buyer,
149149
trade_id: TradeId::new("123456789").unwrap(),
150-
ts_event: UnixNanos::from(0),
150+
ts_event: UnixNanos::default(),
151151
ts_init: UnixNanos::from(1),
152152
}
153153
}

0 commit comments

Comments
 (0)