work on engine
This commit is contained in:
parent
a1e5a21847
commit
cbe8f0282c
12 changed files with 694 additions and 16 deletions
|
|
@ -14,6 +14,9 @@ pub mod strategy;
|
|||
pub mod simple_results;
|
||||
pub mod trade_tracker;
|
||||
|
||||
#[cfg(test)]
|
||||
mod price_tracking_test;
|
||||
|
||||
pub use engine::BacktestEngine;
|
||||
pub use event::{BacktestEvent, EventType};
|
||||
pub use strategy::{Strategy, Signal, SignalType};
|
||||
|
|
@ -35,6 +38,7 @@ pub struct CompletedTrade {
|
|||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct BacktestConfig {
|
||||
#[serde(default = "default_name")]
|
||||
pub name: String,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub strategy: Option<String>,
|
||||
|
|
@ -46,9 +50,18 @@ pub struct BacktestConfig {
|
|||
pub initial_capital: f64,
|
||||
pub commission: f64,
|
||||
pub slippage: f64,
|
||||
#[serde(default = "default_data_frequency")]
|
||||
pub data_frequency: String,
|
||||
}
|
||||
|
||||
fn default_name() -> String {
|
||||
"Backtest".to_string()
|
||||
}
|
||||
|
||||
fn default_data_frequency() -> String {
|
||||
"1d".to_string()
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct BacktestState {
|
||||
pub current_time: DateTime<Utc>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue