Skip to content

Commit af12b9c

Browse files
committed
Examples, stats, and tests
1 parent d7de271 commit af12b9c

File tree

18 files changed

+189
-35
lines changed

18 files changed

+189
-35
lines changed

atelier-data/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ publish = true
2323

2424
[package.metadata.docs.rs]
2525
rustdoc-args = ["--html-in-header", "katex-header.html", "--cfg", "docsrs"]
26-
all-features = true
26+
features = ["parquet"]
2727

2828
[lib]
2929
name = "atelier_data"

atelier-data/examples/market_worker/market_worker_binance.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,5 @@ type = "terminal"
4444

4545
# ── Workers ──────────────────────────────────────────────────────────
4646

47-
[[workers]]
48-
symbol = "ethusdt"
49-
5047
[[workers]]
5148
symbol = "solusdt"

atelier-data/examples/market_worker/market_worker_coinbase.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,5 @@ type = "terminal"
4444

4545
# ── Workers ─────────────────────────────────────────────────────────────
4646

47-
[[workers]]
48-
symbol = "ETH-USDT"
49-
5047
[[workers]]
5148
symbol = "SOL-USDT"

atelier-data/examples/market_worker/market_worker_kraken.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,5 @@ type = "terminal"
4444

4545
# ── Workers ─────────────────────────────────────────────────────────────
4646

47-
[[workers]]
48-
symbol = "ETH/USDT"
49-
5047
[[workers]]
5148
symbol = "SOL/USDT"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"model": "hawkes_exponential",
3+
"version": 1,
4+
"fitted_at": "2026-03-12T06:08:42.919498Z",
5+
"parameters": {
6+
"mu": 6.7782254489266944e-6,
7+
"alpha": 6.144956410640459e-6,
8+
"beta": 0.000010190009253087155
9+
},
10+
"diagnostics": {
11+
"branching_ratio": 0.6030373729816574,
12+
"log_likelihood": -669.5290716452546,
13+
"aic": 1345.0581432905092,
14+
"bic": 1351.1341983627146,
15+
"converged": true,
16+
"iterations": 64,
17+
"residuals_mean": 1.018315294732614,
18+
"residuals_std": 1.2302185316918353,
19+
"compensator_ratio": 1.018315294732614
20+
},
21+
"data": {
22+
"source": "datasets/collected/coinbase/trades/coinbase_SOL-USDT_trades_sync_20260306_181353.735.parquet",
23+
"n_events_train": 56,
24+
"n_events_test": 2,
25+
"observation_window_ms": 3525335.0,
26+
"time_resolution": "Milliseconds"
27+
},
28+
"baseline": {
29+
"model": "poisson",
30+
"lambda": 0.000015847303451657945,
31+
"aic": 1327.7762321482294,
32+
"lr_statistic": -13.281911142279796,
33+
"lr_reject_h0": false
34+
}
35+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"model": "hawkes_exponential",
3+
"version": 1,
4+
"fitted_at": "2026-03-12T06:09:48.698845Z",
5+
"parameters": {
6+
"mu": 0.000016077261288393247,
7+
"alpha": 0.0003266350897340653,
8+
"beta": 0.0012323393472207275
9+
},
10+
"diagnostics": {
11+
"branching_ratio": 0.2650528772539151,
12+
"log_likelihood": -849.1563448323541,
13+
"aic": 1704.3126896647082,
14+
"bic": 1711.265154005317,
15+
"converged": true,
16+
"iterations": 34987,
17+
"residuals_mean": 1.0123360363238076,
18+
"residuals_std": 2.33933084957549,
19+
"compensator_ratio": 1.0123360363238076
20+
},
21+
"data": {
22+
"source": "datasets/collected/kraken/trades/kraken_SOL-USDT_trades_sync_20260306_181411.334.parquet",
23+
"n_events_train": 75,
24+
"n_events_test": 2,
25+
"observation_window_ms": 3460600.0,
26+
"time_resolution": "Milliseconds"
27+
},
28+
"baseline": {
29+
"model": "poisson",
30+
"lambda": 0.000021428170167469836,
31+
"aic": 1741.1190125152762,
32+
"lr_statistic": 40.806322850567994,
33+
"lr_reject_h0": true
34+
}
35+
}

atelier-quant/configs/inter_fit.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
[input]
1313
# Directory containing parquet files.
14-
path = "datasets/collected/bybit/trades/"
14+
path = "datasets/collected/kraken/trades/"
1515
# Data type to look for: "trades" or "orderbook".
1616
data_type = "trades"
1717
# File selection: "latest" picks the most recently modified file.
@@ -20,13 +20,13 @@ selection = "latest"
2020
[model]
2121
# MLE optimizer settings.
2222
max_iter = 50_000
23-
tolerance = 1e2
24-
learning_rate = 2e-3
23+
tolerance = 1e3
24+
learning_rate = 1e-3
2525
# Fraction of events used for training (remainder is the test set).
26-
train_ratio = 0.986
26+
train_ratio = 0.980
2727
# Gap detection threshold (seconds). Gaps above this are flagged
2828
# as likely feed disconnects.
29-
gap_threshold_secs = 5.0
29+
gap_threshold_secs = 9.0
3030

3131
[forecast]
3232
# Number of Monte-Carlo stochastic paths (1 = single run, >1 = ensemble).
@@ -36,7 +36,7 @@ mc_statistic = "p25"
3636

3737
[output]
3838
# Directory where the model artifact JSON will be written.
39-
artifact_dir = "artifacts/inter_arrival/"
39+
artifact_dir = "atelier-quant/artifacts/inter_arrival/experiments/"
4040
# Output format (only "json" is currently supported).
4141
format = "json"
4242
# Include goodness-of-fit diagnostics in the artifact.

atelier-quant/src/arrivals/inter.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,3 @@ pub fn descriptive_stats(deltas: &[f64]) -> Option<ArrivalStats> {
203203
cv,
204204
})
205205
}
206-

atelier-quant/src/forecast.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
//! - [`percentile`] — linearly interpolated quantile from a sorted slice.
99
1010
use crate::config::EnsembleStatistic;
11-
use crate::hawkes::kernel::ExcitationKernel;
1211
use crate::hawkes::HawkesProcess;
12+
use crate::hawkes::kernel::ExcitationKernel;
1313
use serde::{Deserialize, Serialize};
1414

1515
/// Forecast error metrics computed on cumulative gaps from the
@@ -110,7 +110,9 @@ pub fn ensemble_forecast<K: ExcitationKernel>(
110110
}
111111
}
112112
_ => {
113-
column.sort_unstable_by(|a, b| a.partial_cmp(b).unwrap_or(std::cmp::Ordering::Equal));
113+
column.sort_unstable_by(|a, b| {
114+
a.partial_cmp(b).unwrap_or(std::cmp::Ordering::Equal)
115+
});
114116
let q = match statistic {
115117
EnsembleStatistic::Median => 0.5,
116118
EnsembleStatistic::P25 => 0.25,
@@ -172,7 +174,11 @@ pub struct LRTestResult {
172174
/// # Returns
173175
///
174176
/// [`LRTestResult`] with the test statistic and decision at α = 0.05.
175-
pub fn likelihood_ratio_test(ll_full: f64, ll_restricted: f64, df: usize) -> LRTestResult {
177+
pub fn likelihood_ratio_test(
178+
ll_full: f64,
179+
ll_restricted: f64,
180+
df: usize,
181+
) -> LRTestResult {
176182
let statistic = 2.0 * (ll_full - ll_restricted);
177183

178184
// χ²(df) critical values at α = 0.05 for small df.

atelier-quant/src/hawkes/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
//! - [`errors`] — error types for invalid parameters and convergence
1515
//! failures.
1616
17+
pub mod core;
1718
pub mod kernel;
1819
pub mod quadrature;
19-
pub mod core;
2020
pub use core::HawkesProcess;
2121
pub mod errors;
2222
pub mod estimation;

0 commit comments

Comments
 (0)