From eac06d08d56a9e2cd93d5278c948a885107545e7 Mon Sep 17 00:00:00 2001 From: sheriff4000 Date: Sat, 8 Jun 2024 15:35:21 +0100 Subject: [PATCH 1/3] change httype to symbol --- src/Backtest/strategies/FALM.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Backtest/strategies/FALM.jl b/src/Backtest/strategies/FALM.jl index dcb3ccd..e3facdb 100644 --- a/src/Backtest/strategies/FALM.jl +++ b/src/Backtest/strategies/FALM.jl @@ -37,7 +37,7 @@ function falm_initialize!( transactionCost::Real=0.02, # Transaction cost currency::String="FEX/USD", # Currency to use forecaster::Forecaster=LinearForecaster(1; reparameterise_window=0), # Forecasting function - httype::Int=1, # 1: Weighted Average holding time, 2: Minimum holding time + httype::Symbol=:average, # 1: Weighted Average holding time, 2: Minimum holding time min_alloc_threshold::Float64=0.7, min_returns_threshold::Float64=0.0002, ) @@ -146,7 +146,7 @@ function compute_portfolio!(context::ContextTypeA; data=DataFrame()) ) end - if context.extra.httype == 1 + if context.extra.httype == :average # Weighted Average Holding time context.extra.htcounter = round(Int, holding_time) else From 4b80b17e9c04570a35f74b8442c6008867ea8c75 Mon Sep 17 00:00:00 2001 From: sheezy <93779333+sheriff4000@users.noreply.github.com> Date: Sun, 9 Jun 2024 15:41:16 +0100 Subject: [PATCH 2/3] initialise htcounter --- test/backtest_FALM.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/test/backtest_FALM.jl b/test/backtest_FALM.jl index 8ccedfb..0176f3d 100644 --- a/test/backtest_FALM.jl +++ b/test/backtest_FALM.jl @@ -45,6 +45,7 @@ using Logging # Simulation functions definition function initialize!(context) + context.extra.htcounter = 0 return falm_initialize!(context; tickers=tickers, assetIDs=assetIDs) end From 4ebfa5b37efd5a139e580b866a39b4136a07b725 Mon Sep 17 00:00:00 2001 From: sheezy <93779333+sheriff4000@users.noreply.github.com> Date: Sun, 9 Jun 2024 15:44:18 +0100 Subject: [PATCH 3/3] redundant htcounter init --- test/backtest_FALM.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/test/backtest_FALM.jl b/test/backtest_FALM.jl index 0176f3d..8ccedfb 100644 --- a/test/backtest_FALM.jl +++ b/test/backtest_FALM.jl @@ -45,7 +45,6 @@ using Logging # Simulation functions definition function initialize!(context) - context.extra.htcounter = 0 return falm_initialize!(context; tickers=tickers, assetIDs=assetIDs) end