Skip to content

Commit

Permalink
CI/CD Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mccaffers committed Feb 11, 2024
0 parents commit a4f7b12
Show file tree
Hide file tree
Showing 161 changed files with 28,389 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .env/local.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
operatingEnvironment=backtesting
symbolFolder=tickdata
symbols="BTCUSD"
scalingFactor="BTCUSD,0.1;ETHUSD,0.1;JPNIDX225,1;SPNIDX35,1;FRAIDX40,1;DEUIDX40,1;AUSIDX200,1;USAIDXTECH,1;USAIDX500,1;USAIDX30,1;EURIDX600,1;GBRIDX100,1;EURUSD,10000;GBPUSD,10000;NZDUSD,10000;AUDUSD,10000;USDJPY,100;USDCAD,10000;USDCHF,10000"
accountEquity=1000
maximumDrawndownPercentage=50
strategy=RandomStrategy
reportingEnabled=false
runID=debugger
s3Bucket=
s3Path=
yearsStart=
yearsEnd=
runIteration=0
stopDistanceInPips=0
limitDistanceInPips=0
tradingSize=0
consoleLog=true
systemLog=true
doNotCleanUpDataFolder=false
instanceCount=0
elasticUser=elastic
kineticStopLoss=0
kineticLimit=0
randomStrategyAmountOfHHLL=10
elasticPassword=
elasticEndpoint=
elasticCloudID=
73 changes: 73 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:

- uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x

- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

# - name: build
# run: dotnet build


- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
57 changes: 57 additions & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Sonar
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: windows-latest
steps:
- uses: actions/setup-java@v4
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '21'
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~\.sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v1
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Test
run: dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- name: Begin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: .\.sonar\scanner\dotnet-sonarscanner begin /k:"mccaffers_backtesting-engine" /o:"mccaffers" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="./tests/coverage.opencover.xml"
- name: Build
run: dotnet build
- name: Sonar End
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
43 changes: 43 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
*.swp
*.*~
project.lock.json
.DS_Store
*.pyc
nupkg/

# Rider
.idea

# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
msbuild.log
msbuild.err
msbuild.wrn

# Visual Studio 2015
.vs/

.env/local.env
.env/aws.env
engine.zip
tickdata/
scripts/data.sh
src/ui/src/libs/
scripts/backtestings/data.sh
src/strategies/private
43 changes: 43 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"version": "0.2.0",

"configurations": [
{
"name": "Chrome",
"type": "chrome",
"request": "attach",
"url": "https://localhost:3000", // create-react-app's default port 3000
"port": 9222,
"webRoot": "${workspaceFolder}/src/ui",
"preLaunchTask": "npm: start" // Add prelaunch Task npm: start (defined in tasks.json)
},
{
"name": "Trade via Console",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/backtesting/bin/Debug/net8.0/backtesting-engine.dll",
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopAtEntry": false,
"envFile": "${workspaceFolder}/.env/local.env"
},
{
"name": "Trade via Web",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/backtesting/bin/Debug/net8.0/backtesting-engine.dll",
"args": ["web"],
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopAtEntry": false,
"envFile": "${workspaceFolder}/.env/local.env"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}
64 changes: 64 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/backtesting-engine.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/backtesting-engine.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/backtesting-engine.sln"
],
"problemMatcher": "$msCompile"
},
{
"type": "npm",
"script": "start",
"group": {
"kind": "test",
"isDefault": true
},
"isBackground": true, // This prevents the launch.json to wait for the completion of the task
"problemMatcher": {
"owner": "custom", // This is not needed but, required by the problemMatcher Object
"pattern": {
"regexp": "^$" // This is not needed but, required by the problemMatcher Object
},
"background": {
"activeOnStart": true,
"beginsPattern": "Compiling...", // Signals the begin of the Task
"endsPattern": "Compiled .*" // Signals that now the initialization of the task is complete
}
},
"options": {
"cwd": "${workspaceFolder}/src/ui"
}
}
]
}
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Ryan McCaffery

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit a4f7b12

Please sign in to comment.