work on new engine
This commit is contained in:
parent
44476da13f
commit
a1e5a21847
126 changed files with 3425 additions and 6695 deletions
52
apps/stock/engine/tests/integration_test.rs
Normal file
52
apps/stock/engine/tests/integration_test.rs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
// Simple integration test that verifies basic functionality
|
||||
|
||||
use engine::{Order, OrderType, Side, TimeInForce, TradingMode};
|
||||
use chrono::Utc;
|
||||
|
||||
#[test]
|
||||
fn test_trading_mode_creation() {
|
||||
let backtest_mode = TradingMode::Backtest {
|
||||
start_time: Utc::now(),
|
||||
end_time: Utc::now(),
|
||||
speed_multiplier: 1.0,
|
||||
};
|
||||
|
||||
match backtest_mode {
|
||||
TradingMode::Backtest { speed_multiplier, .. } => {
|
||||
assert_eq!(speed_multiplier, 1.0);
|
||||
}
|
||||
_ => panic!("Expected backtest mode"),
|
||||
}
|
||||
|
||||
let paper_mode = TradingMode::Paper {
|
||||
starting_capital: 100_000.0,
|
||||
};
|
||||
|
||||
match paper_mode {
|
||||
TradingMode::Paper { starting_capital } => {
|
||||
assert_eq!(starting_capital, 100_000.0);
|
||||
}
|
||||
_ => panic!("Expected paper mode"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_order_with_limit_price() {
|
||||
let order = Order {
|
||||
id: "limit-order-1".to_string(),
|
||||
symbol: "AAPL".to_string(),
|
||||
side: Side::Buy,
|
||||
quantity: 100.0,
|
||||
order_type: OrderType::Limit { price: 150.0 },
|
||||
time_in_force: TimeInForce::GTC,
|
||||
};
|
||||
|
||||
assert_eq!(order.symbol, "AAPL");
|
||||
assert_eq!(order.side, Side::Buy);
|
||||
assert_eq!(order.quantity, 100.0);
|
||||
|
||||
match order.order_type {
|
||||
OrderType::Limit { price } => assert_eq!(price, 150.0),
|
||||
_ => panic!("Expected limit order"),
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue