MCPcopy Create free account
hub / github.com/Open-Quant/openquant / labeling_meta_labels

Function labeling_meta_labels

crates/pyopenquant/src/labeling.rs:152–188  ·  view source on GitHub ↗
(
    close_timestamps: Vec<String>,
    close_prices: Vec<f64>,
    t_events: Vec<String>,
    target_timestamps: Vec<String>,
    target_values: Vec<f64>,
    side_prediction: Vec<(String, f64)>,
  

Source from the content-addressed store, hash-verified

150fn labeling_meta_labels(
151 close_timestamps: Vec<String>,
152 close_prices: Vec<f64>,
153 t_events: Vec<String>,
154 target_timestamps: Vec<String>,
155 target_values: Vec<f64>,
156 side_prediction: Vec<(String, f64)>,
157 pt: f64,
158 sl: f64,
159 min_ret: f64,
160 vertical_barrier_times: Option<Vec<(String, String)>>,
161) -> PyResult<Vec<(String, f64, f64, i8, Option<f64>)>> {
162 let (close, events) = build_labeling_events(
163 close_timestamps,
164 close_prices,
165 t_events,
166 target_timestamps,
167 target_values,
168 pt,
169 sl,
170 min_ret,
171 vertical_barrier_times,
172 Some(side_prediction),
173 )?;
174 Ok(openquant::labeling::meta_labels(&events, &close)
175 .into_iter()
176 .map(|row| {
177 (
178 row.timestamp.format("%Y-%m-%d %H:%M:%S").to_string(),
179 row.ret,
180 row.trgt,
181 row.label,
182 row.side,
183 )
184 })
185 .collect())
186}
187
188#[pyfunction(name = "get_events")]
189#[pyo3(signature = (
190 close_timestamps,
191 close_prices,

Callers

nothing calls this directly

Calls 2

build_labeling_eventsFunction · 0.85
meta_labelsFunction · 0.85

Tested by

no test coverage detected