Skip to content

Commit

Permalink
Adds support for BT_TESTMODEL; renames BT_TESTMODE to BT_TESTMODEL
Browse files Browse the repository at this point in the history
  • Loading branch information
kenorb committed Apr 3, 2019
1 parent cd0c135 commit 0262bd4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions scripts/options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ Supported options:
Other supported variables (without options assigned):
- BT_DAYS (uint/string)
Specify days to test. Default: 1-31.
- BT_TESTMODE (uint)
This controls type of backtest data being downloaded.
- BT_TESTMODEL (uint)
This controls type of backtest data being downloaded and used.
Values: 0 (default) - Every tick, 1 - Control points, 2 - Open prices only
- OPT_NOERR (bool)
Disables errexit flag to prevent exiting script on failure.
Expand Down
13 changes: 11 additions & 2 deletions scripts/run_backtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -395,13 +395,22 @@ else
fi
fi

# Configure symbol pair.
if [ -n "$BT_SYMBOL" ]; then
echo "Configuring symbol pair ($BT_SYMBOL)..." >&2
ini_set "^TestSymbol" "$BT_SYMBOL" "$TESTER_INI"
else
BT_SYMBOL="$(ini_get TestSymbol)"
fi

# Configure testing mode.
if [ -n "$BT_TESTMODEL" ]; then
echo "Configuring test model ($BT_TESTMODEL)..." >&2
ini_set "^TestModel" "$BT_TESTMODEL" "$TESTER_INI"
else
BT_TESTMODEL="$(ini_get TestModel)"
fi

if [ -n "$TEST_OPTS" ]; then
echo "Applying tester settings ($TEST_OPTS)..." >&2
IFS=','; test_options=($TEST_OPTS); restore_ifs
Expand Down Expand Up @@ -708,7 +717,7 @@ if [ -n "$TEST_EXPERT" ]; then
# Generate backtest files if not present.
if [ -z "$(find "$TERMINAL_DIR" -name "${BT_SYMBOL}*_0.fxt" -print -quit)" ] || [ "${bt_data%.*}" != "$bt_key" ]; then
env SERVER=$SERVER OPT_VERBOSE=$OPT_VERBOSE OPT_TRACE=$OPT_TRACE \
$SHELL $SCR/get_bt_data.sh $BT_SYMBOL "$(join_by - ${BT_YEARS[@]:-2017})" ${BT_SRC:-DS} ${BT_PERIOD} ${BT_TESTMODE}
$SHELL $SCR/get_bt_data.sh $BT_SYMBOL "$(join_by - ${BT_YEARS[@]:-2017})" ${BT_SRC:-DS} ${BT_PERIOD} ${BT_TESTMODEL}
if [ -n "$OPT_VERBOSE" ]; then
cd "$TERMINAL_DIR"
find . '(' -name "*.hst" -o -name "*.fxt" ')' -ls
Expand All @@ -719,7 +728,7 @@ if [ -n "$TEST_EXPERT" ]; then
FXT_FILE=$(find "$TICKDATA_DIR" -name "*.fxt" -print -quit)
fi

# Prepare before test run.
# Final checks.
if [ -n "$TEST_EXPERT" ]; then
[ -n "$(find "$TERMINAL_DIR" '(' -name "*.hst" -o -name "*.fxt" ')' -size +1 -print -quit)" ] \
|| { echo "ERROR: Missing backtest data files." >&2; exit 1; }
Expand Down

0 comments on commit 0262bd4

Please sign in to comment.