Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Orcus.jl

CI codecov docs

Orcus.jl is a backtesting engine for quantitative finance written in Julia, focused on research and signal authoring: PCA factor models, rolling statistics, technical indicators, and a lightweight two-function strategy abstraction. Write a strategy as init/next, run it bar-by-bar over historical data, and inspect the equity curve, trades, and portfolio.

Status: alpha. APIs may still change, execution realism is intentionally limited (market orders only; margin and multi-currency support exist but are lightweight).

Install

Orcus.jl is not yet registered. Add it directly from GitHub:

using Pkg
Pkg.add("Orcus")

Requires Julia ≥ 1.10.

Documentation

The documentation is available at Documentation, you can find a tutorial, examples, and API reference there.

Quick start

using Orcus

M = market([GOOG])          # built-in sample data; see available_stocks()

function cross_init(s::Strategy)
  a = s.market["GOOG"]
  apply_indicator(IndicatorGenerator(simple_average, 10), a, "Close", "SMA10")
  apply_indicator(IndicatorGenerator(simple_average, 20), a, "Close", "SMA20")
end

function cross_next(s::Strategy)
  a = s.market["GOOG"]
  n = length(a)
  n < 2 && return
  crossed_up = a["SMA10", n] > a["SMA20", n] && a["SMA10", n-1] <= a["SMA20", n-1]
  if crossed_up
    request_to_close_all!(s.broker)
    place_order!(s.broker, Order(Buy(a, 5)))
  end
end

@generate_strategy SMAcrossover cross_next cross_init

bt = Backtest(M, SMAcrossover, 10_000)   # 10k starting cash
run_test(bt)

status(bt.broker)    # show the final status of the backtest

What's included

  • Core — the engine: price data containers with zero-copy bar advancement, the order/fill/accounting path , simple derivatives, the @generate_strategy authoring model, and the backtest runner.
  • Lib — data loaders and example strategies.
  • Analytics — rolling PCA, rolling statistics, technical indicators, options pricing, and performance-stats.

See examples/ for simple runnable strategies, including the SMA-crossover shown above.

License

Orcus.jl is free software, licensed under the MIT License — see LICENSE.

Copyright (C) 2022 Marcel Wack <wack@math.tu-berlin.de>

About

A quantitative backtesting engine for trading strategies in Julia.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages