<commit_before>#
# tutorial5.py
#
# @summary: Uses the quicksim backtester and MonthlyRebalancing strategy to create
# and back test allocations. Displays the result using the report module.
#
# @author: <NAME>
#
#

#python imports
import os
import cPickle
import datetime as dt
from pandas import *

#qstk imports
from quicksim import quickSim as qs

#strategy to use
strat = os.environ['QS']+"/quicksim/strategies/MonthlyRebalancing.py"

#start and end dates to start from
start = dt.datetime(2004,1,1)
end = dt.datetime(2009,1,1)

#number of tests to do and the number of days offset
num = 10
offset = 1

#starting fund value
startval=1000

#perform tests
fundsmatrix = qs.strat_backtest(strat,start,end,num,offset,startval)

#output fundsmatrix to pickle file
output=open(os.environ['QS']+'/Examples/Basic/temp_fundsmatrix.pkl',"w")
cPickle.dump(fundsmatrix,output)
output.close()

#graph tests using report<commit_msg>tutorial5 update<commit_after>#
# tutorial5.py
#
# @summary: Uses the quicksim backtester and MonthlyRebalancing strategy to create
# and back test allocations. Displays the result using the report module.
#
# @author: <NAME>
#
#

#python imports
import os
import cPickle
import datetime as dt
from pandas import *

#qstk imports
from quicksim import quickSim as qs

#strategy to use
strat = os.environ['QS']+"/quicksim/strategies/OneStock.py"

#start and end dates to start from
start = dt.datetime(2004,1,1)
end = dt.datetime(2009,1,1)

#number of tests to do and the number of days offset
num = 10
offset = 1

#starting fund value
startval=1000

#perform tests
fundsmatrix = qs.strat_backtest(strat,start,end,num,offset,startval)

#output fundsmatrix to pickle file
output=open(os.environ['QS']+'/Examples/Basic/temp_fundsmatrix.pkl',"w")
cPickle.dump(fundsmatrix,output)
output.close()

#graph tests using report
{'fraction_non_alphanumeric': 0.10114192495921696, 'fraction_numerical': 0.022294725394236, 'mean_word_length': 5.618705035971223, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5778454', 'n_tokens_mistral': 673, 'n_tokens_neox': 628, 'n_words': 194}