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
use crate::prelude::*;
use crate::signal::*;
pub struct MyAlgo;
#[register_algorithm]
impl StockTrekAlgorithm for MyAlgo {
fn create_signal(&self, context: StockTrekContext) -> StockTrekSignal {
StockTrekSignal::builder()
.instrument(
Instrument::builder()
.product(crate::signal::InstrumentProduct::Spot)
.base("BTC")
.quote("USDT"),
)
.market_context(
MarketContext::builder()
.market_regime(
MarketRegime::builder()
.classifications(
MarketRegimeClassifications::builder()
.confidence(0.5)
.dominant("")
.top_alternatives(std::collections::HashMap::from([
("dskfsd".into(), 0.21),
("irewtnvc".into(), 0.17),
("cfhwrehk".into(), 0.15),
]))
.unclassified(0.2),
)
.cycle(
MarketRegimeCycle::builder()
.accumulation(0.3)
.distribution(0.5)
.markdown(0.1)
.markup(0.2)
.neutral(0.8),
)
.trend(
MarketRegimeTrend::builder()
.bearish(0.6)
.bullish(0.2)
.sideways(0.2),
)
.volatility(
MarketRegimeVolatility::builder()
.snapshot(
MarketRegimeVolatilitySnapshot::builder()
.high(0.1)
.low(0.9),
)
.trend(
MarketRegimeVolatilityTrend::builder()
.compression(0.5)
.expansion(0.5),
),
),
)
.regime_persistence(
RegimePersistence::builder()
.regime_persistence_confidence(0.7)
.remaining_durations_millis(483648732),
),
)
.prediction(
Prediction::builder()
.horizon_confidences_by_millis(HorizonConfidencesByMillis(
std::collections::HashMap::from([
("vgfhgkfd".into(), 549357438),
("cdiotkjr".into(), 549357438),
]),
))
.optimal_horizon_millis(1000)
.percentage_changes(
ConfidencePercentageChanges::builder()
.p01(-10.2)
.p05(-5.1)
.p10(-0.4)
.p25(3.9)
.p50(10.2)
.p75(16.5)
.p90(19.4)
.p95(20.4)
.p99(20.8),
)
.risk(
PredictionRisk::builder()
.percentage_risks(
PredictionRiskPercentageRisks::builder()
.cvar_95(-6.8)
.cvar_99(-7.2)
.max_drawdown_95(25.3)
.max_drawdown_99(31.8)
.var_95(-3.7)
.var_99(-4.5),
)
.risk_factors(std::collections::HashMap::from([
("dvxvxvvodsgrg".into(), 0.63),
("cnnfgvcxojtnn".into(), 0.41),
])),
)
.validity_duration_millis(1_000_000),
)
.try_into()
.expect("Expected StockTrekSignal")
}
}