Random Notes on Python II

In continuation of an old post on Python, I’ve been playing around with an awesome new library built by P. Morissette simply titled BT. It includes numerous functions for back testing and displaying results & charts for daily strategies and lower frequencies.

Here’s an example of a simple momentum based tactical asset rotation strategy:


It has a function to weight stocks based on mean-variance optimization:


Spits out results for multiple strategies at once:


Even has a nicely formatted table for results:


Little correlation charting:


Technology is an amazing thing. I highly recommend you check out the library if you have interest:


Somewhat related, I’ve also been playing around with some machine learning libraries, namely SciKit Learn. However, I’m not quite certain it’s advantage in forecasting financial data? I remember reading up on Machine Learning a few years back, simple examples granted, but came away with the conclusion that it’s not that much more accurate than simple technical analysis tools. Please comment if you have more experience utilizing machine learning to trade stocks!

And here’s a little portfolio I put together based on bond return momentum and minimum variance weighting:


1.89 sharpe and 1/4 Max Drawdown of the TLT. Add a little leverage to get desired results 🙂


~ by largecaptrader on April 27, 2015.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: