Skip to content

This backtesting engine is a personal project of mine, built in C# to explore and experiment with various trading strategies at scale.

License

Notifications You must be signed in to change notification settings

mccaffers/backtesting-engine

Repository files navigation

C# Backtesting Engine

Active development

Working build! Requires local tick data. Evaluate locally with dotnet test - 49 tests should pass, 1 skipped

About The Project

I'm developing a high-performance C# backtesting engine designed to analyze financial data and evaluate multiple trading strategies at scale.

alt Quality Gate Status Build Bugs Coverage

I'm extracting results and creating various graphs for trend analyses using SciPy for calculations and Plotly for visualization.

alt text

Read more results on https://mccaffers.com/randomly_trading/

Features

  • Multiple symbol ingest with time synchronisation
  • 50 xUnit testing across Trade Management, Ingest, Reporting & Utilities
  • Trade Environment
    • Trade Excution
    • Equity Monitoring
  • Reporting (ElasticSearch)

Getting Started

To begin with, ensure you can run the application with dotnet test

Local Terminal

sh ./scripts/backtesting/run.sh

Local Web & Terminal (requires canvasjs.min.js)

sh ./scripts/backtesting/web.sh

Dependencies

  • dotnet v8

  • ElasticSearch for reporting

  • CanvasJS used for charting

    • JS libaries canvasjs.min.js to be placed within ./src/ui/src/libs/ folder
    • Charting & Web use, need to accept dotnet's certificates dotnet dev-certs https --trust
  • Some financial tick data in CSV format, in the /src/tickdata folder (example provided)

    # ./tickdata/{symbol}/2020.csv:
    UTC,AskPrice,BidPrice,AskVolume,BidVolume
    2018-01-01T01:00:00.594+00:00,1.35104,1.35065,1.5,0.75

Debugging

If you have changed target frameworks, make sure to update the program path in .vscode launch.json

Random Trading Strategy

accountEquity=0
maximumDrawndownPercentage=0

License

MIT

About

This backtesting engine is a personal project of mine, built in C# to explore and experiment with various trading strategies at scale.

Topics

Resources

License

Stars

Watchers

Forks