Created
April 28, 2017 05:06
-
-
Save dlintw/0e30fa09634b3436c1a288a6d1dce378 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
backtest = function(filename, traindata, alldata, algo, learn, skip_train_count) { | |
# ... omit | |
return(list(train_buy_cnt=train_buy_cnt, test_buy_cnt=test_buy_cnt, | |
t11=t[1,1], t12=t[1,2], t21=t[2,1], t22=t[2,2],rate=rate, earn=earn)) | |
# Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, : | |
# arguments imply differing number of rows: 1, 0 | |
} | |
main <- function(report_file, stk_cnt, data_cnt, algo_cnt, learn_cnt) { | |
# ... omit | |
br = backtest(infile, dat$traindata, dat$alldata, i_algo, i_learn, 250) | |
rpt$skip_train_count=250 | |
rpt$train_buy_cnt=br$train_buy_cnt | |
rpt$test_buy_cnt=br$test_buy_cnt | |
rpt$t11=br$t11 | |
rpt$t12=br$t12 | |
rpt$t21=br$t21 | |
rpt$t22=br$t22 | |
rpt$rate=br$rate | |
rpt$earn=br$earn | |
write.table(rpt, file=report_file, append=T, col.names=F, row.names=F, | |
na="NA", quote=F, sep=",") | |
} | |
main('test.csv', stk_cnt=1, data_cnt=1, algo_cnt=1, learn_cnt=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment