Liking cljdoc? Tell your friends :D

clojure-backtesting.strategy

Helpers for cross-sectional strategies: calendar triggers, ranking and screening, and orders that target a fraction of the portfolio.

Helpers for cross-sectional strategies: calendar triggers, ranking and
screening, and orders that target a fraction of the portfolio.
raw docstring

equal-weightsclj

(equal-weights permnos)

{permno 1/n} for the given securities.

{permno 1/n} for the given securities.
sourceraw docstring

new-period?clj

(new-period? unit)

True on the first trading day in the dataset of a new :week, :month, :quarter or :year, and on the first day of the run (the date init-portfolio started from), so a strategy invests at once.

True on the first trading day in the dataset of a new :week, :month,
:quarter or :year, and on the first day of the run (the date
init-portfolio started from), so a strategy invests at once.
sourceraw docstring

order-target-percentclj

(order-target-percent permno weight & {:keys [whole-shares?] :as opts})

Orders permno so that it becomes weight (a fraction, negative for a short) of today's equity at today's price. Like order, it fills at the next close; the trade is the difference to the holding then. Options: :whole-shares? true rounds toward zero, and the options of order. Returns the target quantity, or nil when there is no price today.

Orders `permno` so that it becomes `weight` (a fraction, negative for a
short) of today's equity at today's price. Like `order`, it fills at the
next close; the trade is the difference to the holding then. Options:
:whole-shares? true rounds toward zero, and the options of `order`.
Returns the target quantity, or nil when there is no price today.
sourceraw docstring

portfolio-equityclj

(portfolio-equity)

The portfolio's equity as last valued (today's close once next-date has run).

The portfolio's equity as last valued (today's close once next-date has run).
sourceraw docstring

rank-byclj

(rank-by f & {:keys [universe ascending]})

[[permno value] ...] for the securities where (f permno) is a finite number, highest value first. Options: :universe, the securities to rank (today's securities by default); :ascending true for lowest first.

[[permno value] ...] for the securities where (f permno) is a finite
number, highest value first. Options: :universe, the securities to rank
(today's securities by default); :ascending true for lowest first.
sourceraw docstring

rebalanceclj

(rebalance weights & {:as opts})

Targets the portfolio weights ({permno fraction of equity}); what they leave over stays in cash. Every holding not in weights is closed. Takes the options of order-target-percent. Returns {permno target quantity} for the orders placed.

Targets the portfolio `weights` ({permno fraction of equity}); what they
leave over stays in cash. Every holding not in `weights` is closed.
Takes the options of order-target-percent. Returns {permno target
quantity} for the orders placed.
sourceraw docstring

target-quantityclj

(target-quantity permno weight whole-shares?)

Shares of permno worth weight of today's equity at today's price, or nil without a price. With whole-shares? the count is rounded toward zero.

Shares of `permno` worth `weight` of today's equity at today's price, or
nil without a price. With `whole-shares?` the count is rounded toward zero.
sourceraw docstring

top-nclj

(top-n f n & opts)

The n securities with the highest (f permno), or the lowest with :ascending true; takes the options of rank-by.

The `n` securities with the highest (f permno), or the lowest with
:ascending true; takes the options of rank-by.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close