Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
05435e4
Added QuestDB tick streaming
mccaffers Apr 11, 2026
16fb2c3
Refactoring tick flow
mccaffers Apr 11, 2026
3ba4cec
Looping around tick data from multiple symbols
mccaffers Apr 12, 2026
46e720d
Update source/CMakeLists.txt
mccaffers Apr 12, 2026
61309bd
Apply suggestions from code review
mccaffers Apr 12, 2026
48a9a99
Refactoring
mccaffers Apr 12, 2026
fab3106
Merge branch '10-create-end-to-end-trade-management-logic' of github.…
mccaffers Apr 12, 2026
85be15b
fix run script, shell scopping behaviour was putting the build script…
mccaffers Apr 12, 2026
cbc033d
Update build os to target macos-latest
mccaffers Apr 12, 2026
bb24f06
Update build os to target macos-latest
mccaffers Apr 12, 2026
27f82f1
Updating github workflow os
mccaffers Apr 12, 2026
e4e8e13
Refactoring build pipeline
mccaffers Apr 19, 2026
0b6d40e
fixing workflow
mccaffers Apr 25, 2026
8a0a710
Updating github workflow os
mccaffers Apr 26, 2026
801c846
Updating github workflow os
mccaffers Apr 26, 2026
b57db36
Updating github workflow os
mccaffers Apr 26, 2026
9a60a27
Updating github workflow os
mccaffers Apr 26, 2026
edb253f
Updating main flow, extracting the strategy to query questdB
mccaffers Apr 27, 2026
657b5e2
Updating trade management operations
mccaffers Apr 28, 2026
87bc95e
Refactoring operations flow
mccaffers Apr 29, 2026
83d838f
updated workflows and optimised build & test
mccaffers May 2, 2026
e1ddeaa
updated workflow references
mccaffers May 2, 2026
28ce018
updated workflow references
mccaffers May 2, 2026
cb840fd
updated workflow references
mccaffers May 2, 2026
3f52047
updated workflow references
mccaffers May 2, 2026
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
23 changes: 0 additions & 23 deletions .github/workflows/build.sh

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]

name: Build

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
build:
name: Build & Test
runs-on: macos-26

steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@main

- name: Install dependencies
run: bash ./.github/workflows/scripts/brew.sh

- name: Build C++ Libraries
run: bash ./scripts/build_dep.sh

- name: Select Xcode version
run: sudo xcode-select -switch /Applications/Xcode.app

- name: Run tests
run: >
OTHER_CFLAGS="-fprofile-instr-generate -fcoverage-mapping"
OTHER_CPLUSPLUSFLAGS="-fprofile-instr-generate -fcoverage-mapping"
OTHER_SWIFT_FLAGS="-profile-generate -profile-coverage-mapping"
LLVM_PROFILE_FILE="/tmp/coverage.profraw"
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
xcodebuild
-scheme tests
-destination 'platform=macOS'
-resultBundlePath TestResult/
-enableCodeCoverage YES
-derivedDataPath "${RUNNER_TEMP}/Build/DerivedData"
-parallelizeTargets
-jobs "$(sysctl -n hw.logicalcpu)"
HEADER_SEARCH_PATHS="./external/libpqxx/include/pqxx/internal ./external/libpqxx/include/ ./external/libpqxx/build/include/ ./external/"
LIBRARY_SEARCH_PATHS="./external/libpqxx/src/ ./external/libpqxx/build/src/"
OTHER_LDFLAGS="-L./external/libpqxx/build/src -lpqxx -lpq -L$(brew --prefix pkgconf)/lib -L$(brew --prefix pkgconf)/lib/pkgconfig -L$(brew --prefix postgresql@18)/lib/postgresql -L$(brew --prefix postgresql@18)/lib/postgresql/pgxs -L$(brew --prefix postgresql@18)/lib/postgresql/pkgconfig"
clean build test
| xcpretty -r junit && exit ${PIPESTATUS[0]}

- name: Convert coverage report to sonarqube format
run: >
bash ./.github/workflows/scripts/xccov-to-sonarqube-generic.sh *.xcresult/ > sonarqube-generic-coverage.xml

- name: Upload coverage report
uses: actions/upload-artifact@v7
with:
name: sonarqube-coverage
path: sonarqube-generic-coverage.xml
retention-days: 1
File renamed without changes.
88 changes: 88 additions & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
on:
# Triggered on completion of the Build workflow so we can consume its
# coverage artifact. workflow_run fires regardless of whether the upstream
# was triggered by push or pull_request.
workflow_run:
workflows: ["Build"]
types: [completed]

name: SonarCloud Scan

env:
BUILD_TYPE: Release
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
# Opt into Node.js 24 for JavaScript actions ahead of the June 2026 default switch.
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:

