braverock / braverock/quantstrat

UpdateOrders param default orderset = NULL

Open
#50 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
R
Stars
310
Forks
121
PR merge metrics
No merged PRs in 30d

Description

I am calling `updateOrders` with the `orderset` param left as default which is `NULL`. Line 524 of `orders.R` in `updateOrders` is calling `is.na()` on the `orderset` param which is causing an `argument is of length zero` error.

Specifically in my case, I am calling `updateOrders` from the `ruleRevoke` function. If I set `orderset = NA` then I no longer get the error.

Min Reproducible example is:
`add.rule(strategy.st, name="ruleRevoke", arguments=list(sigcol="EOD", sigval=TRUE, portfolio = portfolio.st, symbols = symbols, ruletype = "risk"), type="risk", enabled=TRUE)` where `"EOD"` is a signal column which has a value of TRUE at the End Of Day.

Contributor guide

Open the contributing guide

Research direction

Start in orders.R at line 524 within updateOrders, then inspect the ruleRevoke call path described in the issue. Run the provided add.rule reproduction with orderset omitted and with orderset set to NA, and confirm that the default case no longer raises the reported error while the existing NA case still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
fintech-quant
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.