Skip to content

clairvoyant/noise

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Noise

A Backtest or Trading Framework with C++

Why invent the wheel ?

  • Inspired by backtesting.py
  • Not invent, just rewrite it in another way
  • Need a simpler, faster, ease of replace component framework

Features

  • Simple, no-documented API / structure
  • Composable Strategies / Broker / Feed / Ploting
  • Support different ways of Backtest (SimpleBroker/BrokerMuxer/EventDriven/PreProcessed)
  • Cheap Backtest Result
  • Cheap Visualization
  • Cheap TA-Lib

Requirements

Build on Linux

    cd noise
    mkdir build && cd build
    cmake ..
    make && ./bt

Usage

    make && ./bt

Results in:

[Stat] summary:
  Start                      [YYYMMDD] 20180102
  End                        [YYYMMDD] 20180213
  Duration                       [days]     112
  Exposure Time                      [%]  99.11
  Equity Final                  [$]    +6277.18
  Equity Peak                   [$]   +10109.52
  PNL                           [$]    -3722.82
  Return                             [%] -37.23
  Buy & Hold Return                  [%]  -8.54
  Return (Ann.)                      [%]   0.00 TBD
  Volatility (Ann.)                  [%]   0.00 TBD
  Sharpe Ratio                             0.00 TBD
  Max. Drawdown                      [%]   0.00 TBD
  Avg. Drawdown                      [%]   0.00 TBD
  Max. Drawdown Duration         [days]    0.00 TBD
  Avg. Drawdown Duration         [days]    0.00 TBD
  Trades                                     57
  Win Rate                           [%]  35.09
  Avg. Trade                         [%]  -3.99
  Best. Trade                        [%]  11.11
  Wors. Trade                        [%] -17.50
  Best. Trade on PNL             [$]     +40.85
  Wors. Trade on PNL             [$]    -246.01
  Max. Trade Duration           [days]   108.00
  Avg. Trade Duration           [days]    51.63
  SQN                                     -5.53

[main] time elapsed: 12.594399 ms

Find more usage examples in dir noise/sample/

Build on Windows with GUI Ploting

    cd noise
    mkdir build && cd build
    cmake ../sample
    MSBuild.exe noise.sln           # require VisualStudio
    .\Debug\cd.exe

output_image

Contibutes

  • Always welcomed ( Feature or Bugfix or Unitest )
  • Platform Independent
  • Simple is the most important thing. No heavy / fancy code. Not much 3rd library I Hope...
  • Keep less code

Final

Additional Remarks

  • I did try not to include too much third-party library. But as project went on, they grows ...

  • Some are just tiny cpp header-only:

  • Some made it easier for me to do unitest, math calculation

  • Some help to speed up backtesting for large dataset:

  • They may have diff Lisences ...

About

A Backtest or Trading Framework with C++

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 99.3%
  • Other 0.7%