-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Expand file tree
/
Copy pathCargo.toml
More file actions
657 lines (617 loc) · 20.1 KB
/
Cargo.toml
File metadata and controls
657 lines (617 loc) · 20.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
[workspace]
resolver = "2"
members = [
"crates",
"crates/adapters/architect_ax",
"crates/adapters/betfair",
"crates/adapters/binance",
"crates/adapters/bitmex",
"crates/adapters/blockchain",
"crates/adapters/bybit",
"crates/adapters/databento",
"crates/adapters/deribit",
"crates/adapters/dydx",
"crates/adapters/coinbase",
"crates/adapters/hyperliquid",
"crates/adapters/kraken",
"crates/adapters/polymarket",
"crates/adapters/interactive_brokers",
"crates/adapters/okx",
"crates/adapters/sandbox",
"crates/adapters/tardis",
"crates/analysis",
"crates/backtest",
"crates/cli",
"crates/common",
"crates/core",
"crates/cryptography",
"crates/data",
"crates/execution",
"crates/indicators",
"crates/infrastructure",
"crates/live",
"crates/model",
"crates/persistence/macros",
"crates/network",
"crates/persistence",
"crates/portfolio",
"crates/pyo3",
"crates/risk",
"crates/serialization",
"crates/system",
"crates/testkit",
"crates/trading",
]
[workspace.package]
version = "0.57.0"
edition = "2024"
rust-version = "1.95.0"
authors = ["Nautech Systems <info@nautechsystems.io>"]
license = "LGPL-3.0-or-later"
readme = "README.md"
description = "Production-grade Rust-native trading engine with deterministic event-driven architecture"
categories = ["finance", "simulation", "asynchronous"]
keywords = [
"finance",
"trading",
"trading-platform",
"algorithmic-trading",
"quantitative-finance",
]
documentation = "https://nautilustrader.io/docs"
repository = "https://github.com/nautechsystems/nautilus_trader"
homepage = "https://nautilustrader.io"
[workspace.dependencies]
nautilus-analysis = { path = "crates/analysis", version = "0.57.0" }
nautilus-backtest = { path = "crates/backtest", version = "0.57.0" }
nautilus-cli = { path = "crates/cli", version = "0.57.0" }
nautilus-common = { path = "crates/common", version = "0.57.0" }
nautilus-core = { path = "crates/core", version = "0.57.0" }
nautilus-cryptography = { path = "crates/cryptography", version = "0.57.0" }
nautilus-data = { path = "crates/data", version = "0.57.0" }
nautilus-execution = { path = "crates/execution", version = "0.57.0" }
nautilus-indicators = { path = "crates/indicators", version = "0.57.0" }
nautilus-infrastructure = { path = "crates/infrastructure", version = "0.57.0" }
nautilus-live = { path = "crates/live", version = "0.57.0", default-features = false }
nautilus-model = { path = "crates/model", version = "0.57.0" }
nautilus-network = { path = "crates/network", version = "0.57.0" }
nautilus-persistence = { path = "crates/persistence", version = "0.57.0" }
nautilus-persistence-macros = { path = "crates/persistence/macros", version = "0.57.0" }
nautilus-portfolio = { path = "crates/portfolio", version = "0.57.0" }
nautilus-pyo3 = { path = "crates/pyo3", version = "0.57.0" }
nautilus-risk = { path = "crates/risk", version = "0.57.0" }
nautilus-serialization = { path = "crates/serialization", version = "0.57.0" }
nautilus-system = { path = "crates/system", version = "0.57.0" }
nautilus-testkit = { path = "crates/testkit", version = "0.57.0" }
nautilus-trading = { path = "crates/trading", version = "0.57.0" }
# -----------------------------------------------------------------------------
# Adapters
#
# Note: default-features = false to control high-precision separately (not supported on Windows)
# -----------------------------------------------------------------------------
nautilus-architect-ax = { path = "crates/adapters/architect_ax", version = "0.57.0" }
nautilus-binance = { path = "crates/adapters/binance", version = "0.57.0", default-features = false }
nautilus-bitmex = { path = "crates/adapters/bitmex", version = "0.57.0", default-features = false }
nautilus-blockchain = { path = "crates/adapters/blockchain", version = "0.57.0" }
nautilus-bybit = { path = "crates/adapters/bybit", version = "0.57.0", default-features = false }
nautilus-coinbase = { path = "crates/adapters/coinbase", version = "0.57.0", default-features = false }
nautilus-databento = { path = "crates/adapters/databento", version = "0.57.0", default-features = false }
nautilus-deribit = { path = "crates/adapters/deribit", version = "0.57.0", default-features = false }
nautilus-dydx = { path = "crates/adapters/dydx", version = "0.57.0", default-features = false }
nautilus-hyperliquid = { path = "crates/adapters/hyperliquid", version = "0.57.0", default-features = false }
nautilus-interactive-brokers = { path = "crates/adapters/interactive_brokers", version = "0.57.0" }
nautilus-kraken = { path = "crates/adapters/kraken", version = "0.57.0", default-features = false }
nautilus-okx = { path = "crates/adapters/okx", version = "0.57.0", default-features = false }
nautilus-polymarket = { path = "crates/adapters/polymarket", version = "0.57.0", default-features = false }
nautilus-sandbox = { path = "crates/adapters/sandbox", version = "0.57.0", default-features = false }
nautilus-tardis = { path = "crates/adapters/tardis", version = "0.57.0", default-features = false }
# -----------------------------------------------------------------------------
# Core dependencies
#
# - arrow, parquet major versions must stay in line with datafusion
# - object_store must stay in line with datafusion (pre-1.0: minor bumps can break)
# -----------------------------------------------------------------------------
ahash = { version = "0.8.12", features = ["serde"] }
alloy-primitives = { version = "1.5.7", default-features = false, features = [
"std",
"serde",
] }
anyhow = "1.0.102"
arraydeque = "0.5.1"
arrow = { version = "58.1.0", default-features = false, features = [
"csv",
"json",
"ipc",
"ffi",
] }
arrow-row = "58.1.0"
async-stream = "0.3.6"
async-trait = "0.1.89"
aws-lc-rs = { version = "1.16.3", default-features = false, features = [
"non-fips", # FIPS 140-3 mode blocked: aws-lc-fips-sys requires Go toolchain
] }
base64 = "0.22.1"
bon = "3.9.1"
bytes = { version = "1.11.1", features = ["serde"] }
capnp = "0.25.4"
chrono = { version = "0.4.44", default-features = false, features = [
"serde",
"std",
"clock",
] }
chrono-tz = "0.10.4"
clap = { version = "4.6.1", features = ["derive", "env"] }
dashmap = "6.1.0"
datafusion = { version = "53.1.0", default-features = false, features = [
"parquet",
"regex_expressions",
"unicode_expressions",
"sql",
] }
derive_builder = { version = "0.20.2", default-features = false, features = [
"alloc",
] }
dotenvy = "0.15.7"
ed25519-dalek = "2.2.0"
enum_dispatch = "0.3.13"
futures = { version = "0.3.32", default-features = false, features = [
"std",
"async-await",
] }
futures-util = { version = "0.3.32", default-features = false, features = [
"std",
"async-await",
"sink",
] }
http = "1.4.0"
implied-vol = { version = "2.0.0" }
indexmap = { version = "2.14.0", features = ["serde"] }
itchy = "0.3"
itertools = "0.14.0"
log = { version = "0.4.29", features = [
"std",
"kv_unstable",
"serde",
"release_max_level_debug",
] }
madsim = "0.2.34"
object_store = { version = "0.13.2", default-features = false, features = [
"fs",
] }
parquet = { version = "58.1.0", default-features = false, features = [
"arrow",
"async",
] }
pem = "3.0.6"
pyo3 = { version = "0.28.3", default-features = false, features = [
"chrono",
"hashbrown",
"indexmap",
"macros",
"multiple-pymethods",
"rust_decimal",
"serde",
] }
pyo3-async-runtimes = { version = "0.28.0", default-features = false, features = [
"attributes",
"tokio",
"tokio-runtime",
] }
# Pinned: 0.21 rejects module paths outside pymodule root, blocking our mixed layout for now
pyo3-stub-gen = { version = "=0.20.0", default-features = false, features = [
"rust_decimal",
] }
rand = { version = "0.10.1", default-features = false, features = [
"std",
"thread_rng",
] }
redis = { version = "1.2.0", default-features = false, features = [
"connection-manager",
"sentinel",
"streams",
"tokio-comp",
"tokio-rustls-comp",
"tls-rustls",
"tls-rustls-webpki-roots",
] }
regex = { version = "1.12.3", default-features = false, features = [
"std",
"perf",
"unicode-perl",
] }
reqwest = { version = "0.13.3", default-features = false, features = [
"http2",
"json",
"query",
"rustls",
"stream",
] }
rmp-serde = "1.3.1"
rust_decimal = { version = "1.41.0", features = ["serde-with-float"] }
rust_decimal_macros = "1.40.0"
rustls = { version = "0.23.40", default-features = false, features = [
"aws-lc-rs",
"logging",
"std",
"tls12",
] }
rustls-pemfile = "2.2.0"
serde = { version = "1.0.228", default-features = false, features = [
"derive",
"std",
"rc",
] }
serde_json = { version = "1.0.149", default-features = false, features = [
"std",
] }
serde_urlencoded = "0.7.1"
smallvec = "1.15.1"
sockudo-ws = { version = "1.7.4", default-features = false, features = [
"simd",
"fastrand",
"tokio-runtime",
"rustls-webpki-roots",
] }
sqlx = { version = "0.8.6", default-features = false, features = [
"postgres",
"runtime-tokio",
"json",
"derive",
"rust_decimal",
] }
strum = { version = "0.28.0", features = ["derive"] }
sysinfo = { version = "0.38.4", default-features = false, features = [
"system",
] }
tabled = { version = "0.20.0", default-features = false, features = [
"std",
"derive",
] }
thiserror = "2.0.18"
tokio = { version = "1.52.1", default-features = false, features = [
"rt-multi-thread",
"sync",
"fs",
"io-util",
"net",
"time",
"macros",
"signal",
] }
tokio-rustls = "0.26.4"
tokio-tungstenite = { version = "0.29.0", features = [
"rustls-tls-webpki-roots",
] }
tokio-util = { version = "0.7.18", default-features = false, features = ["io"] }
toml = { version = "1.1.2", default-features = false, features = [
"parse",
"serde",
] }
tracing = { version = "0.1.44", default-features = false, features = ["std"] }
tracing-subscriber = { version = "0.3.23", default-features = false, features = [
"std",
"env-filter",
"fmt",
"registry",
] }
unbounded-interval-tree = { version = "1.1.2", default-features = false }
url = { version = "2.5.8", default-features = false }
ustr = { version = "1.1.0", features = ["serde"] }
uuid = { version = "1.23.1", features = ["v4", "serde"] }
webpki-roots = "1.0.7"
# -----------------------------------------------------------------------------
# Adapter dependencies
# -----------------------------------------------------------------------------
alloy = { version = "2.0.4", default-features = false, features = [
"sol-types",
"contract",
"signers",
"signer-local",
] }
arc-swap = "1.9.1"
bollard = { version = "0.18.0", default-features = false, features = [
"http",
"pipe",
] }
bzip2 = "0.6.1"
cosmrs = { version = "0.22.0", default-features = false, features = ["bip32"] }
csv = "1.4.0"
databento = { version = "0.49.0", default-features = false, features = [
"historical",
"live",
] }
dydx-proto = "0.4.0"
fallible-streaming-iterator = "0.1.9"
flate2 = "1.1.9"
hypersync-client = { version = "1.1.4" }
ibapi = "2.11.2"
itoa = "1.0.18"
prost = { version = "0.13.5", default-features = false, features = ["std"] }
ryu = "1.0.23"
serde_repr = "0.1.20"
serde_with = "3.18.0"
time = { version = "0.3.47", default-features = false, features = [
"macros",
"parsing",
"serde",
"std",
] }
tonic = { version = "0.13.1", default-features = false, features = [
"channel",
"tls-aws-lc",
"tls-webpki-roots",
] }
zeroize = { version = "1.8.2", features = ["alloc", "zeroize_derive"] }
# -----------------------------------------------------------------------------
# Dev dependencies
# -----------------------------------------------------------------------------
axum = { version = "0.8.9", default-features = false, features = [
"tokio",
"http1",
"json",
"query",
"ws",
] }
criterion = { version = "0.8.2", default-features = false, features = [
"cargo_bench_support",
] }
iai = "0.1.1"
pretty_assertions = "1.4.1"
proptest = { version = "1.11.0", default-features = false, features = ["std"] }
rstest = "0.26.1"
tempfile = "3.27.0"
tracing-test = "0.2.6"
turmoil = "0.7.2"
# -----------------------------------------------------------------------------
# Build dependencies
# -----------------------------------------------------------------------------
capnpc = "0.25.3"
cbindgen = "0.29.2"
walkdir = "2.5.0"
# -----------------------------------------------------------------------------
# Tools (for cargo install, used by Makefile and CI)
# -----------------------------------------------------------------------------
[workspace.metadata.tools]
cargo-audit = "0.22.1"
cargo-deny = "0.19.4"
cargo-edit = "0.13.10"
cargo-llvm-cov = "0.8.5"
cargo-machete = "0.9.2"
cargo-nextest = "0.9.133"
cargo-vet = "0.10.2"
flamegraph = "0.6.12"
lychee = "0.24.1"
# cargo-vet supply chain security configuration
[workspace.metadata.vet]
store = { path = '.supply-chain' }
# -----------------------------------------------------------------------------
# Profiles
# -----------------------------------------------------------------------------
[profile.dev]
opt-level = 0
debug = false # Improves compile times
debug-assertions = false # Fails Cython build if true
overflow-checks = false # test profile keeps these on for catching overflow bugs
strip = "debuginfo" # Improves compile times
lto = false
panic = "unwind"
incremental = true
# Compile third-party deps at opt-level=1 in dev/test profiles. Workspace
# members keep opt-level=0 (fast iteration); deps recompile rarely so the
# small one-off compile cost pays off in faster test/run loops.
[profile.dev.package."*"]
opt-level = 1
[profile.debug-pyo3]
inherits = "dev"
debug = true # Enable debug symbols for debugging
strip = false # Keep debug symbols for debugging
[profile.test]
opt-level = 0
debug = true
debug-assertions = true
overflow-checks = true
strip = false
lto = false
incremental = true
[profile.test.package."*"]
opt-level = 1
[profile.nextest]
inherits = "test"
debug = false # Improves compile times
strip = "debuginfo" # Improves compile times
[profile.ci-pr]
inherits = "test"
opt-level = 0
debug = false
strip = "debuginfo"
lto = false
incremental = false
codegen-units = 1
[profile.ci-pr.package."*"]
opt-level = 0
[profile.ci-pr-wheel]
inherits = "dev"
debug = false
strip = "debuginfo"
incremental = false
codegen-units = 1
[profile.ci-pr-wheel.package."*"]
opt-level = 0
[profile.release]
opt-level = 3
debug = false
debug-assertions = false
overflow-checks = false
lto = "fat"
strip = "symbols"
panic = "abort"
incremental = false
codegen-units = 1
[profile.release-debugging]
inherits = "release"
incremental = true
debug = "full"
strip = false
lto = false
# -----------------------------------------------------------------------------
# Benchmarks
# -----------------------------------------------------------------------------
# Criterion/iai benchmarks should retain debug symbols so that tools like
# `cargo flamegraph` or `perf` produce human-readable stack traces. We inherit
# from the `release-debugging` profile defined above which keeps optimisation
# level 3 but preserves symbols and disables LTO for faster compile times.
# -----------------------------------------------------------------------------
[profile.bench]
inherits = "release"
debug = "full"
strip = false
lto = false
incremental = true
# Cargo ignores `panic` for bench profile (harness requires unwind to catch failures)
# -----------------------------------------------------------------------------
# Workspace lints
# -----------------------------------------------------------------------------
# Centralized lint configuration for all workspace crates.
# Individual crates inherit these with: [lints] workspace = true
#
# These lints are auto-fixable and enforced in pre-commit hooks.
# Run `make clippy-fix` to auto-fix most issues.
#
# Additional non-auto-fixable lints (todo, unwrap_used, expect_used) are
# available via the `make clippy-fix-nightly` target.
# -----------------------------------------------------------------------------
[workspace.lints.clippy]
# Debug markers
dbg_macro = "warn"
# Performance optimizations
redundant_clone = "warn"
unnecessary_to_owned = "warn"
inefficient_to_string = "warn"
cloned_instead_of_copied = "warn"
# Needless code
needless_borrow = "warn"
needless_bool = "warn"
needless_borrows_for_generic_args = "warn"
needless_collect = "warn"
needless_continue = "warn"
needless_late_init = "warn"
needless_lifetimes = "warn"
needless_match = "warn"
needless_option_as_deref = "warn"
needless_pass_by_ref_mut = "warn"
needless_pass_by_value = "warn"
needless_range_loop = "warn"
needless_raw_strings = "warn"
needless_raw_string_hashes = "warn"
needless_return = "warn"
needless_update = "warn"
# Code simplification
redundant_closure = "warn"
# redundant_closure_for_method_calls = "warn" # Causes clippy ICE on Rust 1.94
collapsible_if = "warn"
collapsible_else_if = "warn"
useless_conversion = "warn"
unnecessary_safety_comment = "warn"
unnecessary_safety_doc = "warn"
unnecessary_self_imports = "warn"
unnecessary_semicolon = "warn"
unnecessary_sort_by = "warn"
unnecessary_struct_initialization = "warn"
unnecessary_debug_formatting = "warn"
unnecessary_wraps = "warn"
unnecessary_box_returns = "warn"
unnecessary_join = "warn"
unnecessary_literal_bound = "warn"
from_iter_instead_of_collect = "warn"
map_identity = "warn"
if_same_then_else = "warn"
get_first = "warn"
single_char_pattern = "warn"
identity_op = "warn"
# Iterator simplifications
manual_flatten = "warn"
iter_kv_map = "warn"
bytes_count_to_len = "warn"
unnecessary_filter_map = "warn"
# Option/Result simplifications
unnecessary_lazy_evaluations = "warn"
option_as_ref_deref = "warn"
# Manual pattern simplifications
manual_filter = "warn"
manual_find = "warn"
manual_while_let_some = "warn"
range_plus_one = "warn"
checked_conversions = "warn"
manual_strip = "warn"
manual_split_once = "warn"
manual_is_ascii_check = "warn"
manual_range_contains = "warn"
manual_string_new = "warn"
manual_instant_elapsed = "warn"
# Pointer casts
ref_as_ptr = "warn"
# Style/idioms
use_self = "warn"
# default_trait_access = "warn" # TODO: Enable (~170 warnings)
redundant_field_names = "warn"
match_like_matches_macro = "warn"
manual_map = "warn"
bool_to_int_with_if = "warn"
explicit_iter_loop = "warn"
uninlined_format_args = "warn"
# Pedantic (explicitness and clarity)
borrow_as_ptr = "warn"
copy_iterator = "warn"
expl_impl_clone_on_copy = "warn"
inconsistent_struct_constructor = "warn"
iter_nth_zero = "warn"
map_flatten = "warn"
match_bool = "warn"
mut_mut = "warn"
naive_bytecount = "warn"
option_option = "warn"
ptr_as_ptr = "warn"
verbose_bit_mask = "warn"
semicolon_if_nothing_returned = "warn"
unnested_or_patterns = "warn"
filter_map_next = "warn"
flat_map_option = "warn"
map_unwrap_or = "warn"
implicit_clone = "warn"
return_self_not_must_use = "warn"
explicit_into_iter_loop = "warn"
stable_sort_primitive = "warn"
needless_for_each = "warn"
manual_is_variant_and = "warn"
equatable_if_let = "warn"
manual_assert = "warn"
items_after_statements = "warn"
ignored_unit_patterns = "warn"
if_not_else = "warn"
# Security and robustness
suspicious_doc_comments = "warn"
large_stack_arrays = "warn"
panic_in_result_fn = "warn"
# Async correctness
await_holding_lock = "warn"
await_holding_refcell_ref = "warn"
let_underscore_future = "warn"
large_futures = "warn"
# TODO: Don't fail silently. Incremental rollout needed (~1400 sites workspace-wide)
# let_underscore_must_use = "warn"
# unused_result_ok = "warn"
# assertions_on_result_states = "warn"
# map_err_ignore = "warn"
# Explicitly allowed (opinionated lints we disagree with)
redundant_else = "allow" # Sometimes explicit else blocks improve readability
single_match_else = "allow" # Match can be clearer than if-let-else for some patterns
manual_let_else = "allow" # Match can be clearer than let-else for some patterns
or_fun_call = "allow" # Used consistently for display with map_or("None".to_string(), ...)
option_if_let_else = "allow" # if-let can be clearer than map_or/map_or_else
similar_names = "allow" # Domain terms like trade/trader and side/size are intentionally similar
# TODO: Enable these incrementally (widespread usage in codebase)
# unwrap_used = "warn" # Forces explicit error handling instead of panics
# expect_used = "warn" # Forces explicit error handling instead of panics
# indexing_slicing = "warn" # Prevents panics from out-of-bounds access
[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(madsim)'] }