braverock / braverock/quantstrat

bug chart.forward(): missing units

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

Description

When i create my own Symbol data in minutes, my `periodicity(R)$units` is ` 'mins' `.
as a result the function throws follwing Error:
```
Error in if (units == "months" && nrow(R) > 500) units <- "years" :
missing value where TRUE/FALSE needed
```
I would propose to add "mins" to the units (starting row 111 in chart.forward.R):
```
units <- switch(units,
mins="hours",
seconds = 'hours',
minutes = 'hours',
hours = 'days',
days = 'months',
weeks = 'years',
months = 'years',
quarters = 'years',
years = 'years')
```
I dont know if this counts as a Bug.

Contributor guide

Open the contributing guide

Research direction

Open chart.forward.R around the units mapping starting near row 111, then reproduce the issue with Symbol data whose periodicity units are "mins". Extend the mapping so this input is handled consistently with the other short intervals, and confirm chart.forward() no longer throws the missing-value error.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
fintech-quant
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.