Skip to main content

sandbox_quant/dataset/
types.rs

1use crate::app::bootstrap::BinanceMode;
2
3#[derive(Debug, Default, Clone, PartialEq, Eq)]
4pub struct RecorderMetrics {
5    pub liquidation_events: u64,
6    pub book_ticker_events: u64,
7    pub agg_trade_events: u64,
8    pub derived_kline_1s_bars: u64,
9    pub schema_version: Option<String>,
10    pub last_liquidation_event_time: Option<String>,
11    pub last_book_ticker_event_time: Option<String>,
12    pub last_agg_trade_event_time: Option<String>,
13    pub top_liquidation_symbols: Vec<String>,
14    pub top_book_ticker_symbols: Vec<String>,
15    pub top_agg_trade_symbols: Vec<String>,
16}
17
18#[derive(Debug, Clone, PartialEq)]
19pub struct LiquidationEventRow {
20    pub event_time_ms: i64,
21    pub force_side: String,
22    pub price: f64,
23    pub qty: f64,
24    pub notional: f64,
25}
26
27#[derive(Debug, Clone, PartialEq)]
28pub struct BookTickerRow {
29    pub event_time_ms: i64,
30    pub bid: f64,
31    pub ask: f64,
32}
33
34#[derive(Debug, Clone, PartialEq)]
35pub struct DerivedKlineRow {
36    pub open_time_ms: i64,
37    pub close_time_ms: i64,
38    pub open: f64,
39    pub high: f64,
40    pub low: f64,
41    pub close: f64,
42    pub volume: f64,
43    pub quote_volume: f64,
44    pub trade_count: u64,
45}
46
47#[derive(Debug, Clone, PartialEq, Eq)]
48pub struct BacktestDatasetSummary {
49    pub mode: BinanceMode,
50    pub symbol: String,
51    pub symbol_found: bool,
52    pub from: String,
53    pub to: String,
54    pub liquidation_events: u64,
55    pub book_ticker_events: u64,
56    pub agg_trade_events: u64,
57    pub derived_kline_1s_bars: u64,
58}
59
60#[derive(Debug, Clone, PartialEq)]
61pub struct BacktestRunSummaryRow {
62    pub run_id: i64,
63    pub created_at: String,
64    pub mode: BinanceMode,
65    pub template: String,
66    pub instrument: String,
67    pub from: String,
68    pub to: String,
69    pub trigger_count: u64,
70    pub closed_trades: u64,
71    pub open_trades: u64,
72    pub wins: u64,
73    pub losses: u64,
74    pub net_pnl: f64,
75    pub ending_equity: f64,
76}