sonar-scan:
name: SonarCloud Scan
runs-on: ubuntu-latest
# Only run if the upstream Build workflow succeeded.
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
# Check out the same commit the Build workflow ran against. workflow_run
# otherwise defaults to the default branch.
- name: Checkout repository on branch
uses: actions/checkout@v5
with:
ref: ${{ github.event.workflow_run.head_sha }}
fetch-depth: 0
- name: Check compiler version, for debugging
run: |
g++ --version
cmake --version
- name: Build C++ Libraries
run: >
sh ./scripts/build.sh
- name: Install Python 3.12 for gcovr
uses: actions/setup-python@v6
with:
python-version: 3.12
# Gcovr provides a utility for managing the use of the GNU gcov utility and generating
# summarized code coverage results. This command is inspired by the Python coverage.py
# package, which provides a similar utility for Python.
# https://pypi.org/project/gcovr/
- name: Install gcovr
run: |
pip install gcovr==8.3
# SonarQube Server and Cloud (formerly SonarQube and SonarCloud) is a widely used static
# analysis solution for continuous code quality and security inspection.
# This action now supports and is the official entrypoint for scanning C++ projects via GitHub actions.
# https://github.com/SonarSource/sonarqube-scan-action
- name: Install Build Wrapper
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v4.2.1
# This step installs the SonarQube build wrapper, which is necessary for analyzing C/C++ projects.

# Cross-workflow artifact download. v4 requires run-id and github-token
# when fetching from a different workflow run. The artifact lands at
# ./artifact/sonarqube-generic-coverage.xml so the existing
# sonar.coverageReportPaths argument keeps working unchanged.
- name: Download coverage artifact from Build workflow
uses: actions/download-artifact@v5
with:
name: sonarqube-coverage
path: artifact
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}

# Configures the CMake build system, specifying the source directory and build directory, and setting the build type
- name: Configure CMake
run: cmake -S ${{github.workspace}} -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

# Runs the build wrapper to capture build commands and outputs them to the specified directory. Then builds the project using CMake
- name: Run build-wrapper
run: |
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --clean-first

# Performs the SonarQube scan using the scan action. Uses captured build commands for analysis and requires GitHub and SonarQube tokens for authentication
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v4.2.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
--define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
--define sonar.coverageReportPaths=artifact/sonarqube-generic-coverage.xml
137 changes: 0 additions & 137 deletions .github/workflows/sonarcloud.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"configurations": [
{
"name": "Mac",
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
"includePath": [
"${workspaceFolder}/external/libpqxx/include"
]
}
],
"version": 4
}
15 changes: 12 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ project(BacktestingEngine)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)


# Configure libpqxx build
set(PQXX_LIBRARIES_INSTALL ON)
set(SKIP_BUILD_TEST ON)
Expand Down Expand Up @@ -51,8 +50,18 @@ file(GLOB_RECURSE SOURCES "source/*.cpp")
# Create a library of your project's code
add_library(BacktestingEngineLib STATIC ${SOURCES})

# Link against pqxx
target_link_libraries(BacktestingEngineLib pqxx)
# Configure OpenMP. On Apple, provide Homebrew libomp hints before discovery.
if(APPLE)
set(OpenMP_C_FLAGS "-Xclang -fopenmp")
set(OpenMP_CXX_FLAGS "-Xclang -fopenmp")
set(OpenMP_C_LIB_NAMES "omp")
set(OpenMP_CXX_LIB_NAMES "omp")
set(OpenMP_omp_LIBRARY /opt/homebrew/opt/libomp/lib/libomp.dylib)
target_include_directories(BacktestingEngineLib PRIVATE /opt/homebrew/opt/libomp/include)
Comment on lines +53 to +60

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coding OpenMP_omp_LIBRARY and the include path to /opt/homebrew/... will break on Apple systems that don’t use that prefix (or don’t have libomp installed there). Prefer letting find_package(OpenMP) locate OpenMP, or derive the path dynamically (e.g., via brew --prefix libomp) and fail with a clear message if it’s missing.

Suggested change
# Configure OpenMP. On Apple, provide Homebrew libomp hints before discovery.
if(APPLE)
set(OpenMP_C_FLAGS "-Xclang -fopenmp")
set(OpenMP_CXX_FLAGS "-Xclang -fopenmp")
set(OpenMP_C_LIB_NAMES "omp")
set(OpenMP_CXX_LIB_NAMES "omp")
set(OpenMP_omp_LIBRARY /opt/homebrew/opt/libomp/lib/libomp.dylib)
target_include_directories(BacktestingEngineLib PRIVATE /opt/homebrew/opt/libomp/include)
# Configure OpenMP. On Apple, provide dynamic Homebrew libomp hints before discovery.
if(APPLE)
set(OpenMP_C_FLAGS "-Xclang -fopenmp")
set(OpenMP_CXX_FLAGS "-Xclang -fopenmp")
set(OpenMP_C_LIB_NAMES "omp")
set(OpenMP_CXX_LIB_NAMES "omp")
execute_process(
COMMAND brew --prefix libomp
OUTPUT_VARIABLE LIBOMP_PREFIX
RESULT_VARIABLE LIBOMP_PREFIX_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
if(NOT LIBOMP_PREFIX_RESULT EQUAL 0 OR LIBOMP_PREFIX STREQUAL "")
message(FATAL_ERROR "OpenMP support on Apple requires libomp. Install it with Homebrew (`brew install libomp`) or make it discoverable to CMake.")
endif()
set(OpenMP_ROOT "${LIBOMP_PREFIX}")

Copilot uses AI. Check for mistakes.
endif()

find_package(OpenMP REQUIRED)
target_link_libraries(BacktestingEngineLib PUBLIC pqxx OpenMP::OpenMP_CXX)

# Main executable
add_executable(BacktestingEngine source/main.cpp)
Expand Down
Loading