A list of some likely most useful of my contributions.
Contest
Constraint checker Notebook with compact output
Simulated stop & limit orders
Pipeline
log pipe overview
One of the most useful tools, provides an overview of pipeline output with min, mean, max, or any series or dataframe. Counts nans. Option to only log when nans are present.
nanfill()
Forward fill of nans within class factors.
universal pipe
A flexible backtest for easy changes with many factors to mix & match. I find this educational.
Fundamental data integrity check including FactSet
Fundamental value update frequencies plus a notebook by Doug Baldwin.
Related to order_optimal_portfolio
using opt.Frozen()
Examples for making changes to individual securities
show_opt_weights()
Making optimize weights visible
norm()
Normalizing positive and negative values separately, recombining for input to optimize.
Tools
max intraday leverage
Keeps an eye on all-time maximum leverage in the custom chart, watching every minute.
track_orders
Logging orders, types, fills, cash, order_id's.
pvr
Profit-versus-Risk. This tool was more important before optimize which targets leverage. It charts profit based on maximum amount invested and several other things such as maximum intraday leverage, PnL, max short value & several other options.
End of run report
Logging info just at the end of a backtest in the IDE.
Logging more content
... while remaining under the logging limit
pnl per stock
Positions and their PnL for sorting.
one-liners
Lots of brief useful lines of code.
cls_opn_crs
Close, Open or Crossover (long to short or visa-versa), indicating what an order is up to. Cancel only opening orders for example.
jump drop
Looks for price jump to close the position.
take profit
For taking profit by watching price. Can be reversed for a stop loss.
slope
Slope of a list of values, including as a factor.
curve
Assigning values to a price curve for example. Picture having reached the bottom of a downturn and starting back upward, curving up.
scaling
Proportional fitting. For the position of a value within one range, return where it fits within another.
track_values
Keeps track of a variable's value, logging new extremes, with a summary at the end.
waits
Makes a waiting period for particular stocks easy.
beta_calc & beta zero
Beta calculation per stock and an example of automatic targeting of zero-beta. Was more useful before optimize.
margin charting overnight
Charts overnight margin, the one with costs, as I understand it.
minut() in logging
Prefacing logging lines with the minute of the trading day is quicker to read than the timestamps.
timing code
Timing to identify slow areas or functions
elapsed time & run info
Elapsed time, run info and logging variables when backtest is done.
cancel open orders
def cncl_oos(context, data): # Primarily to prevent the logging of unfilled orders at end of day
oo = get_open_orders() # Can also be use at any time to limit partial fills.
for s in oo:
for o in oo[s]:
cancel_order(o.id)
Third party essentials
Search & Replace for Windows
I mostly use the Search portion to quickly search for code in algorithms stored locally. Very powerful.
Comparison tool, CompareIt
For comparing two versions, easily spotting the changes and selective merging.
Image editor for screenshots
I use an image editor for storing backtest results from [printscreen], with a point on the chart and code changes highlighted. CTRL key in the IDE allows for multiple cursors and then with shift-arrow even multiple lines separated from each other highlighted, for looking at those screenshots later noting which changes had just occurred.
Word, screenshots with code
In an editor like Microsoft Word, both images and code can be saved long term, with useful filenames for sorting.