You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*Read more results on https://mccaffers.com/randomly_trading/*
17
+
*Read more results on https://mccaffers.com/quantitative_analysis/randomly_trading/*
18
18
19
19
## Setup
20
20
21
-
This backtesting engine can pull tick data from local files or from a Postgres database. I'm using QuestDB.
21
+
This backtesting engine can pull tick data from local files or from a Postgres database (I'm using QuestDB). Strategy execution is dispatched via a Redis list called `strategy_queue`, with each entry a Base64-encoded JSON payload — the `load` subcommand enqueues strategies (LPUSH) and the `run` subcommand dequeues and executes them (RPOP). The default workflow expects a local `redis-server` listening on `127.0.0.1:6379`.
22
22
23
23
### Clone with submodules
24
24
@@ -40,6 +40,19 @@ For OpenSuse: zypper in postgresql-devel
40
40
For ArchLinux: pacman -S postgresql-libs
41
41
```
42
42
43
+
### Install Boost, OpenSSL, and Redis
44
+
45
+
Boost.Redis is header-only but its single translation unit (compiled via `<boost/redis/src.hpp>` from `source/redisRunner.cpp`) pulls in Boost.Asio's SSL layer, so OpenSSL is a transitive requirement. A local `redis-server` on `127.0.0.1:6379` is also needed for the default `load`/`run` workflow.
46
+
47
+
```
48
+
For Mac Homebrew: brew install boost openssl redis
49
+
For Ubuntu/Debian systems: sudo apt-get install libboost-all-dev libssl-dev redis-server
50
+
```
51
+
52
+
The canonical CI prerequisite list lives in `.github/workflows/scripts/brew.sh` (`postgresql`, `pkg-config`, `boost`).
53
+
54
+

55
+
43
56
### Build dependencies
44
57
45
58
`libpqxx` is built once via CMake. `boost-decimal` is header-only and pulled in via `add_subdirectory` from the top-level `CMakeLists.txt` — nothing to build. The script below handles the libpqxx build:
@@ -76,7 +89,28 @@ Xcode - Library Path
76
89
77
90
### Run via terminal
78
91
79
-
`bash ./scripts/run.sh`
92
+
`bash ./scripts/run.sh` builds the project, then — if `redis-cli ping` reaches a local Redis — enqueues an inline JSON strategy via `load` and executes it via `run localhost`. If Redis is unreachable the script prints a message and exits cleanly (see `scripts/run.sh:22-25`), so first-time users without Redis still get a clear signal.
93
+
94
+
The `BacktestingEngine` binary exposes a subcommand CLI:
95
+
96
+
```
97
+
BacktestingEngine load <path> [path...]
98
+
Read each file as raw JSON, Base64-encode it, and LPUSH onto the Redis
99
+
`strategy_queue` list.
100
+
101
+
BacktestingEngine run <questdb-host>
102
+
RPOP one Base64-encoded strategy from `strategy_queue` and execute it
103
+
against the supplied QuestDB host.
104
+
105
+
BacktestingEngine run <questdb-host> <base64-config>
106
+
Decode the supplied Base64 strategy and execute it directly, bypassing
107
+
Redis.
108
+
109
+
BacktestingEngine -h | --help
110
+
Show usage.
111
+
```
112
+
113
+
Defaults are `127.0.0.1:6379` for the Redis endpoint and `strategy_queue` for the list key (see `include/redisRunner.hpp` and `include/redisLoader.hpp`).
0 commit comments