Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ csv = "1.3"

# Hyperliquid SDK
hyperliquid_rust_sdk = "0.6.0"

# Backtesting framework
# Backtesting framework
rs-backtester = "0.1.2"

# HTTP client
reqwest = { version = "0.11", features = ["json"] }

# HTTP client
reqwest = { version = "0.11", default-features = false, features = ["json", "rustls-tls"] }
openssl = { version = "0.10", features = ["vendored"] }

# Logging and debugging
log = "0.4"
Expand Down
10 changes: 10 additions & 0 deletions src/strategies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,16 @@
//! }
//! ```

pub mod trading_strategy;
pub mod funding_arbitrage_strategy;
pub mod enhanced_sma_strategy;
pub mod strategy_template;

pub use trading_strategy::{TradingStrategy, StrategyConfig, StrategyState, BaseTradingStrategy};
pub use funding_arbitrage_strategy::create_funding_arbitrage_strategy;
pub use enhanced_sma_strategy::create_enhanced_sma_strategy;
pub use strategy_template::create_strategy_template;

use rs_backtester::strategies::Strategy;
use rs_backtester::datas::Data;
use serde::{Deserialize, Serialize};
Expand Down
10 changes: 5 additions & 5 deletions src/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1489,19 +1489,19 @@ fn create_long_time_series_test_data(size: usize) -> HyperliquidData {
}

/// Create invalid format data for error testing
fn create_invalid_format_data() -> Result<HyperliquidData, &'static str> {
fn create_invalid_format_data() -> std::result::Result<HyperliquidData, &'static str> {
// Simulate data with invalid format
Err("Invalid data format")
}

/// Create data with missing timestamps for error testing
fn create_missing_timestamp_data() -> Result<HyperliquidData, &'static str> {
fn create_missing_timestamp_data() -> std::result::Result<HyperliquidData, &'static str> {
// Simulate data with missing timestamps
Err("Missing timestamp data")
}

/// Create data with inconsistent lengths for error testing
fn create_inconsistent_length_data() -> Result<HyperliquidData, &'static str> {
fn create_inconsistent_length_data() -> std::result::Result<HyperliquidData, &'static str> {
// This would create data with mismatched vector lengths
// For now, return an error to simulate the detection of this issue
Err("Inconsistent data lengths")
Expand Down Expand Up @@ -1741,7 +1741,7 @@ fn create_v2_api_response() -> String {
}

/// Parse API response for compatibility testing
fn parse_api_response(response: &str) -> Result<(), Box<dyn std::error::Error>> {
fn parse_api_response(response: &str) -> std::result::Result<(), Box<dyn std::error::Error>> {
let _parsed: serde_json::Value = serde_json::from_str(response)?;
Ok(())
}
Expand Down Expand Up @@ -2063,7 +2063,7 @@ fn create_v2_api_response() -> String {
}

/// Parse API response for compatibility testing
fn parse_api_response(response: &str) -> Result<(), Box<dyn std::error::Error>> {
fn parse_api_response(response: &str) -> std::result::Result<(), Box<dyn std::error::Error>> {
let _parsed: serde_json::Value = serde_json::from_str(response)?;
Ok(())
}
Expand Down
6 changes: 3 additions & 3 deletions src/tests/regression_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ async fn test_edge_case_regression_prevention() {
// ============================================================================

/// Create single data point for edge case testing
fn create_single_point_data() -> Result<HyperliquidData, &'static str> {
fn create_single_point_data() -> std::result::Result<HyperliquidData, &'static str> {
let datetime = vec![
DateTime::from_timestamp(1640995200, 0)
.unwrap()
Expand All @@ -920,7 +920,7 @@ fn create_single_point_data() -> Result<HyperliquidData, &'static str> {
}

/// Create data with identical prices for edge case testing
fn create_identical_price_data() -> Result<HyperliquidData, &'static str> {
fn create_identical_price_data() -> std::result::Result<HyperliquidData, &'static str> {
let size = 100;
let datetime: Vec<DateTime<FixedOffset>> = (0..size)
.map(|i| {
Expand All @@ -946,7 +946,7 @@ fn create_identical_price_data() -> Result<HyperliquidData, &'static str> {
}

/// Create data with extreme values for edge case testing
fn create_extreme_value_data() -> Result<HyperliquidData, &'static str> {
fn create_extreme_value_data() -> std::result::Result<HyperliquidData, &'static str> {
let size = 50;
let datetime: Vec<DateTime<FixedOffset>> = (0..size)
.map(|i| {
Expand Down
Loading