Lib

Bundled sample tickers and loaders (load_stock/load_stocks, AAPL/GOOG) for trying Orcus without external data, plus the example CrossOverStrategy used throughout the docs.

Orcus.crossover_initFunction
crossover_init(s::Strategy)

init for CrossOverStrategy: attaches SMA10/SMA20 indicators to every asset in the market.

Random.seed!(1234);
x=asset();
M=market([x]);
B=Broker(M,1000);
s=CrossOverStrategy(B);
crossover_init(s);
names(x)
# output

6-element Vector{String}:
 "Open"
 "High"
 "Low"
 "Close"
 "SMA20"
 "SMA10"
source
Orcus.crossover_nextFunction
crossover_next(s::Strategy)

next for CrossOverStrategy: closes all positions and buys 10 units on an SMA10/SMA20 upward cross, or sells 10 units on a downward cross.

Random.seed!(1234);
x=asset();
y=asset();
M=market([x,y]);
B=Broker(M,1000);
s=CrossOverStrategy(B);
crossover_init(s);
advance_to!(M, 100);
crossover_next(s);
length(s.broker.orders)
# output

0
source