Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Multi-Asset Class Futures Model

I have a multi-asset class futures model with a monthly time-period focus.

The model trades seven individual contracts, one each from the following asset-classes: Agriculture, Energy, Equity(Index), Foreign Exchange, Interest Rates, Metals, and Soft-Commodities. The contracts were chosen by analyzing principal component analysis of 30 futures contracts across asset-classes. The contracts traded are: Corn, Crude Oil, E-Mini SP500, Euro fx, Five-Year notes, High Grade Copper, and Coffee.

The strategy is a trend-following reversal strategy. IE, the model always has a position in each contract; long or short. The model only trades on the last trading day of each month. Current model(Excel) assumes trade price = closing price. This logic needs to be changed to run in last 30 minute window(?) of last trading day of the month.

Initial position sizes are $1 million notional for each contract. For example, if ESM7 = 2380, # contracts = 1,000,000 / 2380 / 50 = 8 contracts. Subsequent position sizes are determined by the running P/(L) of the individual contracts.

The model compares market price to a lagged (1-period) moving average(proprietary). At month 1, if market > ma, model buys.
At month 2, if market > ma, model does nothing. At month 2, if market < ma, model sells existing long and reverses short.

I have tried to code this in Python, without success. I just joined Quantopian and am looking for assistance in back-testing this model. If anyone is interested in writing this code, or can point me to existing code that I can attempt to modify, I would be most grateful.

Thank you for your time, attention, and consideration.