[R-SIG-Finance] segfault while running quantstrat

Joshua Ulrich josh.m.ulrich at gmail.com
Mon Oct 12 03:14:35 CEST 2015


Tsvetan,

Thanks for sharing your data and code with me off-list.  I was able to
find and fix two possible causes, which you can find here:
https://github.com/joshuaulrich/xts/issues/117
https://github.com/joshuaulrich/xts/issues/118

Please see if you can still reproduce the segfault with the latest
code from GitHub.

Best,
Josh

On Fri, Oct 9, 2015 at 6:58 PM, Joshua Ulrich <josh.m.ulrich at gmail.com> wrote:
> Thank you. You're running the latest xts on CRAN, and the rbind C code
> hasn't been touched in years... so this is likely still an issue in
> the development version of xts.
>
> Unfortunately, this is going to be very hard for me to reproduce
> without your strategy and data.  Would it be possible for you to
> provide it (off-list, if you prefer)?
>
> On Fri, Oct 9, 2015 at 6:46 PM, Tsvetan Stoyanov <tstoyc at gmail.com> wrote:
>> Just before I run applyStrategy(), I have
>>
>>> sessionInfo()
>> R version 3.2.2 (2015-08-14)
>> Platform: x86_64-apple-darwin13.4.0 (64-bit)
>> Running under: OS X 10.11 (El Capitan)
>>
>> locale:
>> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> other attached packages:
>> [1] quantstrat_0.9.1687           foreach_1.4.2
>> [3] blotter_0.9.1695              PerformanceAnalytics_1.4.3541
>> [5] FinancialInstrument_1.2.0     quantmod_0.4-5
>> [7] TTR_0.23-0                    xts_0.9-7
>> [9] zoo_1.7-12
>>
>> loaded via a namespace (and not attached):
>> [1] compiler_3.2.2   tools_3.2.2      codetools_0.2-14 grid_3.2.2
>> [5] iterators_1.0.7  lattice_0.20-33
>>
>> On Oct 9, 2015, at 4:33 PM, Joshua Ulrich <josh.m.ulrich at gmail.com> wrote:
>>
>> On Fri, Oct 9, 2015 at 6:29 PM, Tsvetan Stoyanov <tstoyc at gmail.com> wrote:
>>
>> Hi,
>>
>> While running a simple strategy on 5min data I got a segfault after about 2
>> years and 7 months, or
>> 200,000 bars. Is this expected, are these the limits or quantstrat/R?
>>
>> Segfaults are always bugs, never "expected".  In this case, the
>> problem is in the compiled code in xts:::rbind.xts.  Please provide
>> the output of sessionInfo().
>>
>> Tsvetan
>>
>> *** caught segfault ***
>> address 0x119b32000, cause 'memory not mapped'
>>
>> Traceback:
>> 1: .External("rbindXts", dup = FALSE, ..., PACKAGE = "xts")
>> 2: rbind(deparse.level, ...)
>> 3: rbind(Portfolio$symbols[[Symbol]]$txn, NewTxn)
>> 4: addTxn(Portfolio = portfolio, Symbol = symbol, TxnDate = txntime,
>> TxnQty = orderQty, TxnPrice = txnprice, ... = ..., TxnFees = txnfees)
>> 5: ruleOrderProc(portfolio = portfolio, symbol = symbol, mktdata = mktdata,
>> timestamp = timestamp, periodicity = freq, curIndex = curIndex,     ...)
>> 6: applyRules(portfolio = portfolio, symbol = symbol, strategy = strategy,
>> mktdata = mktdata, Dates = NULL, indicators = sret$indicators,     signals =
>> sret$signals, parameters = parameters, ..., path.dep = TRUE,     debug =
>> debug)
>> 7: applyStrategy(strategy.st, portfolio.st)
>>
>> Possible actions:
>> 1: abort (with core dump, if enabled)
>> 2: normal R exit
>> 3: exit R without saving workspace
>> 4: exit R saving workspace
>> Selection:
>> _______________________________________________
>> R-SIG-Finance at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only. If you want to post, subscribe first.
>> -- Also note that this is not the r-help list where general R questions
>> should go.
>>
>>
>>
>>
>> --
>> Joshua Ulrich  |  about.me/joshuaulrich
>> FOSS Trading  |  www.fosstrading.com
>>
>>
>
>
>
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com



More information about the R-SIG-Finance mailing list