examples: move the bundled BTCUSDT datasets to a top-level examples/data/
The seven BTCUSDT OHLCV datasets used to live under crates/wickra/examples/data/, which buried them inside a Rust crate even though the Node backtest example and the upcoming Rust/Node/WASM example restructure need to reach them too. Move them to the workspace-level examples/data/ so every language's examples can resolve the same path. The bench (crates/wickra/benches/indicators.rs), the example_data integration test, fetch_btcusdt.rs and the Node backtest example all take the new ../../examples/data/ path; Data-Layer.md, examples/README.md and the CHANGELOG entry are updated to match. No data file content changes.
This commit is contained in:
@@ -6,14 +6,14 @@
|
||||
//! ```
|
||||
//!
|
||||
//! Each benchmark feeds real BTCUSDT 1-minute candles — read from the
|
||||
//! checked-in dataset `examples/data/btcusdt-1m.csv` — through both the
|
||||
//! streaming (`update` loop) and batch APIs of an indicator. Sizes cover
|
||||
//! small (1 000), medium (10 000), and large (50 000) workloads, taken as
|
||||
//! prefixes of that dataset.
|
||||
//! checked-in dataset at the workspace `examples/data/btcusdt-1m.csv` —
|
||||
//! through both the streaming (`update` loop) and batch APIs of an
|
||||
//! indicator. Sizes cover small (1 000), medium (10 000), and large
|
||||
//! (50 000) workloads, taken as prefixes of that dataset.
|
||||
//!
|
||||
//! Regenerate the dataset with:
|
||||
//! ```text
|
||||
//! cargo run -p wickra --example fetch_btcusdt
|
||||
//! cargo run -p wickra-examples --bin fetch_btcusdt
|
||||
//! ```
|
||||
|
||||
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
|
||||
@@ -26,13 +26,17 @@ use wickra_data::csv::CandleReader;
|
||||
/// Workload sizes, in candles. Each is taken as a prefix of the dataset.
|
||||
const SIZES: &[usize] = &[1_000, 10_000, 50_000];
|
||||
|
||||
/// Load the checked-in BTCUSDT 1-minute candle dataset.
|
||||
/// Load the checked-in BTCUSDT 1-minute candle dataset from the workspace
|
||||
/// `examples/data/` directory.
|
||||
fn load_candles() -> Vec<Candle> {
|
||||
let path = concat!(env!("CARGO_MANIFEST_DIR"), "/examples/data/btcusdt-1m.csv");
|
||||
let path = concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/../../examples/data/btcusdt-1m.csv"
|
||||
);
|
||||
let mut reader = CandleReader::open(path).unwrap_or_else(|e| {
|
||||
panic!(
|
||||
"could not open the benchmark dataset {path}: {e}\n\
|
||||
generate it with `cargo run -p wickra --example fetch_btcusdt`"
|
||||
generate it with `cargo run -p wickra-examples --bin fetch_btcusdt`"
|
||||
)
|
||||
});
|
||||
reader
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,106 +0,0 @@
|
||||
timestamp,open,high,low,close,volume
|
||||
1501545600000,4261.48,4745.42,3400,4724.89,10015.640272
|
||||
1504224000000,4689.89,4939.19,2817,4378.51,27634.18912
|
||||
1506816000000,4378.49,6498.01,4110,6463,41626.388463
|
||||
1509494400000,6463,11300.03,5325.01,9838.96,108487.978119
|
||||
1512086400000,9837,19798.68,9380,13716.36,408476.658399
|
||||
1514764800000,13715.65,17176.24,9035,10285.1,816675.564467
|
||||
1517443200000,10285.1,11786.01,6000.01,10326.76,1243940.85531
|
||||
1519862400000,10325.64,11710,6600.1,6923.91,1235326.31402
|
||||
1522540800000,6922,9759.82,6430,9246.01,1110964.015581
|
||||
1525132800000,9246.01,10020,7032.95,7485.01,914476.377885
|
||||
1527811200000,7485.01,7786.69,5750,6390.07,942249.765944
|
||||
1530403200000,6391.08,8491.77,6070,7730.93,1102510.436786
|
||||
1533081600000,7735.67,7750,5880,7011.21,1408159.816556
|
||||
1535760000000,7011.21,7410,6111,6626.57,1100653.423315
|
||||
1538352000000,6626.57,7680,6205,6371.93,629922.086219
|
||||
1541030400000,6369.52,6615.15,3652.66,4041.32,1210366.564567
|
||||
1543622400000,4041.27,4312.99,3156.26,3702.9,1591229.611862
|
||||
1546300800000,3701.23,4069.8,3349.92,3434.1,908244.14054
|
||||
1548979200000,3434.1,4198,3373.1,3813.69,861783.986727
|
||||
1551398400000,3814.26,4140,3670.69,4103.95,787190.48925
|
||||
1554076800000,4102.44,5600,4067,5320.81,1126961.315101
|
||||
1556668800000,5321.94,9074.26,5316.2,8555,1498410.025617
|
||||
1559347200000,8555,13970,7444.58,10854.1,1689489.647326
|
||||
1561939200000,10854.1,13147.08,9060,10080.53,1886176.065915
|
||||
1564617600000,10080.53,12330.7,9320,9587.47,1201961.576316
|
||||
1567296000000,9588.74,10905.87,7710,8289.34,1116856.475836
|
||||
1569888000000,8289.97,10370,7300,9140.85,1446763.024045
|
||||
1572566400000,9140.86,9513.68,6515,7541.89,1499118.774995
|
||||
1575158400000,7540.63,7750,6435,7195.23,1307033.020384
|
||||
1577836800000,7195.24,9578,6871.04,9352.89,1691323.137782
|
||||
1580515200000,9351.71,10500,8445,8523.61,1609726.154564
|
||||
1583020800000,8523.61,9188,3782.13,6410.44,3789768.913125
|
||||
1585699200000,6412.14,9460,6150.11,8620,2528373.691121
|
||||
1588291200000,8620,10067,8117,9448.27,2685340.078508
|
||||
1590969600000,9448.27,10380,8833,9138.55,1504745.517922
|
||||
1593561600000,9138.08,11444,8893.03,11335.46,1507827.21494
|
||||
1596240000000,11335.46,12468,10518.5,11649.51,1891193.007128
|
||||
1598918400000,11649.51,12050.85,9825,10776.59,1730389.160179
|
||||
1601510400000,10776.59,14100,10374,13791,1592634.419946
|
||||
1604188800000,13791,19863.16,13195.05,19695.87,2707064.911165
|
||||
1606780800000,19695.87,29300,17572.33,28923.63,2495281.856217
|
||||
1609459200000,28923.63,41950,28130,33092.98,3440864.750019
|
||||
1612137600000,33092.97,58352.8,32296.16,45135.66,2518242.148517
|
||||
1614556800000,45134.11,61844,44950.53,58740.55,2098808.027432
|
||||
1617235200000,58739.46,64854,46930,57694.27,1993468.938007
|
||||
1619827200000,57697.25,59500,30000,37253.81,3536245.256573
|
||||
1622505600000,37253.82,41330,28805,35045,2901775.305923
|
||||
1625097600000,35045,42448,29278,41461.83,1778463.264837
|
||||
1627776000000,41461.84,50500,37332.7,47100.89,1635402.874245
|
||||
1630454400000,47100.89,52920,39600,43824.1,1527799.510768
|
||||
1633046400000,43820.01,67000,43283.03,61299.8,1565556.292623
|
||||
1635724800000,61299.81,69000,53256.64,56950.56,1291900.105248
|
||||
1638316800000,56950.56,59053.55,42000.3,46216.93,1233745.524318
|
||||
1640995200000,46216.93,47990,32917.17,38466.9,1279407.465721
|
||||
1643673600000,38466.9,45821,34322.28,43160,1253514.21906
|
||||
1646092800000,43160,48189.84,37155,45510.34,1501398.79591
|
||||
1648771200000,45510.35,47444.11,37578.2,37630.8,1267655.68178
|
||||
1651363200000,37630.8,40023.77,26700,31801.04,2387839.680804
|
||||
1654041600000,31801.05,31982.97,17622,19942.21,2816058.473226
|
||||
1656633600000,19942.21,24668,18781,23293.32,4983278.5881
|
||||
1659312000000,23296.36,25211.32,19520,20050.02,5692462.41571
|
||||
1661990400000,20048.44,22799,18125.98,19422.61,9838930.53657
|
||||
1664582400000,19422.61,21085,18190,20490.74,7499121.81542
|
||||
1667260800000,20490.74,21480.65,15476,17163.64,9127693.509065
|
||||
1669852800000,17165.53,18387.95,16256.3,16542.4,5803833.88187
|
||||
1672531200000,16541.77,23960.54,16499.01,23125.13,7977028.87801
|
||||
1675209600000,23125.13,25250,21351.07,23141.57,8642691.27165
|
||||
1677628800000,23141.57,29184.68,19549.09,28465.36,9516189.35846
|
||||
1680307200000,28465.36,31000,26942.82,29233.21,1626745.5585
|
||||
1682899200000,29233.2,29820,25811.46,27210.35,1302000.49221
|
||||
1685577600000,27210.36,31431.94,24800,30472,1387207.48275
|
||||
1688169600000,30471.99,31804.2,28861.9,29232.25,925773.81731
|
||||
1690848000000,29232.26,30244,25166,25940.78,1025866.55023
|
||||
1693526400000,25940.77,27483.57,24901,26962.56,809329.04893
|
||||
1696118400000,26962.57,35280,26538.66,34639.77,1141403.6799
|
||||
1698796800000,34639.78,38450,34097.39,37723.96,1055690.59638
|
||||
1701388800000,37723.97,44700,37615.86,42283.58,1195409.976
|
||||
1704067200000,42283.58,48969.48,38555,42580,1403408.84978
|
||||
1706745600000,42580,64000,41884.28,61130.98,1206112.69545
|
||||
1709251200000,61130.99,73777,59005,71280.01,1706807.381342
|
||||
1711929600000,71280,72797.99,59191.6,60672,1201500.95852
|
||||
1714521600000,60672.01,71979,56552.82,67540.01,945031.04072
|
||||
1717200000000,67540.01,71997.02,58402,62772.01,696818.18818
|
||||
1719792000000,62772.01,70079.99,53485.93,64628,908004.33426
|
||||
1722470400000,64628.01,65659.78,49000,58973.99,1010291.47396
|
||||
1725148800000,58974,66498,52550,63327.59,734117.07575
|
||||
1727740800000,63327.6,73620.12,58946,70292.01,756010.86343
|
||||
1730419200000,70292.01,99588.01,66835,96407.99,1343559.242196
|
||||
1733011200000,96407.99,108353,90500,93576,1019450.065773
|
||||
1735689600000,93576,109588,89256.69,102429.56,864534.738322
|
||||
1738368000000,102429.56,102783.71,78258.52,84349.94,810850.1813
|
||||
1740787200000,84349.95,95000,76606,82550.01,845293.53101
|
||||
1743465600000,82550,95758.04,74508,94172,793597.00179
|
||||
1746057600000,94172,111980,93377,104591.88,642216.546125
|
||||
1748736000000,104591.88,110530.17,98200,107146.5,427546.46336
|
||||
1751328000000,107146.51,123218,105100.19,115764.08,484315.651017
|
||||
1754006400000,115764.07,124474,107350.1,108246.35,471366.942936
|
||||
1756684800000,108246.36,117900,107255,114048.93,374551.99407
|
||||
1759276800000,114048.94,126199.63,102000,109608.01,720300.285006
|
||||
1761955200000,109608.01,111250.01,80600,90360,784853.66178
|
||||
1764547200000,90360.01,94588.99,83822.76,87648.22,491084.34878
|
||||
1767225600000,87648.21,97924.49,75719.9,78741.09,491752.73296
|
||||
1769904000000,78741.1,79424,60000,66973.26,837887.67719
|
||||
1772323200000,66973.26,76000,65000,68284.48,705639.88404
|
||||
1775001600000,68284.49,79485.66,65712.12,76346.57,473256.46982
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -2,8 +2,9 @@
|
||||
//! and write them as CSV datasets under `examples/data/`.
|
||||
//!
|
||||
//! These are the datasets the indicator benchmarks (`benches/indicators.rs`)
|
||||
//! and the `example_data` integration test run against. Re-run this example
|
||||
//! to refresh them with the latest market history:
|
||||
//! and the `example_data` integration test run against. They live at the
|
||||
//! workspace `examples/data/` directory. Re-run this example to refresh
|
||||
//! them with the latest market history:
|
||||
//!
|
||||
//! ```text
|
||||
//! cargo run -p wickra --example fetch_btcusdt
|
||||
@@ -96,6 +97,8 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
.map_err(|_| "system clock is beyond the i64 millisecond range")?;
|
||||
|
||||
let data_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||
.join("..")
|
||||
.join("..")
|
||||
.join("examples")
|
||||
.join("data");
|
||||
std::fs::create_dir_all(&data_dir)?;
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
//! hold enough rows, and carry strictly increasing — and, for the fixed
|
||||
//! timeframes, evenly spaced — timestamps.
|
||||
//!
|
||||
//! The datasets live in `examples/data/` and are produced by the
|
||||
//! `fetch_btcusdt` example. Regenerate them with:
|
||||
//! The datasets live in the workspace `examples/data/` directory and are
|
||||
//! produced by the `fetch_btcusdt` example. Regenerate them with:
|
||||
//!
|
||||
//! ```text
|
||||
//! cargo run -p wickra --example fetch_btcusdt
|
||||
//! cargo run -p wickra-examples --bin fetch_btcusdt
|
||||
//! ```
|
||||
|
||||
use wickra_data::csv::CandleReader;
|
||||
@@ -26,7 +26,7 @@ const DATASETS: &[(&str, usize, Option<i64>)] = &[
|
||||
];
|
||||
|
||||
fn dataset_path(file: &str) -> String {
|
||||
format!("{}/examples/data/{file}", env!("CARGO_MANIFEST_DIR"))
|
||||
format!("{}/../../examples/data/{file}", env!("CARGO_MANIFEST_DIR"))
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user