Quicksim Example Strategies
Quicksim Example Strategies
The quicksim directory in QSTK has a subfolder named strategies, which contains several example strategies. These strategies show how to take advantage of some of QSTK's features.
This strategy creates an allocation that has a row for each month in the given time period. At each row, the allocation is rebalanced (distributed evenly) between the first 20 of the S&P500 with 10 percent in cash and 10 percent in the first stock.
This strategy makes a random allocation for the given time period where a random amount is in google and the rest is in cash.
This strategy doubles as a module which contains several boilinger based strategies. Each of these strategies makes use of the boilinger utility script which takes in a time period with historical data and returns the boilinger values (how many standard deviations away) using a given lookback period length in days. The default strategy that this file performs is the stateful version, using a look back of 10 days, a high threshold of 1 standard deviation, and a low threshold of -1 standard deviation.
The first is a stateless boilinger strategy which acts on every buy or sell signal. This strategy has paramaters allowing a user to specify the look back period in days and high and low thresholds in number of standard deviations. The following shows how to create an allocation using this strategy with a look back period of 10 days, and using 1 and -1 standard deviations for the high and low thresholds.
The second is a stateful boilinger strategy which only deals with a max of ten stocks. This strategy also has paramaters allowing a user to specify the look back period in days and high and low thresholds in number of standard deviations. The following shows how to create an allocation using this strategy with a look back period of 10 days, and using 1 and -1 standard deviations for the high and low thresholds.
The final function is a more general interface for boilinger strategies taking in several paramaters. This strategy will take in the number of days in a look back period, high and low thresholds in standard deviations, the max number of stocks to hold at any one time, the max duration to hold a stock, and the amount to put into or take out from a stock on each buy or sell signal. The following shows how to create an allocation using the strategy using a look back period of 10 days, holding a max of 20 stocks at any one time, and putting ten percent of the portfolio into each stock on a buy signal (or taking that much out on a sell signal). This strategy also specifies to hold a stock for a max of 12 days, and to use 1 and -1 standard deviations for the high and low thresholds respectively.
A comma seperated list of the Standard and Poor 500 stocks.