[R-SIG-Finance] R/Finance 2024: Call for Presentations

2023-12-08 Thread Joshua Ulrich
R/Finance 2024: Applied Finance with R
May 17 and 18, 2024
University of Illinois at Chicago

Call for Presentations

The sixteenth annual R/Finance conference for applied finance using R
will be held on May 17th and 18th, 2024 in Chicago, IL, at the
University of Illinois at Chicago. The conference will cover topics
including advanced risk tools, decentralized finance, econometrics,
high-performance computing, market microstructure, portfolio
management, time series analysis, and more. All will be discussed
within the context of using R and related programming languages as
primary tools for data pipelines, financial model development,
portfolio construction, risk management, and trading.

>From its humble Midwest beginnings, word of the conference spread
among trading desks and universities, until it became the primary
meeting for academics and practitioners interested in using R in
quantitative finance. The conference has featured presentations from
prominent academics and practitioners, and we anticipate another
exciting line-up for 2024.

We invite you to submit complete papers in pdf format, or one-page
abstracts (in txt or pdf format). More complete papers are preferred,
as well as submissions that include working code. We welcome
submissions for full talks (approximately 20 min.), abbreviated
“lightning talks” (approx. 6 min.), as well as (1 hr.) pre-conference
tutorials. (Scheduling considerations may require requested full talks
moved to lightning).

Both academic and practitioner proposals related to R are encouraged.
We especially encourage those who were previously unaware of R/Finance
to submit their talk proposals. There are many benefits to giving a
presentation at the conference. It makes your work visible to the
community, which often leads to interesting conversations with others
about your work. A full paper is not required!

In an effort to increase diversity of the presentations and presenters
at the conference, the committee asks and encourages members of
under-represented or historically marginalized groups to respond to
the Call for Presentations. See the Diversity
(https://www.rinfinance.com/diversity/) page for more information.

All slides will be made publicly available at conference time.
Presenters are strongly encouraged to provide working R code to
accompany the slides. Ideally, data sets should be made public for the
purposes of reproducibility (though we realize this may be limited due
to contracts with data vendors). Preference may be given to innovative
research or presenters who have released R packages.

Limited financial assistance for conference admission may be available
to presenters. As R/Finance is a volunteer open source effort from
which organizers do not profit, resources are derived from
registrations and sponsorship alone. Requests for financial assistance
must be made at the time of submission, and the presenter should
clearly communicate to us why assistance is being requested. We
welcome requests from underrepresented minorities in Quantitative
Finance/STEM, and anyone researching under economic hardship.

Submissions will be reviewed and accepted on a rolling basis with a
final submission deadline of January 26th, 2024. Submitters will be
notified via email starting February 14, 2024 of acceptance and
presentation length.

Additional details will be announced via the conference website
http://www.RinFinance.com/ as they become available. Information on
previous years’ presenters and their presentations are also at the
conference website. We will make a separate announcement when
registration opens.

You can submit your proposal at https://go.uic.edu/RFinanceCFP2024

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

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] correlation matrix

2023-10-20 Thread Joshua Ulrich
On Fri, Oct 20, 2023 at 1:32 PM arnaud gaboury  wrote:
>
> On Fri, Oct 20, 2023 at 7:27 PM Joshua Ulrich  wrote:
> >
> > On Fri, Oct 20, 2023 at 12:20 PM Eric Zivot  wrote:
> > >
> > > See the package corrplot - you get very nice visual plots of correlations 
> > > and also printouts of all pairwise correlations. You may need to use 
> > > coredata() to extract data as a matrix to be passed to the function 
> > > corrplot().
> > >
> > Very cool package! No need to use coredata(). This works:
> >
> > data(edhec, package = "PerformanceAnalytics")
> > corrplot::corrplot(cor(edhec))
>
> Well, that's it not so bad, but I honestly prefer the  solution from
> package corrplot
>
That *is* a solution using the corrplot() function from the corrplot
package. I only used the edhec data from PerformanceAnalytics, and
only for convenience because I knew you had that package installed.

>
> >
> > > -Original Message-
> > > From: R-SIG-Finance  On Behalf Of 
> > > arnaud gaboury
> > > Sent: Friday, October 20, 2023 10:10 AM
> > > To: r-sig-finance@r-project.org
> > > Subject: [R-SIG-Finance] correlation matrix
> > >
> > > I have a xts object with assets daily closing prices. I would like to 
> > > print an usual correlation matrix of each asset against others. The
> > > PerformanceAnalytics::table.correlation() function let me with a very 
> > > ugly output.
> > > Is there any other function from a package which will print a user 
> > > friendly correlation matrix?
> > >
> > > Thank You for help
> > >
> > > ___
> > > R-SIG-Finance@r-project.org mailing list 
> > > https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-sig-finance__;!!K-Hz7m0Vt54!jioZM9Nd6oeVy_gNe5CuRD11pqzHc3CDCt46IvWGkZ9xEmit-nl7pwBBf3VJGmxZcMFVq4bc5_F6k93OhMjgBC8$
> > > -- 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.
> > >
> > > _______
> > > R-SIG-Finance@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

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] correlation matrix

2023-10-20 Thread Joshua Ulrich
On Fri, Oct 20, 2023 at 12:20 PM Eric Zivot  wrote:
>
> See the package corrplot - you get very nice visual plots of correlations and 
> also printouts of all pairwise correlations. You may need to use coredata() 
> to extract data as a matrix to be passed to the function corrplot().
>
Very cool package! No need to use coredata(). This works:

data(edhec, package = "PerformanceAnalytics")
corrplot::corrplot(cor(edhec))

> -Original Message-
> From: R-SIG-Finance  On Behalf Of arnaud 
> gaboury
> Sent: Friday, October 20, 2023 10:10 AM
> To: r-sig-finance@r-project.org
> Subject: [R-SIG-Finance] correlation matrix
>
> I have a xts object with assets daily closing prices. I would like to print 
> an usual correlation matrix of each asset against others. The
> PerformanceAnalytics::table.correlation() function let me with a very ugly 
> output.
> Is there any other function from a package which will print a user friendly 
> correlation matrix?
>
> Thank You for help
>
> ___
> R-SIG-Finance@r-project.org mailing list 
> https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-sig-finance__;!!K-Hz7m0Vt54!jioZM9Nd6oeVy_gNe5CuRD11pqzHc3CDCt46IvWGkZ9xEmit-nl7pwBBf3VJGmxZcMFVq4bc5_F6k93OhMjgBC8$
> -- 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.
>
> ___
> R-SIG-Finance@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

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] xts: Transfer/expand values to higher periodicity

2023-08-14 Thread Joshua Ulrich
On Sun, Aug 13, 2023 at 6:45 PM Mike  wrote:
>
> On Sat, 12 Aug 2023 Joshua Ulrich  wrote:
>
> > On Fri, Aug 11, 2023 at 3:22 PM Mike  wrote:
>
> > > > head(x.weekly)
> > >
> > >   OHLCM
> > > 2007-01-05 50.03978 50.42188 49.95041 50.33459 50.18615
> > > 2007-01-12 50.03555 50.35980 49.80454 50.28519 50.08217
> > > 2007-01-19 50.61724 50.77336 50.40269 50.41278 50.58802
> > > 2007-01-26 50.36008 50.43875 49.94052 50.07024 50.18963
> > > 2007-02-02 49.85624 50.53490 49.76308 50.36928 50.14899
> > > 2007-02-09 50.52389 50.89683 50.45977 50.67686 50.67830
> > >
> > >
> > > The new x.daily.new[,5] should look like this:
> > >
> > >Open High  LowCloseM
> > > 2007-01-02 50.03978 50.11778 49.95041 50.11778 50.18615\
> > > 2007-01-03 50.23050 50.42188 50.23050 50.39767 50.18615|-Values
> > > 2007-01-04 50.42096 50.42096 50.26414 50.33236 50.18615| for week
> > > 2007-01-05 50.37347 50.37347 50.22103 50.33459 50.18615/
> > > 2007-01-08 50.03555 50.10363 49.96971 49.98806 50.08217\
> > > 2007-01-09 49.99489 49.99489 49.80454 49.91333 50.08217|
> > > 2007-01-10 49.91228 50.13053 49.91228 49.97246 50.08217|-Values
> > > 2007-01-11 49.88529 50.23910 49.88529 50.23910 50.08217| for week
> > > 2007-01-12 50.21258 50.35980 50.17176 50.28519 50.08217/
> > > 2007-01-15 50.61724 50.68583 50.47359 50.48912 50.58802\
> > > 2007-01-16 50.62024 50.73731 50.56627 50.67835 50.58802|
> > > 2007-01-17 50.74150 50.77336 50.44932 50.48644 50.58802|-Values
> > > 2007-01-18 50.48051 50.60712 50.40269 50.57632 50.58802| for week
> > > 2007-01-19 50.41381 50.55627 50.41278 50.41278 50.58802/
> > > ...
>
> > Note that the index for x.daily is POSIXct even though it's daily
> > data. You need to make sure it's Date in your case or you'll have
> > timezone issues with this approach.
>
> Can you explain the timezone issues I can run into a bit more? I plan
> to run the function to be written for that in TZ EST5EDT.
>
The issue was with your initial example because
x.daily <- as.xts(sample_matrix)
creates an xts object with a POSIXct index with TZ=""

to.weekly() creates an xts object with a Date index, and TZ="UTC" for
all xts objects that have an index without a time component. So you
get this result when you merge the two:

head(x.daily.new <- merge(x.daily, x.weekly$M))
## Open High  LowCloseM
## 2007-01-02 00:00:00 50.03978 50.11778 49.95041 50.11778   NA
## 2007-01-03 00:00:00 50.23050 50.42188 50.23050 50.39767   NA
## 2007-01-04 00:00:00 50.42096 50.42096 50.26414 50.33236   NA
## 2007-01-04 18:00:00   NA   NA   NA   NA 50.18615
## 2007-01-05 00:00:00 50.37347 50.37347 50.22103 50.33459   NA
## 2007-01-08 00:00:00 50.03555 50.10363 49.96971 49.98806   NA

This happens any time you merge xts objects with a timezone with xts
objects that don't have a timezone (i.e. Date, yearmon, yearqtr, etc.
because they have TZ="UTC").

In the case where you want to align >= daily data with intraday data,
you need to make sure your >= daily data index is POSIXct in the same
timezone. You can keep the timezone with to.weekly() and friends by
setting drop.time = FALSE. For example

dttm.hourly <- seq(as.POSIXct(start(x.daily)), by="hour", length.out=24*30)
y.hourly <- xts(seq_along(dttm.hourly), dttm.hourly)
y.daily <- to.daily(y.hourly, name = NULL, drop.time = FALSE)
tail(y.hourly.new <- merge(y.hourly, y.daily[, "Close"], fill =
na.locf), 30)
## y.hourly Close
## 2007-01-30 18:00:00  691   672
## 2007-01-30 19:00:00  692   672
## 2007-01-30 20:00:00  693   672
## 2007-01-30 21:00:00  694   672
## 2007-01-30 22:00:00  695   672
## 2007-01-30 23:00:00  696   696
## 2007-01-31 00:00:00  697   696
## 2007-01-31 01:00:00  698   696
## 2007-01-31 02:00:00  699   696
## 2007-01-31 03:00:00  700   696
## 2007-01-31 04:00:00  701   696
## 2007-01-31 05:00:00  702   696
## 2007-01-31 06:00:00  703   696
## 2007-01-31 07:00:00  704   696
## 2007-01-31 08:00:00  705   696
## 2007-01-31 09:00:00  706   696
## 2007-01-31 10:00:00  707   696
## 2007-01-31 11:00:00  708   696
## 2007-01-31 12:00:00  709   696
## 2007-01-31 13:00:00  710   696
## 2007-01-31 14:00:00  711   696
## 2007-01-31 15:00:00  712   696
## 2007-01-31 16:00:00  713   696
## 2007-01-31 17:00:0

Re: [R-SIG-Finance] xts: Transfer/expand values to higher periodicity

2023-08-12 Thread Joshua Ulrich
On Fri, Aug 11, 2023 at 3:22 PM Mike  wrote:
>
> First I convert a higher periodicity xts (e.g. day/hour) to a lower
> one (e.g. week/day). Then I calculate values (e.g. the mean of the
> low/high) on the lower periodicity xts.
>
> Now I like to transfer and expand the calculated low periodicity
> values into the corresponding bars of the high periodicity xts.
>
> Or less abstract: Project numbers of each week into the corresponding
> time frames (of mostly 5 bars) of the original daily xts.
>
> My minimal reproducible example:
>
> data(sample_matrix)
> x.daily <- as.xts(sample_matrix)
> # Limit sample to weekdays
> x.daily <- x.daily[.indexwday(x.daily) %in% 1:5]
> x.weekly <- to.weekly(x.daily, name=NULL)
> # Example calculation
> x.weekly <- cbind (x.weekly, rowMeans(x.weekly[,2:3]))
> colnames(x.weekly) <- c('O','H','L','C','M')
>
> > head(x.weekly)
>
>   OHLCM
> 2007-01-05 50.03978 50.42188 49.95041 50.33459 50.18615
> 2007-01-12 50.03555 50.35980 49.80454 50.28519 50.08217
> 2007-01-19 50.61724 50.77336 50.40269 50.41278 50.58802
> 2007-01-26 50.36008 50.43875 49.94052 50.07024 50.18963
> 2007-02-02 49.85624 50.53490 49.76308 50.36928 50.14899
> 2007-02-09 50.52389 50.89683 50.45977 50.67686 50.67830
>
>
> The new x.daily.new[,5] should look like this:
>
>Open High  LowCloseM
> 2007-01-02 50.03978 50.11778 49.95041 50.11778 50.18615\
> 2007-01-03 50.23050 50.42188 50.23050 50.39767 50.18615|-Values
> 2007-01-04 50.42096 50.42096 50.26414 50.33236 50.18615| for week
> 2007-01-05 50.37347 50.37347 50.22103 50.33459 50.18615/
> 2007-01-08 50.03555 50.10363 49.96971 49.98806 50.08217\
> 2007-01-09 49.99489 49.99489 49.80454 49.91333 50.08217|
> 2007-01-10 49.91228 50.13053 49.91228 49.97246 50.08217|-Values
> 2007-01-11 49.88529 50.23910 49.88529 50.23910 50.08217| for week
> 2007-01-12 50.21258 50.35980 50.17176 50.28519 50.08217/
> 2007-01-15 50.61724 50.68583 50.47359 50.48912 50.58802\
> 2007-01-16 50.62024 50.73731 50.56627 50.67835 50.58802|
> 2007-01-17 50.74150 50.77336 50.44932 50.48644 50.58802|-Values
> 2007-01-18 50.48051 50.60712 50.40269 50.57632 50.58802| for week
> 2007-01-19 50.41381 50.55627 50.41278 50.41278 50.58802/
> ...
>
> How can I achieve that?
>
Thanks for the reproducible example. It makes it a lot easier to help!

Note that the index for x.daily is POSIXct even though it's daily
data. You need to make sure it's Date in your case or you'll have
timezone issues with this approach.

x.daily <- as.xts(sample_matrix)
# convert to Date index
index(x.daily) <- as.Date(index(x.daily))

Now you can merge your daily series with the weekly series and use
na.locf() to fill the gaps.

x.daily.new <- merge(x.daily, x.weekly$M, fill = na.locf)

The first 3 observations are NA because there's no observation for the
first day of the week at the beginning of the series. You can fill
those values backward by setting fromLast = TRUE)

x.daily.new <- na.locf(x.daily.new, fromLast = TRUE)
x.daily.new
##Open High  LowCloseM
## 2007-01-02 50.03978 50.11778 49.95041 50.11778 50.18615
## 2007-01-03 50.23050 50.42188 50.23050 50.39767 50.18615
## 2007-01-04 50.42096 50.42096 50.26414 50.33236 50.18615
## 2007-01-05 50.37347 50.37347 50.22103 50.33459 50.18615
## 2007-01-08 50.03555 50.10363 49.96971 49.98806 50.18615
## 2007-01-09 49.99489 49.99489 49.80454 49.91333 50.18615
## 2007-01-10 49.91228 50.13053 49.91228 49.97246 50.18615
## 2007-01-11 49.88529 50.23910 49.88529 50.23910 50.18615
## 2007-01-12 50.21258 50.35980 50.17176 50.28519 50.08217
## 2007-01-15 50.61724 50.68583 50.47359 50.48912 50.08217
##...
## 2007-06-18 47.43470 47.56336 47.36424 47.36424 47.2
## 2007-06-19 47.46055 47.73353 47.46055 47.67220 47.2
## 2007-06-20 47.71126 47.81759 47.66843 47.66843 47.2
## 2007-06-21 47.71012 47.71012 47.61106 47.62921 47.2
## 2007-06-22 47.56849 47.59266 47.32549 47.32549 47.57154
## 2007-06-25 47.20471 47.42772 47.13405 47.42772 47.57154
## 2007-06-26 47.44300 47.61611 47.44300 47.61611 47.57154
## 2007-06-27 47.62323 47.71673 47.60015 47.62769 47.57154
## 2007-06-28 47.67604 47.70460 47.57241 47.60716 47.57154
## 2007-06-29 47.63629 47.77563 47.61733 47.66471 47.45484



> Mike
>
> ___
> R-SIG-Finance@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

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] chart_Series: Adding multiple custom indicators

2023-07-05 Thread Joshua Ulrich
On Wed, Jul 5, 2023 at 3:11 PM Mike  wrote:
>
> Some time ago I wrote an R script where I added custom indicators to
> a main chart by putting them into a list like this:
>
> CODE:
> data (sample_matrix, package="xts")
> data <- as.xts (sample_matrix)
>
> ta <- list ()
> ta[[1]] <- "add_TA (SMA (data$Close, 20), col='#BB')"
> ta[[2]] <- "add_TA (SMA (data$Close, 3), col='#00BB00')"
>
> co <- chart_Series (data, name='test data', TA=ta)
> plot (co)
>
Thanks for the reproducible example!

>
> After some updates, and now running
> > packageVersion('quantmod')
> [1] '0.4.23'
> I started the code again and got this:
>
> Error in !is.null(TA) && nchar(TA) > 0 :
>   'length = 2' in coercion to 'logical(1)'
>
> I don't get the error when I add one indicator only.
>
> On an older machine running quantmod 0.4.20 I get this message as a
> warning instead of an error.
>
>
> What causes the error and what is the best practice to plot a chart
> (using the new chart_Series) with multiple custom indicators?
>
That chart_Series() code didn't change between those 2 versions of
quantmod. This went from a warning to an error based on changes in R
itself. You can verify by running the code below on both machines:

ta <- list("a", "b")
!is.null(ta) && nchar(ta) > 0
## Error in !is.null(ta) && nchar(ta) > 0 :
##  'length = 2' in coercion to 'logical(1)'

The chart_Series() docs say that the TA arg should be "a character
string of semi-colon seperated TA calls". So you can do this:

chart_Series(data, name = "test data", TA = paste(ta, collapse = ";"))

Best,
Josh


> Mike
>
> ___
> R-SIG-Finance@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

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Performanceanalytics Charts - removing default date in title?

2023-05-23 Thread Joshua Ulrich
Hi Jason,

There's no way to do this with PerformanceAnalytics currently.

I just made a PR on GitHub that lets you do it:
https://github.com/braverock/PerformanceAnalytics/pull/183

Best,
Josh


On Sun, Feb 26, 2023 at 11:20 AM Jason Hart via R-SIG-Finance
 wrote:
>
> Hello all - is it possible to remove the date that shows up by default in the 
> main title (on the right hand side) in certain charts such as 
> chart.cumreturns, chart.rollingperformance, chart.rollingregression, etc?  
> The date can crowd out and overlap with the main title on charts, 
> particularly if they're lined up side by side in a layout.  I've tried 
> everything but I haven't had any luck.  Thanks for any tips here.
>
> Jason
> ___
> R-SIG-Finance@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

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Performanceanalytics Charts - removing default date in title?

2023-05-23 Thread Joshua Ulrich
Hi Ed,

It's not helpful to give an answer you're not sure is correct.
Especially from ChatGPT, which is known to confidently give wrong
answers. And that's what it did in this case. There are at least two
issues:

1. "chart.CumReturns.custom is a copy of the chart.CumReturns
function" is false.
The definition of chart.CumReturns.custom() isn't even close to the
definition of chart.CumReturns() in PerformanceAnalytics version
2.0.4. You can find the actual chart.CumReturns() code on GitHub:
https://github.com/braverock/PerformanceAnalytics/blob/691961b6a9d97cbc9c0660431f7bf0e9884cf03d/R/chart.CumReturns.R#L42

2. The code you pasted throws an error. You could have run the code
yourself to see if it was correct.
i. The 'returns' object can't be converted to xts, which causes an error
ii. It errors even if you make 'returns' an xts object because it
uses `class(x) == "numeric"` (which the real function does not)

There's already enough noise in time series data. We don't need
ChatGPT adding even more noise. ;-)

Regards,
Josh


On Mon, May 22, 2023 at 10:47 PM Ed Herranz  wrote:
>
> Jason,
>
> This is what ChatGPT 4.0 says.  No guarantees that it is correct, though:
>
> The PerformanceAnalytics package in R does not provide direct options to
> remove the date from the title of the charts.
>
> However, it's possible to work around this by making a custom version of
> the function in which the date is added to the chart title, and removing
> the part of the code that adds the date.
>
> Below is an example using the chart.CumReturns function:
>
> library(PerformanceAnalytics)
> library(zoo)
>
> # Create a custom version of chart.CumReturns
> chart.CumReturns.custom <- function (R, wealth.index = FALSE, geometric =
> FALSE,
>   main = "Cumulative Returns", ylab = "Cumulative Returns",
>   xlab = "Date", ...)
> {
>   # Convert to zoo for time series functionality
>   R = checkData(R, method = "zoo")
>   R = na.omit(R)
>
>   # Calculate returns
>   if (geometric) {
> returns = Return.cumulative(R, geometric = TRUE)
>   } else if (wealth.index) {
> returns = Return.cumulative(R, geometric = TRUE)
> returns = cumprod(1 + returns) - 1
>   } else {
> returns = Return.cumulative(R, geometric = FALSE)
>   }
>
>   # Remove the date from the chart title
>   chart.TimeSeries(returns, main = main, ylab = ylab,
>xlab = xlab, ...)
> }
>
> # Generate some example returns data
> returns = rnorm(100)
>
> # Create the chart
> chart.CumReturns.custom(returns)
>
>
> In this code, chart.CumReturns.custom is a copy of the chart.CumReturns
> function, with the part of the code that adds the date to the chart title
> removed. You can use this function just like chart.CumReturns, but it will
> not include the date in the chart title.
>
> Note: This code was based on the PerformanceAnalytics 2.0.4 package as of
> my knowledge cut-off in September 2021. The specifics may change in later
> versions of the package. Be sure to check the function's code for the
> specific version of the package you are using.
>
> Regards,
>
> -Ed
>
> On Sun, Feb 26, 2023 at 12:20 PM Jason Hart via R-SIG-Finance <
> r-sig-finance@r-project.org> wrote:
>
> > Hello all - is it possible to remove the date that shows up by default in
> > the main title (on the right hand side) in certain charts such as
> > chart.cumreturns, chart.rollingperformance, chart.rollingregression, etc?
> > The date can crowd out and overlap with the main title on charts,
> > particularly if they're lined up side by side in a layout.  I've tried
> > everything but I haven't had any luck.  Thanks for any tips here.
> >
> > Jason
> > ___
> > R-SIG-Finance@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.
> >
>
>     [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Downloaded stock prices from Yahoo Finance

2023-05-05 Thread Joshua Ulrich
See the discussion and work arounds here:
https://github.com/joshuaulrich/quantmod/issues/382

On Fri, May 5, 2023 at 10:31 AM Dennis Fisher  wrote:
>
> R 4.2.3
> OS X
>
> Colleagues
>
> For years, I have been downloaded stock prices using something like:
> require("jsonlite")
> cmd <- 
> "https://query1.finance.yahoo.com/v7/finance/quote?fields=symbol,longName,regularMarketPrice,regularMarketTime,regularMarketChange=false=AAPL;
> fromJSON(cmd)
>
> Yesterday, this stopped working -- the message is:
> Error in open.connection(con, "rb") :
>   cannot open the connection to 
> 'https://query1.finance.yahoo.com/v7/finance/quote?fields=symbol,longName,regularMarketPrice,regularMarketTime,regularMarketChange=false=AAPL'
> In addition: Warning message:
> In open.connection(con, "rb") :
>   cannot open URL 
> 'https://query1.finance.yahoo.com/v7/finance/quote?fields=symbol,longName,regularMarketPrice,regularMarketTime,regularMarketChange=false=AAPL':
>  HTTP status was '401 Unauthorized'
>
> When I paste that code directly into a browser, I get:
> 
> {"finance":{"result":null,"error":{"code":"Unauthorized","description":"Invalid
>  Crumb"}}}
>
> I need the most recent closing price and the today's real-time price.  What 
> other options exist to download prices for multiple stocks?
>
> Dennis
>
>
> Dennis Fisher MD
> P < (The "P Less Than" Company)
> Phone / Fax: 1-866-PLessThan (1-866-753-7784)
> www.PLessThan.com
>
> ___
> R-SIG-Finance@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

___
R-SIG-Finance@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.


[R-SIG-Finance] xts 0.13.0 released to CRAN

2023-02-23 Thread Joshua Ulrich
Hi all,

A new version of xts just reached CRAN. It includes several cool features:

* open-ended time-of-day subsets
x["/T1800"])  # between the start of the day and 5pm

* to.period() supports custom endpoints
data(sample_matrix)
x <- as.xts(sample_matrix)
wednesdays <- which(.indexwday(x) == 3)
week_wed <- to.period(x, wednesdays)

* print() truncates rows (like data.table)
print(x)
##Open High  LowClose
## 2007-01-02 50.03978 50.11778 49.95041 50.11778
## 2007-01-03 50.23050 50.42188 50.23050 50.39767
## 2007-01-04 50.42096 50.42096 50.26414 50.33236
## 2007-01-05 50.37347 50.37347 50.22103 50.33459
##...
## 2007-06-26 47.44300 47.61611 47.44300 47.61611
## 2007-06-27 47.62323 47.71673 47.60015 47.62769
## 2007-06-28 47.67604 47.70460 47.57241 47.60716
## 2007-06-29 47.63629 47.77563 47.61733 47.66471
## 2007-06-30 47.67468 47.94127 47.67468 47.76719

* str() output is more informative, and less verbose
str(x)
## An xts object on 2007-01-02 / 2007-06-30 containing:
##  Data:double [180, 4]
##  Columns: Open, High, Low, Close
##  Index:   POSIXct,POSIXt [180] (TZ: "")

See the blog post for more examples, and to sign up for email updates
https://blog.fosstrading.com/2023/02/xts-0-13-0-on-cran.html

Best,
Josh

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

___
R-SIG-Finance@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.


[R-SIG-Finance] R/Finance 2023: Call for Presentations

2022-11-30 Thread Joshua Ulrich
R/Finance 2023: Applied Finance with R
May 19 and 20, 2023
University of Illinois at Chicago

Call for Presentations

The fifteenth annual R/Finance conference for applied finance using R
will be held on May 19 and 20, 2023 in Chicago, IL, at the University
of Illinois at Chicago. The conference will cover topics including
advanced risk tools, decentralized finance, econometrics,
high-performance computing, market microstructure, portfolio
management, and time series analysis. All will be discussed within the
context of using R and other programming languages as primary tools
for financial model development, portfolio construction, risk
management, and trading.

>From its humble Midwest beginnings, word of the conference spread
among trading desks and universities, until it became the primary
meeting for academics and practitioners interested in using R in
quantitative finance. The conference has featured presentations from
prominent academics and practitioners, and we anticipate another
exciting line-up for 2023.

We invite you to submit complete papers in pdf format for
consideration. We will also consider one-page abstracts (in txt or pdf
format) although more complete papers are preferred. We welcome
submissions for full talks (approximately 20 min.), abbreviated
"lightning talks" (approx. 6 min.), as well as (1 hr.) pre-conference
tutorials. (Scheduling considerations may require requested full talks
moved to lightning). Both academic and practitioner proposals related
to R are encouraged.

All slides will be made publicly available at conference time.
Presenters are strongly encouraged to provide working R code to
accompany the slides. Ideally, data sets should be made public for the
purposes of reproducibility (though we realize this may be limited due
to contracts with data vendors). Preference may be given to innovative
research or presenters who have released R packages.

Please submit proposals online
https://go.uic.edu/RFinanceCFP2023

Limited financial assistance for conference admission may be available
to presenters. As R/Finance is a volunteer open source effort from
which organizers do not profit, resources are derived from
registrations and sponsorship alone. Requests for financial assistance
must be made at the time of submission, and the presenter should
clearly communicate to us why assistance is being requested. We
particularly welcome requests from underrepresented minorities in
Quantitative Finance/STEM, and anyone researching under economic
hardship.

Submissions will be reviewed and accepted on a rolling basis with a
final submission deadline of January 27, 2023. Submitters will be
notified via email starting February 15, 2023 of acceptance and
presentation length.

Additional details will be announced via the conference website
http://www.RinFinance.com/ as they become available. Information on
previous years' presenters and their presentations are also at the
conference website. We will make a separate announcement when
registration opens, in late March.

For the conference committee:
Ferhat Akbas, Rabia Sipahi Akbas, Petra Bakosova, Gib Bassett, Peter
Carl, Dirk Eddelbuettel, Soumya Kalra, Brian Peterson, Dale Rosenthal,
Jeffrey Ryan, Justin Shea, and Joshua Ulrich.

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

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Error with getSymbols('SP500', from = "2020-01-01", to = "2021-06-30", src='FRED') SP500<-na.locf(SP500, na.rm = TRUE)

2022-11-07 Thread Joshua Ulrich
Hi Frank,

These both work for me in R-4.2.1 and quantmod 0.4.20. It looks like
you're using quantmod <= 0.4.18.

What R version are you using? At minimum, you should reinstall the
packages that were built in R-3.5.3 in March-2019.

Best,
Josh

On Mon, Nov 7, 2022 at 10:26 AM Frank  wrote:
>
> In running:
>
>
> ##
> ## Get S_500  from FRED
> ##
>
> getSymbols('SP500', from = "2020-01-01", to = "2021-06-30",src='FRED')
> SP500<-na.locf(SP500,na.rm = TRUE)
> tail(SP500)
> file_name <- "SP500.csv"
> write.zoo(SP500, file = file_name, append = FALSE, quote = TRUE, sep = ",")
> quit()
>
> I get:
>
> > library(quantmod)
> Loading required package: xts
> Loading required package: zoo
>
> Attaching package: 'zoo'
>
> The following objects are masked from 'package:base':
>
> as.Date, as.Date.numeric
>
> Loading required package: TTR
> Warning messages:
> 1: package 'xts' was built under R version 3.5.3
> 2: package 'zoo' was built under R version 3.5.3
> 3: package 'TTR' was built under R version 3.5.3
> > library(chron)
> NOTE: The default cutoff when expanding a 2-digit year to a 4-digit year
> will change from 30 to 69 by Aug 2020 (as for Date and POSIXct in base R.)
> Warning message:
> package 'chron' was built under R version 3.5.3
> >
> >
> > ##
> > ## Get S_500  from FRED
> > ##
> >
> > getSymbols('SP500', from = "2020-01-01", to = "2021-06-30",src='FRED')
> 'getSymbols' currently uses auto.assign=TRUE by default, but will use
> auto.assign=FALSE in 0.5-0. You will still be able to use 'loadSymbols' to
> automatically load data. getOption("getSymbols.env") and
> getOption("getSymbols.auto.assign") will still be checked for alternate
> defaults.
>
> This message is shown once per session and may be disabled by setting
> options("getSymbols.warning4.0"=FALSE). See ?getSymbols for details.
>
> Error in getSymbols.FRED(Symbols = "SP500", env = , verbose =
> FALSE,  :
>   Unable to import "SP500".
> schannel: next InitializeSecurityContext failed: SEC_E_ILLEGAL_MESSAGE
> (0x80090326) - This error usually occurs when a fatal SSL/TLS alert is
> received (e.g. handshake failed).
> Calls: getSymbols -> do.call -> getSymbols.FRED Execution halted
>
> I got correct data as recently as
>
> 11/2/2022   44867   3759.69 3759.69 3759.69 3759.69 3759.69 3759.69
>
> Similar thing with getSymbols('DGS3MO',src='FRED').
>
> They both download correctly directly from FRED.
>
> Thanks,
>
> Frank
> Chicago
>
> ___
> R-SIG-Finance@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

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Finding stock splits and dividend information

2021-12-26 Thread Joshua Ulrich
On Sat, Dec 25, 2021 at 8:20 PM H  wrote:
>
> Can anyone suggest a source for stock splits and dividend information on US 
> listed stocks? I already have the quotes but in order to do fundamental 
> analysis using historical information the two items above are required. I am 
> looking to go back to ca 2010 (or earlier, if possible).
>
Tiingo [1] provides this information, and more, for free. All you need
is a free API key. The riingo package [2] implements a substantial
portion of the API.

[1] https://api.tiingo.com/
[2] https://cran.r-project.org/package=riingo

> I have looked into parsing XBRL information from the SEC (8-K filings as I 
> understand it) but it does not seem promising for two reasons: (1) XBRL has a 
> short history, shorter the smaller the company is; and (2) the quality of 
> submissions and taxonomies used is not as good as one would like...
>
> Is CRISP or Compustat data available without a subscription?
>
> ___
> R-SIG-Finance@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

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] plot.xts/chart_Series, multi.panel and candlesticks

2021-09-05 Thread Joshua Ulrich
Hi Mike,


On Sun, Sep 5, 2021 at 8:36 AM Mike  wrote:
>
> I like to plot two candlesticks charts (e.g. two stocks) stacked in
> the same plot.
>
> With plot.xts I found some examples
> http://joshuaulrich.github.io/xts/plotting_panels.html
> https://github.com/joshuaulrich/xts/issues/140
> for using the multi.panel option but only for one-column-data. Since
> candlesticks need four columns of data I wonder how to tell plot.xts
> which columns to use for panel 1 and which for panel 2.
>
> Given two stocks
> getSymbols('AAPL')
> getSymbols('MSFT')
>
> Would I have to merge them into a new xts or pass them to plot.xts
> separately?
>
You can use the layout() function to split the plot into multiple
sections. There are more examples on the plotting_panels page you
referenced.

layout(matrix(1:2))
chart_Series(AAPL)
chart_Series(MSFT)

> Mike
>
> ___
> R-SIG-Finance@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

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Indicator as histogram or rectangle boxes instead of line

2021-04-05 Thread Joshua Ulrich
And here's a simple example

getSymbols("SPY")
chart_Series(SPY, subset = "2021")
add_TA(Vo(SPY), type = "h")

You can get better help if you create a minimal reproducible example
of your problem.

On Mon, Apr 5, 2021 at 10:56 AM Brian G. Peterson  wrote:
>
> plot.xts was based on chart_Series, so adding panels with plot.xts
> should work.
>
> Also, you can absolutely use 'h' plots with add_TA.  See e.g.
> chart.Posn in the blotter package:
>
> https://github.com/braverock/blotter/blob/master/R/chart.Posn.R
>
> Regards,
>
> Brian
>
> On Mon, 2021-04-05 at 14:28 +0200, Mike wrote:
> > I use chart_Series for plotting. add_TA adds an indicator with line
> > chart.
> >
> > Can I use add_TA also for plotting an indicator as histogram or
> > rectangle boxes like add_Vo?
> >
> > I tried add_TA's parameter taType with 'h' or 'b' without success.
> >
> > Mike
> >
> > ___
> > R-SIG-Finance@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.
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Praising the Binancer package from a blind user’s perspective and few questions about technical indicators.

2020-12-31 Thread Joshua Ulrich
Hi Faiz,

On Thu, Dec 31, 2020 at 2:10 PM faiz rasool  wrote:
>
> Hi all,
>
> I am a totally blind R user. Few days ago I got to know about the
> Binancer package. This package solved one of the biggest issues I was
> facing while learning about trading on Binance. The problem of how a
> blind user can view candle stick charts to make trading decisions.
>
> The functions in Binancer packaged allowed me to download candle stick
> charts and order book in R environment from Binance. After downloading
> I used write.CSV function to read data in Microsoft Excel. It has
> significantly improved things for me.
>
>  I’d like to say that R in general and in this case Binancer package
> has many time made possible those things which were otherwise not
> possible for me as a blind  computer user.
>
> Now to my questions. Is there a function in Binancer package that I
> have not found yet that allows me to download information of technical
> indicators like RSI and other indicators? If Binancer does not have
> this feature currently then are there any other R packages that will
> help me in downloading the information about technical indicators from
> crypto currency exchanges to R environment.

I recommend that you calculate indicator values yourself.  If you
download them, you will be limited to parameter values provided by the
data provider.  You can calculate all the popular indicators with
functions in the TTR package.

> One last question is there any R package that supports the BitMax
> exchange? I think there is a package that supports BitMex exchange but
> I have not come across a package that supports BitMax.
>
> If currently it is not possible to download technical indicators from
> exchanges then I do hope that if any package developer is reading this
> email will consider bringing this functionality to R as blind users
> will like me will really benefit from it.
>
I'm the author of TTR, and maintain quantmod, xts, and some other
packages.  I'm interested in what I can do to help make those packages
more accessible to users with sight impairments.  Please email me
directly, since that is off-topic for this list.

Best,
Josh

> Regards,
> Faiz.
> PS I sent this email to R-help list and I was advised to send this
> mail to this group. I was also told to Google RSI and find R packages.
> But I am not sure I found what I was hoping to find. A  simple
> function like Binance_depth to get  information of several indicators
> such as RSI, moving averages and so on.
>
> ___
> R-SIG-Finance@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

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] IBrokers - reqMktData - snapshot

2020-12-13 Thread Joshua Ulrich
Hi Diego,

Can you give me an example of a snapshot request that works for you
when you remove the stop()?

Thanks,
Josh

On Fri, Dec 11, 2020 at 5:26 AM diego peroni  wrote:
>
> Hi all,
> I’m using IBrokers package from GITHUB ("joshuaulrich/IBrokers")
>
> I’ve found in the code this line that BLOCKs every snapshot data request.
>
> ——
> if(snapshot == "1") {
>stop("Snapshot not working (?)”)
> ——
>
> Is there a reason for that?
>
> Removing this line the snapshot requests works for me….
>
> Thanks for your help.
>
> Diego
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Web Scraping of SPY Stocks

2020-09-26 Thread Joshua Ulrich
Please repost your message in plain text (as the posting guide
requests).  As you can see below, your HTML message was mangled when
the list server converted it to plain text.

On Fri, Sep 25, 2020 at 3:12 PM AIE ATUMA via R-SIG-Finance
 wrote:
>
> Dear All,
> Please I need help. I ran the below function and got the highlighted error 
> message. How can I correct it?
> library(rvest)# Web-scrape SP500 stock listsp_500 <- 
> read_html("https://en.wikipedia.org/wiki/List_of_S%26P_500_companies;) 
> %>%html_node("table.wikitable") %>%html_table() %>%select(`Ticker symbol`, 
> Security, `GICS Sector`, `GICS Sub Industry`) %>%as_tibble()# Format 
> namesnames(sp_500) <- sp_500 %>%names() %>%str_to_lower() %>%make.names()# 
> Show resultssp_500
> Error Message:
> Error: Can't subset columns that don't exist.x Column `Ticker symbol` doesn't 
> exist.Run `rlang::last_error()` to see where the error occurred.
>
> The second function and the error is below:
> get_stock_prices <- function(ticker), return_format = "tibble", ...) {  # Get 
> stock prices  stock_prices_xts <- getSymbols(Symbols = ticker, auto.assign = 
> FALSE, ...)  # Rename  names(stock_prices_xts) <- c("Open", "High", "Low", 
> "Close", "Volume", "Adjusted")  # Return in xts format if tibble is not 
> specified  if (return_format == "tibble") {stock_prices <- 
> stock_prices_xts %>%  as_tibble() %>%  rownames_to_column(var = 
> "Date") %>%  mutate(Date = mdy(Date))  } else {stock_prices <- 
> stock_prices_xts  }  stock_prices}
> "MA" %>%  get_stock_prices(return_format = 'tibble')%>%head()
> ERROR MESSAGE:
> Warning message:All formats failed to parse. No formats found.
>
>
> Thank You and Best Regards, Emeka I. AtumaIntegrity - Walk Your Talk Don't 
> Talk Your Work
>
>
>
> [[alternative HTML version deleted]]
>
> _______
> R-SIG-Finance@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

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Empty indicator / plot.window: need finite 'ylim' values

2020-08-23 Thread Joshua Ulrich
I don't think this is possible with chart_Series() currently.

It looks similar to
https://github.com/joshuaulrich/quantmod/issues/81

Could you please file an issue on the GitHub tracker?  I'm not sure
when I'll have a chance to take a closer look, but the tracker issue
will make sure I don't lose track of it.

Best,
Josh

On Mon, Aug 17, 2020 at 4:46 PM Daniel Cegiełka
 wrote:
>
>
>
> > On 17 Aug 2020, at 22:42, Mike  wrote:
>
> > Like Joshua wrote, indeed, I use chart_Series within a function.
> >
> >> But your problem is here:
> >>
> >> sample.xts[subset, 2]
> >
> > Yes, not the main window is the issue, but the indicator is. So I
> > have to ask more specific:
> >
> > Can I plot a subset of chart and indicator where the indicator's
> > subset is completely NA resulting in the indicator's plot region
> > being left blank?
> >
>
> you can try to force a value for ylim in the quantmod’s chart object:
>
> x <- chart_Series (sample.xts[,1], subset=subset, TA=ta)
>
> > x$Env$ylim
> [[1]]
> [1] 0 1
> attr(,"fixed")
> [1] FALSE
>
> [[2]]
> [1] 49.88096 50.67835
> attr(,"fixed")
> [1] FALSE
>
> [[3]]
> [1] 0 1
> attr(,"fixed")
> [1] FALSE
>
> [[4]]
> [1] -Inf  Inf
> attr(,"fixed")
> [1] FALSE
>
>
> e.g.:
>
> > x$Env$ylim[[4]] <- structure(c(0, 1), 'fixed' = FALSE)
> >
> > x$Env$ylim[[4]]
> [1] 0 1
> attr(,"fixed")
> [1] FALSE
>
> however, it is still overwritten:
>
> > x  # or plot(x)
> Error in plot.window(c(1, 21), c(NaN, NaN)) : need finite 'ylim' values
> In addition: Warning messages:
> 1: In min(x) : no non-missing arguments to min; returning Inf
> 2: In max(x) : no non-missing arguments to max; returning -Inf
> > x$Env$ylim[[4]]
> [1] -Inf  Inf
> attr(,"fixed")
> [1] FALSE
>
>
>
> > Mike
> >
> >
> > The new minimal reproducible:
> >
> > library(quantmod)
> >
> > my_plot_function <- function () {
> >  data (sample_matrix)
> >  sample.xts <- as.xts (sample_matrix[1:50,'Close'], dateFormat="POSIXct")
> >  sample.xts <- cbind (sample.xts, NA)
> >  sample.xts[50,2] <- 0
> >  colnames (sample.xts) <- c('Close', 'Stops')
> >
> >  ta <- list ("add_TA(sample.xts[,2])")
> >
> >  # In the range to be plotted ta is completely NA
> >  subset <- '2007-01-10::2007-01-30'
> >
> >  plot (chart_Series (sample.xts[,1], subset=subset, TA=ta))
> > }
> >
> > my_plot_function ()
> >
> > ___
> > R-SIG-Finance@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.
>
> ___
> R-SIG-Finance@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

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Empty indicator / plot.window: need finite 'ylim' values

2020-08-17 Thread Joshua Ulrich
On Mon, Aug 17, 2020 at 12:33 PM Daniel Cegiełka
 wrote:
>
>
>
> > On 17 Aug 2020, at 04:55, Rasmus Liland  wrote:
> >
> > Dear Mike,
> >
> > if I change this line
> >
> >   plot (chart_Series (sample.xts[,1], subset=subset, TA=ta))
> >
> > to
> >
> >   plot(chart_Series(sample.xts[subset,1], TA=ta))
> >
> > A plot appears.  No errors.  Was this
> > what you were looking for?
> >
>
>
> Guys :)
>
> chart_Series() is a plot env/func, so plot(chart_Series()) make no sense :)
>
Except that it is necessary to wrap chart_Series() in a call to plot()
if you call it from within a function, for loop, or any other
situation where R's auto-printing is disabled.

Cheers,
Josh


>
> Try:
>
> chart_Series(sample.xts[subset,1], TA=ta)
>
> ?chart_Series
>
> But your problem is here:
>
> sample.xts[subset, 2]
>
>
> Best,
> Daniel
>
>
>
>
> > /Rasmus
> > ___
> > R-SIG-Finance@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.
>
> ___
> R-SIG-Finance@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

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Select best worst

2020-07-31 Thread Joshua Ulrich
odReturn,   # This specifies what to
> > do
> > with that column
> >period = "daily",  # This argument calculates
> > Daily
> > returns
> >col_rename = "idr_returns") # renames the column
> > AAcciona_cum_returns <- AAcciona_daily_returns %>%
> >   mutate(cr = cumprod(1 + idr_returns)) %>%  # using the cumprod
> > function
> >   mutate(cumulative_returns = cr - 1)
> >
> > ACS_daily_returns <- ACS %>%
> >   tq_transmute(select = adjusted,   # this specifies which
> > column
> > to select
> >mutate_fun = periodReturn,   # This specifies what to
> > do
> > with that column
> >period = "daily",  # This argument calculates
> > Daily
> > returns
> >col_rename = "idr_returns") # renames the column
> > ACS_cum_returns <- ACS_daily_returns %>%
> >   mutate(cr = cumprod(1 + idr_returns)) %>%  # using the cumprod
> > function
> >   mutate(cumulative_returns = cr - 1)
> >
> > AENA_daily_returns <- AENA %>%
> >   tq_transmute(select = adjusted,   # this specifies which
> > column
> > to select
> >mutate_fun = periodReturn,   # This specifies what to
> > do
> > with that column
> >period = "daily",  # This argument calculates
> > Daily
> > returns
> >col_rename = "idr_returns") # renames the column
> > Aena_cum_returns <- Aaena_daily_returns %>%
> >   mutate(cr = cumprod(1 + idr_returns)) %>%  # using the cumprod
> > function
> >   mutate(cumulative_returns = cr - 1)
> >
> > Amadeus_daily_returns <- Amadeus %>%
> >   tq_transmute(select = adjusted,   # this specifies which
> > column
> > to select
> >mutate_fun = periodReturn,   # This specifies what to
> > do
> > with that column
> >period = "daily",  # This argument calculates
> > Daily
> > returns
> >col_rename = "idr_returns") # renames the column
> > Amadeus_cum_returns <- Amadeus_daily_returns %>%
> >   mutate(cr = cumprod(1 + idr_returns)) %>%  # using the cumprod
> > function
> >   mutate(cumulative_returns = cr - 1)
> >
> > ArcerlorMittal_daily_returns <- ArcerlorMittal %>%
> >   tq_transmute(select = adjusted,   # this specifies which
> > column
> > to select
> >mutate_fun = periodReturn,   # This specifies what to
> > do
> > with that column
> >period = "daily",  # This argument calculates
> > Daily
> > returns
> >col_rename = "idr_returns") # renames the column
> > ArcerlorMittal_cum_returns <- ArcerlorMittal_daily_returns %>%
> >   mutate(cr = cumprod(1 + idr_returns)) %>%  # using the cumprod
> > function
> >   mutate(cumulative_returns = cr - 1)
> >
> > BBVA_daily_returns <- BBVA %>%
> >   tq_transmute(select = adjusted,   # this specifies which
> > column
> > to select
> >mutate_fun = periodReturn,   # This specifies what to
> > do
> > with that column
> >period = "daily",  # This argument calculates
> > Daily
> > returns
> >col_rename = "idr_returns") # renames the column
> > BBVA_cum_returns <- BBVA_daily_returns %>%
> >   mutate(cr = cumprod(1 + idr_returns)) %>%  # using the cumprod
> > function
> >   mutate(cumulative_returns = cr - 1)
> >
> >
> > Sabadell_daily_returns <- Sabadell %>%
> >   tq_transmute(select = adjusted,   # this specifies which
> > column
> > to select
> >mutate_fun = periodReturn,   # This specifies what to
> > do
> > with that column
> >period = "daily",  # This argument calculates
> > Daily
> > returns
> >col_rename = "idr_returns") # renames the column
> > Sabadell_cum_returns <- Sabadell_daily_returns %>%
> >   mutate(cr = cumprod(1 + idr_returns)) %>%  # using the cumprod
> > function
> >   mutate(cumulative_returns = cr - 1)
> >
> > Santander_daily_returns <- Santander %>%
> >   tq_transmute(select = adjusted,   # this specifies which
> > column
> > to select
> >        mutate_fun = periodReturn,   # This 

Re: [R-SIG-Finance] query on adjRatios() function from TTR package

2020-06-08 Thread Joshua Ulrich
On Mon, Jun 8, 2020 at 7:26 AM Pitabas Mohanty  wrote:
>
> Hi
>
> Can anyone tell me how to find the adjusted closing price when there are
> multiple split events on the same day? In India, a few companies have
> announced stock split and stock dividend on the same day. When I use the
> adjRatios() function, it only adjusts for the first event and not the
> second event.
>
> Any help will be greatly appreciated.
>
Can you please provide an example, so I can investigate?

> Regards
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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

___
R-SIG-Finance@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.


[R-SIG-Finance] R/Finance 2020 Conference

2020-03-16 Thread Joshua Ulrich
Hi all,

R/Finance 2020 is less than 3 months away (June 5-6) and it's
impossible to predict how the global COVID-19 pandemic will continue
to unfold. As you can imagine, this uncertainty makes it extremely
difficult to plan an international conference with dozens of speakers
and hundreds of attendees.

We hope COVID-19 is no longer a global threat in June, but we don't
know the extent that international travel and large gatherings will
still be discouraged. Due to that uncertainty, we have decided to
cancel this year's R/Finance Conference. This was a difficult
decision, but the safety of our attendees comes first.

We truly apologize for any inconvenience this may cause for you. And
we would like to invite you to submit a proposal to next year’s
conference. The date is yet to be determined, but will likely be in
early June.

For the committee,
Petra Bakosova, Gib Bassett, Peter Carl, Dirk Eddelbuettel, Soumya
Kalra, Dan McMillen, Brian Peterson, Dale Rosenthal, Jeffrey Ryan,
Justin Shea, Joshua Ulrich

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] R/Finance 2020: Call for Presentations

2020-02-05 Thread Joshua Ulrich
We've extended the submission deadline to February 28th!

So there's still time to submit your talk:
http://go.uic.edu/rfinance2020cfp

We would also appreciate your help to spread the word, especially to
under-represented groups in finance!

On Tue, Jan 7, 2020 at 2:22 PM Joshua Ulrich  wrote:
>
> R/Finance 2020: Applied Finance with R
> June 5 and 6, 2020
> University of Illinois at Chicago
>
> Call for Presentations
>
> The twelfth annual R/Finance conference for applied finance using R
> will be held on June 5 and 6, 2020 in Chicago, IL, USA at the
> University of Illinois at Chicago. The conference will cover topics
> including portfolio management, time series analysis, advanced risk
> tools, high-performance computing, market microstructure, and
> econometrics. All will be discussed within the context of using R as a
> primary tool for financial model development, risk management,
> portfolio construction, and trading.
>
> From its humble Midwest beginnings, word of the conference spread
> among trading desks and universities, until it became the primary
> meeting for academics and practitioners interested in using R in
> quantitative finance. The conference has featured presentations from
> prominent academics and practitioners, and we anticipate another
> exciting line-up for 2020.
>
> We invite you to submit complete papers in pdf format for
> consideration. We will also consider one-page abstracts (in txt or pdf
> format) although more complete papers are preferred. We welcome
> submissions for full talks (approximately 20 min.), abbreviated
> “lightning talks” (approximately 6 min.), and (1 hour) pre-conference
> tutorials. (Scheduling considerations may require requested full talks
> moved to lightning). Both academic and practitioner proposals related
> to R are encouraged.
>
> All slides will be made publicly available at conference time.
> Presenters are strongly encouraged to provide working R code to
> accompany the slides. Ideally, data sets should be made public for the
> purposes of reproducibility (though we realize this may be limited due
> to contracts with data vendors). Preference may be given to innovative
> research or presenters who have released R packages.
>
> Please submit proposals online
> http://go.uic.edu/rfinance2020CFP
>
> Limited financial assistance for travel and conference admission may
> be available to presenters. As R/Finance is a volunteer open source
> effort from which organizers do not profit, resources are derived from
> registrations and sponsorship alone. Requests for financial assistance
> must be made at the time of submission, and the presenter should
> clearly communicate to us why assistance is being requested. We
> particularly welcome requests from under- represented minorities in
> Quantitative Finance/STEM, and anyone researching under economic
> hardship.
>
> Submissions will be reviewed and accepted on a rolling basis with a
> final submission deadline of February 1, 2020. Submitters will be
> notified via email starting February 15, 2020 of acceptance and
> presentation length.
>
> Additional details will be announced via the conference website
> http://www.RinFinance.com/ as they become available. Information on
> previous years’ presenters and their presentations are also at the
> conference website. We will make a separate announcement when
> registration opens, in late March.
>
> For the conference committee:
>
> Petra Bakosova, Gib Bassett, Peter Carl, Dirk Eddelbuettel, Soumya
> Kalra, Dan McMillen, Brian Peterson, Dale Rosenthal, Jeffrey Ryan,
> Justin Shea, Joshua Ulrich
>


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

___
R-SIG-Finance@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.


[R-SIG-Finance] R/Finance 2020: Call for Presentations

2020-01-07 Thread Joshua Ulrich
R/Finance 2020: Applied Finance with R
June 5 and 6, 2020
University of Illinois at Chicago

Call for Presentations

The twelfth annual R/Finance conference for applied finance using R
will be held on June 5 and 6, 2020 in Chicago, IL, USA at the
University of Illinois at Chicago. The conference will cover topics
including portfolio management, time series analysis, advanced risk
tools, high-performance computing, market microstructure, and
econometrics. All will be discussed within the context of using R as a
primary tool for financial model development, risk management,
portfolio construction, and trading.

>From its humble Midwest beginnings, word of the conference spread
among trading desks and universities, until it became the primary
meeting for academics and practitioners interested in using R in
quantitative finance. The conference has featured presentations from
prominent academics and practitioners, and we anticipate another
exciting line-up for 2020.

We invite you to submit complete papers in pdf format for
consideration. We will also consider one-page abstracts (in txt or pdf
format) although more complete papers are preferred. We welcome
submissions for full talks (approximately 20 min.), abbreviated
“lightning talks” (approximately 6 min.), and (1 hour) pre-conference
tutorials. (Scheduling considerations may require requested full talks
moved to lightning). Both academic and practitioner proposals related
to R are encouraged.

All slides will be made publicly available at conference time.
Presenters are strongly encouraged to provide working R code to
accompany the slides. Ideally, data sets should be made public for the
purposes of reproducibility (though we realize this may be limited due
to contracts with data vendors). Preference may be given to innovative
research or presenters who have released R packages.

Please submit proposals online
http://go.uic.edu/rfinance2020CFP

Limited financial assistance for travel and conference admission may
be available to presenters. As R/Finance is a volunteer open source
effort from which organizers do not profit, resources are derived from
registrations and sponsorship alone. Requests for financial assistance
must be made at the time of submission, and the presenter should
clearly communicate to us why assistance is being requested. We
particularly welcome requests from under- represented minorities in
Quantitative Finance/STEM, and anyone researching under economic
hardship.

Submissions will be reviewed and accepted on a rolling basis with a
final submission deadline of February 1, 2020. Submitters will be
notified via email starting February 15, 2020 of acceptance and
presentation length.

Additional details will be announced via the conference website
http://www.RinFinance.com/ as they become available. Information on
previous years’ presenters and their presentations are also at the
conference website. We will make a separate announcement when
registration opens, in late March.

For the conference committee:

Petra Bakosova, Gib Bassett, Peter Carl, Dirk Eddelbuettel, Soumya
Kalra, Dan McMillen, Brian Peterson, Dale Rosenthal, Jeffrey Ryan,
Justin Shea, Joshua Ulrich

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

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] quantmod getOptionChain error on yahoo

2019-05-03 Thread Joshua Ulrich
On Thu, May 2, 2019 at 6:58 PM Rock Pereira  wrote:
>
> I have downloaded option chains daily, for over a year, using a cronjob with 
> Rscript. But a few days ago, I got this error:
>
> "
>
> Error in data.frame(Strike = strike, Last = lastprice, Chg = change, Bid = 
> bid, : object 'volume' not found
>
> "

This had been reported: https://github.com/joshuaulrich/quantmod/issues/266

I could replicate the issue yesterday, but did not had time to
investigate.  I tried to run the example again today, and it worked.

R> aapl <- quantmod::getOptionChain("AAPL", Exp = NULL)
R> str(aapl)
List of 16
 $ May.03.2019:List of 2
  ..$ calls:'data.frame': 36 obs. of  7 variables:
  .. ..$ Strike: num [1:36] 150 155 160 165 168 ...
  .. ..$ Last  : num [1:36] 61.2 56.1 49 44.2 43.8 ...
  .. ..$ Chg   : int [1:36] 0 0 0 0 0 0 0 0 0 0 ...
  .. ..$ Bid   : num [1:36] 0 0 0 0 0 0 0 0 0 0 ...
  .. ..$ Ask   : int [1:36] 0 0 0 0 0 0 0 0 0 0 ...
  .. ..$ Vol   : int [1:36] 2 1 1 139 1 37 6 37 1 93 ...
  .. ..$ OI: int [1:36] 183 8 155 157 12 129 60 183 35 476 ...
  ..$ puts :'data.frame': 27 obs. of  7 variables:
  .. ..$ Strike: num [1:27] 150 155 160 162 165 ...
  .. ..$ Last  : num [1:27] 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01
0.01 0.01 ...
  .. ..$ Chg   : int [1:27] 0 0 0 0 0 0 0 0 0 0 ...
  .. ..$ Bid   : num [1:27] 0 0 0 0 0 0 0 0 0 0 ...
  .. ..$ Ask   : int [1:27] 0 0 0 0 0 0 0 0 0 0 ...
  .. ..$ Vol   : int [1:27] 71 1 4 6 1 9 14 30 69 85 ...
  .. ..$ OI: int [1:27] 0 0 0 0 0 0 0 0 0 0 ...


> I'd like some help with this error. My code is below
>
> ---
> library(quantmod)
> symbols <- as.character( read.csv("list_OPTIONS.txt", header=FALSE, sep=",", 
> stringsAsFactors = FALSE)[,1] )
> options <- sapply(symbols, function(s) getOptionChain(s, Exp=NULL, 
> src='yahoo'))
> rdsFilename <- paste0("opt_", format(Sys.Date(),"%Y%m%d"), ".rds")
> saveRDS(options, rdsFilename)
> --
>
Thanks for the example.  Next time, please provide a reproducible
example that others can run.  We don't have your file
(list_OPTIONS.txt).

> Thanks,
> Rock Pereira
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2019 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] R/Finance 2019 Registration

2019-04-25 Thread Joshua Ulrich
Hi Everyone,

A quick reminder that early registration closes on May 6th.  After
that, prices will be 50% higher.

Also, talk titles and presenter names have been posted on the website
https://go.uic.edu/rfinance2019

Click the Presentations navigation tab to see them.

For the committee,
Josh



On Fri, Apr 12, 2019 at 4:31 AM Joshua Ulrich  wrote:
>
> Announcement below:
>
> Please join us at the 11th annual R/Finance Conference!  As in prior
> years, we expect more than 250 attendees from around the world. R
> users from industry, academia, and government will joining 50+
> presenters covering all areas of finance with R.  The conference will
> take place on May 17th and 18th, at UIC in Chicago.
>
> You can find registration information on the conference website:
> https://go.uic.edu/rfinance2019
>
> Note that registration fees will increase by 50% at the end of early
> registration on May 6, 2019.
>
> We are very excited about keynote presentations by Genevera Allen,
> Arthur Steinmetz, and Matt Taddy.  The conference agenda (currently)
> includes 25 full presentations and 25 shorter "lightning talks".  As
> in previous years, several (optional) pre-conference seminars are
> offered on Friday morning.  We're still working on the agenda, but we
> have another great lineup of speakers this year!
>
> There is also an (optional) conference dinner at Wyndham Grand Chicago
> Riverfront in the 39th Floor Penthouse Ballroom and Terrace.  Situated
> directly on the riverfront, it is a perfect venue to continue
> conversations and networking.
>
> On behalf of the committee, we look forward to seeing you in Chicago!
>
> Petra Bakosova, Gib Bassett, Peter Carl, Dirk Eddelbuettel, Soumya
> Kalra, Brian Peterson, Dale Rosenthal, Jeffrey Ryan, Justin Shea,
> Joshua Ulrich
>
>
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com
> R/Finance 2019 | www.rinfinance.com



--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2019 | www.rinfinance.com

___
R-SIG-Finance@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.


[R-SIG-Finance] R/Finance 2019 Registration

2019-04-12 Thread Joshua Ulrich
Announcement below:

Please join us at the 11th annual R/Finance Conference!  As in prior
years, we expect more than 250 attendees from around the world. R
users from industry, academia, and government will joining 50+
presenters covering all areas of finance with R.  The conference will
take place on May 17th and 18th, at UIC in Chicago.

You can find registration information on the conference website:
https://go.uic.edu/rfinance2019

Note that registration fees will increase by 50% at the end of early
registration on May 6, 2019.

We are very excited about keynote presentations by Genevera Allen,
Arthur Steinmetz, and Matt Taddy.  The conference agenda (currently)
includes 25 full presentations and 25 shorter "lightning talks".  As
in previous years, several (optional) pre-conference seminars are
offered on Friday morning.  We're still working on the agenda, but we
have another great lineup of speakers this year!

There is also an (optional) conference dinner at Wyndham Grand Chicago
Riverfront in the 39th Floor Penthouse Ballroom and Terrace.  Situated
directly on the riverfront, it is a perfect venue to continue
conversations and networking.

On behalf of the committee, we look forward to seeing you in Chicago!

Petra Bakosova, Gib Bassett, Peter Carl, Dirk Eddelbuettel, Soumya
Kalra, Brian Peterson, Dale Rosenthal, Jeffrey Ryan, Justin Shea,
Joshua Ulrich


-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2019 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Free financial data - equities, equity options and ETFs - for quantmod package (or other packages)

2019-04-04 Thread Joshua Ulrich
On Wed, Apr 3, 2019 at 11:37 PM Lars Nygaard  wrote:
>
> I have quite good experience with this website: 
> https://eodhistoricaldata.com/ <https://eodhistoricaldata.com/>
> You have to pay some money but its quite good in my opinion.
>
There's no need to pay for this data.  You can get the same data for
free from tiingo.com.  You only need to sign up to get an API key.

> > On 4 Apr 2019, at 05:08, H  wrote:
> >
> > I am relatively new to analyzing financial data but have some experience 
> > with R. I understand that the data available from Yahoo Finance via its API 
> > is often questionable in quality and Google Finance is no longer available.
> >
> > Although Googling pointed me to some other sources such as Quandl etc., I 
> > am curious which other data sources quantmod itself supports for data 
> > retrieval, ie via an API, not via downloading and importing CSV-files?
> >
> > My interest is really US equities, stock options and ETFs - if possible 
> > from the same data source...
> >
> > Pointers to favorite data sources appreciated!
> >
> > Thank you.
> >
> >   [[alternative HTML version deleted]]
> >
> > ___
> > R-SIG-Finance@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.
>
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2019 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Lo catches slow

2019-03-13 Thread Joshua Ulrich
On Tue, Mar 12, 2019 at 11:53 PM Ilya Kipnis  wrote:
>
> Minimum reproducible example:
>
> require(quantmod)
> require(TTR)
>
> getSymbols('SPY')
> data <- cbind(OHLC(SPY), stoch(HLC(SPY)))
> head(Lo(data))
> head(HLC(data))
>
> Lo catches both the low from the OHLC object (which it's supposed to), and
> the slowD column (because it has low in the name), which it isn't supposed
> to.
>
This is a known issue that is hard to fix.  See
https://github.com/joshuaulrich/quantmod/issues/24

> This can cause issues down the line with other functions that call
> functions that search for the Low column which might cause a dimnames error
> down the line.
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2019 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] R/Finance 2019: Call for Presentations

2019-03-04 Thread Joshua Ulrich
Call for Diverse Presenters

The lack of diversity in tech is well-known, and the R/Finance
committee feels the situation in quantitative finance is potentially
even worse than in tech.  There has been great work on increasing
diversity in the broader R community over the past several years. We
need the help of the R community to make the same progress in the
quantitative R finance community.

In an effort to increase diversity of the presentations and presenters
at the R/Finance conference, the committee asks and encourages members
of under-represented or historically marginalized groups to respond to
the Call for Presentations. A full paper is not required. We
especially encourage those who were previously unaware of R/Finance to
submit their talk proposals. There is travel/accommodation funding
available if that may prevent you from attending and presenting.

R/Finance is dedicated to a safe, productive, and welcoming
environment free from discrimination and harassment. The conference
expects all participants to treat each other with respect and doesn’t
tolerate harassment of any kind as fitting of the University
environment. For details, please peruse the code of conduct here.

The CFP is open until this Friday. We look forward to hearing from you!

For the conference committee:
Petra Bakosova, Gib Bassett, Peter Carl, Dirk Eddelbuettel, Soumya
Kalra, Brian Peterson, Dale Rosenthal, Jeffrey Ryan, Justin Shea,
Joshua Ulrich


On Fri, Feb 1, 2019 at 7:35 AM Joshua Ulrich  wrote:
>
> R/Finance 2019: Applied Finance with R
> May 17 and 18, 2019
> University of Illinois at Chicago
>
> Call for Presentations
>
> The eleventh annual R/Finance conference for applied finance using R
> will be held on May 17 and 18, 2019 in Chicago, IL, USA at the
> University of Illinois at Chicago.  The conference will cover topics
> including portfolio management, time series analysis, advanced risk
> tools, high-performance computing, market microstructure, and
> econometrics.  All will be discussed within the context of using R as
> a primary tool for financial model development, risk management,
> portfolio construction, and trading.
>
> From its midwest beginnings, word of the conference spread among
> trading desks and universities, until it became the primary meeting
> for academics and practitioners interested in using R in quantitative
> finance.  It has featured presentations from prominent academics and
> practitioners, and we anticipate another exciting line-up for 2019.
>
> We invite you to submit complete papers in pdf format for
> consideration.  We will also consider one-page abstracts (in txt or
> pdf format) although more complete papers are preferred.  We welcome
> submissions for full talks (approximately 20 min.), abbreviated
> "lightning talks" (approx. 6 min.), and (1 hr.) pre-conference
> tutorials. Both academic and practitioner proposals related to R are
> encouraged.
>
> All slides will be made publicly available at conference time.
> Presenters are strongly encouraged to provide working R code to
> accompany the slides.  Ideally, data sets should  be made public for
> the purposes of reproducibility (though we realize this may be limited
> due to contracts with data vendors).  Preference may be given to
> innovative research or presenters who have released R packages.
>
> Please submit proposals online at http://go.uic.edu/rfinsubmit
>
> Submissions will be reviewed and accepted on a rolling basis with a
> final submission deadline of March 1, 2019.  Submitters will be
> notified on a rolling basis via email by March 15, 2019 of acceptance,
> presentation length, and financial assistance (if requested).
>
> Financial assistance for travel and accommodation may be available to
> presenters. Requests for financial assistance do not affect acceptance
> decisions. Requests must be made at the time of submission, and should
> indicate why assistance is being requested.  Requests made after
> submission are unlikely to be fulfilled. Assistance will be granted at
> the discretion of the conference committee.
>
> Additional details will be announced via the conference website
> http://www.RinFinance.com/ as they become available.  Information on
> previous years' presenters and their presentations are also at the
> conference website.  We will make a separate announcement when
> registration opens, usually sometime in mid to late March.
>
> For the conference committee:
> Petra Bakosova, Gib Bassett, Peter Carl, Dirk Eddelbuettel, Soumya
> Kalra, Brian Peterson, Dale Rosenthal, Jeffrey Ryan, Justin Shea,
> Joshua Ulrich
>
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com
> R/Finance 2018 | www.rinfinance.com



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS T

[R-SIG-Finance] R/Finance 2019: Call for Presentations

2019-02-01 Thread Joshua Ulrich
R/Finance 2019: Applied Finance with R
May 17 and 18, 2019
University of Illinois at Chicago

Call for Presentations

The eleventh annual R/Finance conference for applied finance using R
will be held on May 17 and 18, 2019 in Chicago, IL, USA at the
University of Illinois at Chicago.  The conference will cover topics
including portfolio management, time series analysis, advanced risk
tools, high-performance computing, market microstructure, and
econometrics.  All will be discussed within the context of using R as
a primary tool for financial model development, risk management,
portfolio construction, and trading.

>From its midwest beginnings, word of the conference spread among
trading desks and universities, until it became the primary meeting
for academics and practitioners interested in using R in quantitative
finance.  It has featured presentations from prominent academics and
practitioners, and we anticipate another exciting line-up for 2019.

We invite you to submit complete papers in pdf format for
consideration.  We will also consider one-page abstracts (in txt or
pdf format) although more complete papers are preferred.  We welcome
submissions for full talks (approximately 20 min.), abbreviated
"lightning talks" (approx. 6 min.), and (1 hr.) pre-conference
tutorials. Both academic and practitioner proposals related to R are
encouraged.

All slides will be made publicly available at conference time.
Presenters are strongly encouraged to provide working R code to
accompany the slides.  Ideally, data sets should  be made public for
the purposes of reproducibility (though we realize this may be limited
due to contracts with data vendors).  Preference may be given to
innovative research or presenters who have released R packages.

Please submit proposals online at http://go.uic.edu/rfinsubmit

Submissions will be reviewed and accepted on a rolling basis with a
final submission deadline of March 1, 2019.  Submitters will be
notified on a rolling basis via email by March 15, 2019 of acceptance,
presentation length, and financial assistance (if requested).

Financial assistance for travel and accommodation may be available to
presenters. Requests for financial assistance do not affect acceptance
decisions. Requests must be made at the time of submission, and should
indicate why assistance is being requested.  Requests made after
submission are unlikely to be fulfilled. Assistance will be granted at
the discretion of the conference committee.

Additional details will be announced via the conference website
http://www.RinFinance.com/ as they become available.  Information on
previous years' presenters and their presentations are also at the
conference website.  We will make a separate announcement when
registration opens, usually sometime in mid to late March.

For the conference committee:
Petra Bakosova, Gib Bassett, Peter Carl, Dirk Eddelbuettel, Soumya
Kalra, Brian Peterson, Dale Rosenthal, Jeffrey Ryan, Justin Shea,
Joshua Ulrich

-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2018 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Error plotting a zoo object

2018-11-17 Thread Joshua Ulrich
Hi Baki,

Please follow the posting guide and use plain text.  Your HTML message was
mangled.

Here's a simple example that reproduces the behavior:
library(quantmod)
library(ggplot2)
bist100 <- getSymbols("XU100.IS", from="2011-01-01")
bist100 <- Cl(XU100.IS)
bist100na <- na.approx(bist100)
ggplot(bist100na, aes(x = date, y = XU100.IS.Close)) + geom_line()

You get an error because "date" is a function in 'base'.

You can either use 'autoplot()`:
autoplot(bist100na)

Or you can fortify the object yourself, but then you have to name the `x`
and `y` columns correctly.  By default, the xts/zoo index is put in a
column named "Index".  So the ggplot() call would look like:
ggplot(fortify(bist100na), aes(x = Index, y = XU100.IS.Close)) + geom_line()

It is also very easy to use xts or zoo plotting via the plot() function:
plot(bist100na)

Hope that helps.

Best,
Josh


On Thu, Nov 15, 2018 at 5:34 PM Baki UNAL via R-SIG-Finance <
r-sig-finance@r-project.org> wrote:

> Hello
> My code is:
>
>
> library(quantmod)library(tseriesChaos)library(nonlinearTseries)library(zoo)library(ggplot2)
> bist100 <- getSymbols("XU100.IS", from="2011-01-01")
> bist100 <- XU100.IS$XU100.IS.Close
> bist100na <- na.approx(bist100)
> bist100norm <- (bist100na - (min(bist100na)))/(max(bist100na) -
> min(bist100na))
> my_rqa_det <- function(mydata) {  rqa.analysis=rqa(time.series = mydata,
> embedding.dim=11, time.lag=1,
>  radius=0.05,lmin=2,do.plot=FALSE,distanceToBorder=2)  mydet <-
> rqa.analysis$DET  return(mydet)}
> rollbist100norm<- rollapply(bist100norm, 260, my_rqa_det, by.column =
> TRUE, align = "right")
> rollbist100normna <- na.omit(rollbist100norm)
> ggplot(rollbist100normna, aes(x = date, y = det)) + geom_line()
>
>
> I tried to plot "rollbist100normna" in the last line but I got the
> following error:
>
>
> Don't know how to automatically pick scale for object of type function.
> Defaulting to continuous.Don't know how to automatically pick scale for
> object of type function. Defaulting to continuous.Error: Columns `x`, `y`
> must be 1d atomic vectors or listsCall `rlang::last_error()` to see a
> backtrace
>
>
> How can I fix this problem?
> Best regards.
> Baki
>
>
>
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2018 | www.rinfinance.com

[[alternative HTML version deleted]]

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Error in `[.xts`(one, trim:length(two), ) : subscript out of bounds

2018-07-11 Thread Joshua Ulrich
On Tue, Jul 10, 2018 at 3:14 PM, Stephen Choularton
 wrote:
> Hi
>
> I am getting this error even though I'm pretty sure I am not out of bounds:
>
> Error in `[.xts`(one, trim:length(two), ) : subscript out of bounds
> In addition: Warning message:
> In trim:length(two) :
>   numerical expression has 305 elements: only the first used
>
> I have tried all sorts of things but clearly I am not figuring out what is
> going wrong.
>
> I am developing code to recover prices from IB and test for cointegration.
>
> There are two files attached:
>
> * checkPairFromIB
>
> * metals.csv
>
> It all worked fine until I discovered gold and silver returned data of
> different lengths:  Gold had 320 days of data and silver 305.  The calls for
> data at lines 25 and 26 are identical so I don't know why.  Can anyone shed
> light on this?
>
I see a few problems in your code.  Note that I cannot replicate your
error, but I assume 'one' and 'two' are xts objects with OHLCV data.

The calls to length() will return the total number of _elements_ in
the xts objects, not the number of rows (or observations).  You likely
want the latter.

You define 'trim' as 'one - two'.  That is, you've subtracted two xts
objects.  Therefore, 'trim' contains the price differences of 'one'
minus 'two'.  Your code seems to treat 'trim' as the difference in the
number of observations between 'one' and 'two'.

The calls to `[.xts` treat the first argument as the locations of the
rows you want returned.  You can probably see why this is an error.
Creating a sequence that starts at "an xts object of price differences
between two securities" and ends at "the number of elements in an xts
object" does not make sense.

Since you only need close prices for the call to 'ca.jo()', I suggest
you do an inner join of the close prices of the two xts objects.

closePrices <- merge(one$Close, two$Close, join = "inner")
jotest <- ca.jo(closePrices, ...)

> I then tried to trim the longer table by disposing of the earlier 15 lines
> (see lines 44 to 55 of the code).  This is where the error messages came up.
> Can anyone point out what I am doing wrong?
>
> Thanks.
>
> Stephen
>
> --
> ---
> Stephen Choularton PhD, FIoD
> 0413 545 182
>
>
> ___
> R-SIG-Finance@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
R/Finance 2018 | www.rinfinance.com

___
R-SIG-Finance@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.


[R-SIG-Finance] R/Finance 2018: Live streamed

2018-06-01 Thread Joshua Ulrich
Hi All,

I wanted to let the list know that this year's conference is
once-again being live-streamed thanks to Microsoft.  The stream
includes slides and audio.

Most presentations will be recorded, and will be available after the
conference as well.

The live-stream link is:
https://www.youtube.com/watch?v=oV6FkS2KVc0

Best,
Josh

-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2018 | www.rinfinance.com

___
R-SIG-Finance@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.


[R-SIG-Finance] R/Finance 2018 Registration

2018-05-14 Thread Joshua Ulrich
Hi All,

A quick note that R/Finance registration is open, and early-bird
pricing ends a week from today, on 5/21.

Announcement below:

This year marks the 10th anniversary of the R/Finance Conference!  As
in prior years, we expect more than 250 attendees from around the
world. R users from industry, academia, and government will joining
50+ presenters covering all areas of finance with R.  The conference
will take place on June 1st and 2nd, at UIC in Chicago.

You can find registration information on the conference website:
http://www.rinfinance.com/#registration

or you can go directly to the Cvent registration page:
http://go.uic.edu/rfinance

Note that registration fees will increase by 50% at the end of early
registration on May 21, 2018.

We are very excited about keynote presentations by JJ Allaire, Li
Deng, and Norm Matloff.  The conference agenda (currently) includes 18
full presentations and 33 shorter "lightning talks".  As in previous
years, several (optional) pre-conference seminars are offered on
Friday morning.  We're still working on the agenda, but we have
another great lineup of speakers this year!

There is also an (optional) conference dinner at Wyndham Grand Chicago
Riverfront in the 39th Floor Penthouse Ballroom and Terrace.  Situated
directly on the riverfront, it is a perfect venue to continue
conversations while dining and drinking.

We would to thank our 2018 Sponsors for the continued support enabling
us to host such an exciting conference:

  UIC Liautaud Master of Science in Finance
  Microsoft
  R Consortium
  RStudio
  William Blair
  Citadel
  Quasardb

On behalf of the committee and sponsors, we look forward to seeing you
in Chicago!

  Gib Bassett, Peter Carl, Dirk Eddelbuettel, Brian Peterson, Dale
Rosenthal, Jeffrey Ryan, Joshua Ulrich



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2018 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Error using Performance Analytics package

2018-03-12 Thread Joshua Ulrich
It would be easier for others to help you if you provided a
reproducible example.  Here are some tips on how to create one:
https://stackoverflow.com/q/5963269/271616

Also, please follow the posting guide and send plain text emails, not
HTML.  The latter are likely to be mangled by the list server, which
makes them hard to read (and is another impediment to someone trying
to help).

On Mon, Mar 12, 2018 at 7:52 AM, Pankaj K Agarwal via R-SIG-Finance
<r-sig-finance@r-project.org> wrote:
> Dear all,I am using a dataset of monthly asset returns. I subset it with 
> window() call of package zoo. When i try to compute Modified VaR on this 
> subset, i am getting the following error:
> Error in dimnames(cd) <- list(as.character(index(x)), colnames(x)) :   
> 'dimnames' applied to non-array
> Can someone help? I googled it a lot but still nothing seems to be working.
> Regards,
> Pankaj K Agarwal
> +91-98397-11444http://in.linkedin.com/in/pankajkagarwal/
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2018 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] R/Finance 2018: Call for Papers

2018-02-01 Thread Joshua Ulrich
A friendly reminder that the CFP closes tomorrow!

On Tue, Jan 9, 2018 at 11:35 AM, Joshua Ulrich <josh.m.ulr...@gmail.com> wrote:
> R/Finance 2018: Applied Finance with R
> June 1 and 2, 2018
> University of Illinois at Chicago
>
>
> Call For Papers
>
> The tenth annual R/Finance conference for applied finance using R will
> be held June 1 and 2, 2018 in Chicago, IL, USA at the University of
> Illinois at Chicago (https://www.uic.edu). The conference will cover
> topics including portfolio management, time series analysis, advanced
> risk tools, high-performance computing, market microstructure, and
> econometrics. All will be discussed within the context of using R as a
> primary tool for financial risk management, portfolio construction,
> and trading.
>
> Over the past nine years, R/Finance has included attendees from around
> the world. It has featured presentations from prominent academics and
> practitioners, and we anticipate another exciting line-up for 2018.
>
> We invite you to submit complete papers in pdf format for
> consideration. We will also consider one-page abstracts (in txt or pdf
> format) although more complete papers are preferred. We welcome
> submissions for both full talks and abbreviated lightning talks. Both
> academic and practitioner proposals related to R are encouraged.
>
> All slides will be made publicly available at conference time.
> Presenters are strongly encouraged to provide working R code to
> accompany the slides. Data sets should also be made public for the
> purposes of reproducibility (though we realize this may be limited due
> to contracts with data vendors). Preference may be given to presenters
> who have released R packages.
>
> Please submit proposals online at
>
> http://go.uic.edu/rfinsubmit
>
> Submissions will be reviewed and accepted on a rolling basis with a
> final submission deadline of February 2, 2018. Submitters will be
> notified via email by March 2, 2018 of acceptance, presentation
> length, and financial assistance (if requested).
>
> Financial assistance for travel and accommodation may be available to
> presenters. Requests for financial assistance do not affect acceptance
> decisions. Requests should be made at the time of submission. Requests
> made after submission are much less likely to be fulfilled. Assistance
> will be granted at the discretion of the conference committee.
>
> Additional details will be announced via the conference website
> (http://www.rinfinance.com) as they become available. Information on
> previous years' presenters and their presentations are also at the
> conference website. We will make a separate announcement when
> registration opens.
>
> For the program committee:
> Gib Bassett, Peter Carl, Dirk Eddelbuettel, Brian Peterson,
> Dale Rosenthal, Jeffrey Ryan, Joshua Ulrich
>
>
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com
> R/Finance 2018 | www.rinfinance.com



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2018 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] R finance conference question

2018-01-19 Thread Joshua Ulrich
On Fri, Jan 19, 2018 at 9:26 AM, Daniel Melendez
<danielmelen...@alum.northwestern.edu> wrote:
> Hello -
>
> Are there still open spots to present?  I know the deadline is Feb 2
>
There are no pre-specified number of open spots.  We will not know the
number and types of slots until after the deadline, and after all
submissions have been evaluated.

> Regards - Daniel
>
> ___
> R-SIG-Finance@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
R/Finance 2018 | www.rinfinance.com

___
R-SIG-Finance@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.


[R-SIG-Finance] R/Finance 2018: Call for Papers

2018-01-09 Thread Joshua Ulrich
R/Finance 2018: Applied Finance with R
June 1 and 2, 2018
University of Illinois at Chicago


Call For Papers

The tenth annual R/Finance conference for applied finance using R will
be held June 1 and 2, 2018 in Chicago, IL, USA at the University of
Illinois at Chicago (https://www.uic.edu). The conference will cover
topics including portfolio management, time series analysis, advanced
risk tools, high-performance computing, market microstructure, and
econometrics. All will be discussed within the context of using R as a
primary tool for financial risk management, portfolio construction,
and trading.

Over the past nine years, R/Finance has included attendees from around
the world. It has featured presentations from prominent academics and
practitioners, and we anticipate another exciting line-up for 2018.

We invite you to submit complete papers in pdf format for
consideration. We will also consider one-page abstracts (in txt or pdf
format) although more complete papers are preferred. We welcome
submissions for both full talks and abbreviated lightning talks. Both
academic and practitioner proposals related to R are encouraged.

All slides will be made publicly available at conference time.
Presenters are strongly encouraged to provide working R code to
accompany the slides. Data sets should also be made public for the
purposes of reproducibility (though we realize this may be limited due
to contracts with data vendors). Preference may be given to presenters
who have released R packages.

Please submit proposals online at

http://go.uic.edu/rfinsubmit

Submissions will be reviewed and accepted on a rolling basis with a
final submission deadline of February 2, 2018. Submitters will be
notified via email by March 2, 2018 of acceptance, presentation
length, and financial assistance (if requested).

Financial assistance for travel and accommodation may be available to
presenters. Requests for financial assistance do not affect acceptance
decisions. Requests should be made at the time of submission. Requests
made after submission are much less likely to be fulfilled. Assistance
will be granted at the discretion of the conference committee.

Additional details will be announced via the conference website
(http://www.rinfinance.com) as they become available. Information on
previous years' presenters and their presentations are also at the
conference website. We will make a separate announcement when
registration opens.

For the program committee:
Gib Bassett, Peter Carl, Dirk Eddelbuettel, Brian Peterson,
Dale Rosenthal, Jeffrey Ryan, Joshua Ulrich


-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2018 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] An Issue with quantmod

2017-11-25 Thread Joshua Ulrich
On Sat, Nov 25, 2017 at 3:35 PM, Robert Sherry <rsher...@comcast.net> wrote:
> Josh or anybody else,
>
> First I want to thank Josh for his attention to this bug. I looked at the
> following URL:
> https://github.com/joshuaulrich/quantmod/issues/197
> and I see the following:
>
> I just pushed an update to the 197_getQuote branch. Please test and provide
> feedback!
>
> There is one minor issue regarding the "Last Time" field. It's currently in
> your local timezone, not the exchange timezone. The fix needs to account for
> the possibility that users may request multiple symbols, and those symbols
> may be from exchanges in different timezones. You cannot mix timezones in a
> POSIXctvector, so we need to check whether all the timezones are the same,
> and convert them to a common timezone if they are not.
>
>
> What I do not know is how to get this update? I have run the following
> command:  update.packages()
> However, this command updates all packages and I do not believe I can
> specify the particular branch 197_getQuote. What should I do?
>
Have you tried what's suggested in the README.md?  I've quoted the
relevant portion below:

Installation

The current release is available on CRAN, which you can install via:
install.packages("quantmod")

To install the development version, you need to clone the repository
and build from source, or run one of:

# lightweight
remotes::install_github("joshuaulrich/quantmod")
# or
devtools::install_github("joshuaulrich/quantmod")

> Bob Sherry
>
>
>
> On 11/14/2017 9:11 AM, Joshua Ulrich wrote:
>
> On Tue, Nov 14, 2017 at 8:09 AM, Robert Sherry <rsher...@comcast.net> wrote:
>
> I am using version 3.4.2 of R and I run the following two commands:
>  library(quantmod)
>  x=getQuote( "XOM" )
> and get the following error messages:
>
> Error in download.file(paste("https://finance.yahoo.com/d/quotes.csv?s=;,  :
>   cannot open URL
> 'https://finance.yahoo.com/d/quotes.csv?s=XOM=d1t1l1c1p2ohgv'
> In addition: Warning message:
> In download.file(paste("https://finance.yahoo.com/d/quotes.csv?s=;, :
>   cannot open URL
> 'https://finance.yahoo.com/d/quotes.csv?s=XOM=d1t1l1c1p2ohgv': HTTP status
> was '403 Forbidden'
>
> What should I do?
>
> Search open issues (the function name and portion(s) of the error are
> usually good search terms):
> https://github.com/joshuaulrich/quantmod/issues/
>
> And report a new issue if someone else already hasn't.  In this case,
> it's already been reported and I'm working on a fix:
> https://github.com/joshuaulrich/quantmod/issues/197
>
> Bob
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] An Issue with quantmod

2017-11-14 Thread Joshua Ulrich
On Tue, Nov 14, 2017 at 8:09 AM, Robert Sherry <rsher...@comcast.net> wrote:
>
> I am using version 3.4.2 of R and I run the following two commands:
>  library(quantmod)
>  x=getQuote( "XOM" )
> and get the following error messages:
>
> Error in download.file(paste("https://finance.yahoo.com/d/quotes.csv?s=;,  :
>   cannot open URL
> 'https://finance.yahoo.com/d/quotes.csv?s=XOM=d1t1l1c1p2ohgv'
> In addition: Warning message:
> In download.file(paste("https://finance.yahoo.com/d/quotes.csv?s=;, :
>   cannot open URL
> 'https://finance.yahoo.com/d/quotes.csv?s=XOM=d1t1l1c1p2ohgv': HTTP status
> was '403 Forbidden'
>
> What should I do?
>
Search open issues (the function name and portion(s) of the error are
usually good search terms):
https://github.com/joshuaulrich/quantmod/issues/

And report a new issue if someone else already hasn't.  In this case,
it's already been reported and I'm working on a fix:
https://github.com/joshuaulrich/quantmod/issues/197

> Bob
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Interaction with Alpha Vantage?

2017-11-06 Thread Joshua Ulrich
On Mon, Nov 6, 2017 at 9:41 AM, Dirk Eddelbuettel <e...@debian.org> wrote:
> Credit where credit is due---the 'tidyquant' folks first mentioned it, but it

FWIW, I'm not sure when 'tidyquant' folks first mentioned it, but Paul
wrote his first implementation in early July--it just didn't make it
into quantmod until months later.  The first commit of the
'alphavantager' package was in early September.

> in the fullest and most glorious tradition of the tibbliesverse require half
> a dozen or more other packages for not apparent reason.  So I followed up
> with a quick tweet on Sep 5 about a one-liner not needing anything else
> besides data.table:
>
>   https://twitter.com/eddelbuettel/status/905066349294219264
>
> and cooked up a helper function in a so-far-unreleased package of personal
> functions (this one is below) which I shared with at least Josh.  The larger
> function added to quantmod is AFAIK contributed by Paul.
>
> Now, as for interchaning with them: Nope. I too need ETFs, Canadian stocks
> and whatnot for the little personal finance app I have had as a daily cronjob
> since the 1990s (and been meaning to rewrite in R since then too as it is,
> gasp, Perl -- see eg https://github.com/eddelbuettel/beancounter and other
> online resources). It may now be time to rewrite this as the underlying
> (Perl) data grabber Finance::YahooQuote is now dead due to Yahoo! walking
> away from that API.  I have an unpublished R-based drop-in replacement for
> just the data gathering ...
>
> Anyway, alphavantage looks good.  We should test it some more.
>
> Dirk
>
>
>
> ##' Fetch a real-time market data series from AlphaVantage
> ##'
> ##' Several optional parameters could be set, but are not currently.
> ##' @title Retrieve real-time data from AlphaVantage
> ##' @param sym Character string value for the ticker
> ##' @param datatype Character string value for the supported type of data, 
> currently one of
> ##' \dQuote{intraday}, \dQuote{daily}, \dQuote{adjdaily}, \dQuote{weekly}, 
> \dQuote{monthly}.
> ##' @param outputsize Character string value, one of \dQuote{compact} or 
> \dQuote{full}. Applies
> ##' only daily or intraday data.
> ##' @return A data.table object
> ##' @author Dirk Eddelbuettel
> alphavantage <- function(sym,
>  datatype=c("intraday", "daily", "adjdaily", 
> "weekly", "monthly"),
>  outputsize=c("compact", "full")) {
> datatype <- match.arg(datatype)
> outputsize <- match.arg(outputsize)
> datatypeArg <- switch(datatype,
>   intraday = "TIME_SERIES_INTRADAY",
>   daily= "TIME_SERIES_DAILY",
>   adjdaily = "TIME_SERIES_DAILY_ADJUSTED",
>   weekly   = "TIME_SERIES_WEEKLY",
>   monthly  = "TIME_SERIES_MONTHLY")
>
> cmd <- paste0("https://www.alphavantage.co/query?;,
>   "function=", datatypeArg, "&",
>   "symbol=", sym, "&",
>   "interval=1min&",
>   "apikey=", getOption("alphavantageKey", "demo"), "&",
>   "datatype=csv&")
> if (datatype %in% c("intraday", "daily", "adjdaily")) {
> cmd <- paste0(cmd, "outputsize=", outputsize)
> }
> #print(cmd)
> data <- data.table::fread(cmd, showProgress=FALSE)
> }
>
>
> --
> http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Error in lm prediction

2017-07-28 Thread Joshua Ulrich
On Mon, Jul 24, 2017 at 1:10 PM, Ed Herranz <ed.herr...@gmail.com> wrote:
> Hi Amol,
>
> My guess is that you can't use lm() directly on xts objects.  See this:
>
> https://stackoverflow.com/questions/21692560/linear-regression-with-xts-object
>
Bad guess. :)

library(xts)
data(sample_matrix)
xtsObject <- as.xts(sample_matrix)
xtsObject$t <- seq_len(nrow(xtsObject))-1
lm(Open ~ t, data=xtsObject)

> Regards,
> -Ed
>
> On Sun, Jul 16, 2017 at 4:31 PM, amol gupta <amolgupt...@gmail.com> wrote:
>
>> Hi
>>
>> I am most likely committing an error in trying to predict  using linear
>> regression lm model. please help me figure out what am I doing wrong. I am
>> trying to regress a index and its constituents. Here is the code
>>
>>
>> #split ts inttwo parts
>> a<-300;
>>
>> x1<-x[1:a,];
>> y1<-y[1:a,];
>>
>> x2<-x[(a+1):nrow(x),];
>> y2<-y[(a+1):nrow(y),];
>>
>>
>> #regression
>> m1<-lm( y1~x1)
>> r1<-residuals(m1)
>> coef(m1)
>>
>> ##out of sample
>> y_hat<-predict.lm(m1,x2);
>> r2<-y_hat-y2;
>>
>>
>> x,y are xts. X contains multiple time series. The y_ hat turns out to be of
>> 300 samples only, whereas x2 contains 1400 samples.
>>
>> Please help me figure out how to predict using model that I have found
>> using regression.
>>
It's very difficult to help if you do not provide a reproducible
example.  Most people do not have, and will not spend, the time it
takes to imagine and create data required to reproduce the issue you
describe.

Please see: https://stackoverflow.com/q/5963269/271616

>>
>> --
>> Regards
>> Amol
>> +91-9897860992
>> +91-8889676918
>>
>> [[alternative HTML version deleted]]
>>
>> ___
>> R-SIG-Finance@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.
>>
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

On Mon, Jul 24, 2017 at 1:10 PM, Ed Herranz <ed.herr...@gmail.com> wrote:
> Hi Amol,
>
> My guess is that you can't use lm() directly on xts objects.  See this:
>
> https://stackoverflow.com/questions/21692560/linear-regression-with-xts-object
>
> Regards,
> -Ed
>
> On Sun, Jul 16, 2017 at 4:31 PM, amol gupta <amolgupt...@gmail.com> wrote:
>
>> Hi
>>
>> I am most likely committing an error in trying to predict  using linear
>> regression lm model. please help me figure out what am I doing wrong. I am
>> trying to regress a index and its constituents. Here is the code
>>
>>
>> #split ts inttwo parts
>> a<-300;
>>
>> x1<-x[1:a,];
>> y1<-y[1:a,];
>>
>> x2<-x[(a+1):nrow(x),];
>> y2<-y[(a+1):nrow(y),];
>>
>>
>> #regression
>> m1<-lm( y1~x1)
>> r1<-residuals(m1)
>> coef(m1)
>>
>> ##out of sample
>> y_hat<-predict.lm(m1,x2);
>> r2<-y_hat-y2;
>>
>>
>> x,y are xts. X contains multiple time series. The y_ hat turns out to be of
>> 300 samples only, whereas x2 contains 1400 samples.
>>
>> Please help me figure out how to predict using model that I have found
>> using regression.
>>
>>
>> --
>> Regards
>> Amol
>> +91-9897860992
>> +91-8889676918
>>
>> [[alternative HTML version deleted]]
>>
>> ___
>> R-SIG-Finance@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.
>>
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Yahoo Finance API change

2017-06-27 Thread Joshua Ulrich
What versions are you referring to as "old"?  This was fixed in
quantmod 0.4-9 and tseries 0.10-41.

Or are you referring to this issue?
https://github.com/joshuaulrich/quantmod/issues/174

On Tue, Jun 27, 2017 at 3:01 PM, Alec Schmidt <aschm...@stevens.edu> wrote:
> It is possible now to download long time series of prices from Yahoo 
> manually. However, the 'old' APIs for quantmod and tseries do not work.  Is 
> there chance new APIs will be implemented?
> Alec
> 
> From: R-SIG-Finance <r-sig-finance-boun...@r-project.org> on behalf of Joshua 
> Ulrich <josh.m.ulr...@gmail.com>
> Sent: Wednesday, May 17, 2017 5:45 PM
> To: r-sig-finance
> Subject: Re: [R-SIG-Finance] Yahoo Finance API change
>
> Some notes from tinkering with a potential fix:
>
> - You need an established session with cookies to download data
> - The URL requires a 'crumb'
> - The columns of the CSV are in OHLCAV order (vs OHLCVA)
> - The OHL columns are already split-adjusted; the Close columns is not
> - Observations for some dates may be "null" in the CSV
> - The format of the CSV for split data changed
>
> The the commit messages and diffs for details:
> https://github.com/joshuaulrich/quantmod/compare/157_yahoo_502
>
> On Tue, May 16, 2017 at 8:11 PM, Joshua Ulrich <josh.m.ulr...@gmail.com> 
> wrote:
>> Hi all,
>>
>> Just wanted to let the list know that Yahoo Finance changed their API
>> and most download functions will no longer work.  It looks like
>> getting it working will require creating and tracking a session with
>> the Yahoo Finance servers.
>>
>> If you're interested in quantmod::getSymbols.yahoo, you can track
>> progress on the fix on the GitHub issue I created:
>> https://github.com/joshuaulrich/quantmod/issues/157
>>
>> Best,
>> Josh
>>
>>
>> --
>> Joshua Ulrich  |  about.me/joshuaulrich
>> FOSS Trading  |  www.fosstrading.com
>> R/Finance 2017 | www.rinfinance.com
>
>
>
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com
> R/Finance 2017 | www.rinfinance.com
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Quantmod: Problem with Lo(LOW)

2017-06-03 Thread Joshua Ulrich
On Sat, Jun 3, 2017 at 12:10 PM, Keith Sabol <sabo...@gmail.com> wrote:
> There appears to be a problem with Lo() when used with ticker "LOW".
>
> library(quantmod)
>
> getSymbols("LOW")
> [1] "LOW"
>> adjustOHLC(LOW)
> Error in `-.default`(Lo(x), Cl(x)) : non-conformable arrays
>> head(LOW)
>LOW.Open LOW.High LOW.Low LOW.Close LOW.Volume LOW.Adjusted
> 2007-01-0331.2132.31   31.15 32.04   1414320032.04
> 2007-01-0432.4032.50   31.61 32.18835190032.18
> 2007-01-0532.1632.41   31.59 31.79829560031.79
> 2007-01-0831.6231.82   31.13 31.70642340031.70
> 2007-01-0931.7632.05   31.69 31.87505330031.87
> 2007-01-1031.7132.59   31.70 32.47874180032.47
>> Lo
> function (x)
> {
> if (has.Lo(x))
> return(x[, grep("Low", colnames(x), ignore.case = TRUE)])
> stop("subscript out of bounds: no column name containing \"Low\"")
> }
> 
>>
>
> head(LOW[, grep("Low", colnames(LOW), ignore.case = TRUE)])
>LOW.Open LOW.High LOW.Low LOW.Close LOW.Volume LOW.Adjusted
> 2007-01-0331.2132.31   31.15 32.04   1414320032.04
> 2007-01-0432.4032.50   31.61 32.18835190032.18
> 2007-01-0532.1632.41   31.59 31.79829560031.79
> 2007-01-0831.6231.82   31.13 31.70642340031.70
> 2007-01-0931.7632.05   31.69 31.87505330031.87
> 2007-01-1031.7132.59   31.70 32.47874180032.47
>
> One viable remedy appears to be adding a period before "Low" in the grep
> line:
>
This has been suggested before, and does not work:
https://github.com/joshuaulrich/quantmod/issues/24

>
> head(LOW[, grep(".Low", colnames(LOW), ignore.case = TRUE)])
>LOW.Low
> 2007-01-03   31.15
> 2007-01-04   31.61
> 2007-01-05   31.59
> 2007-01-08   31.13
> 2007-01-09   31.69
> 2007-01-10   31.70
>>
>
> Hope this helps.
>
> Thanks for your great work on this package Josh.
>
> Keith
>
> [[alternative HTML version deleted]]
>
> ___________
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] does quantmod::adjustOHLC adust for dividends?

2017-06-02 Thread Joshua Ulrich
On Fri, Jun 2, 2017 at 10:29 AM, Vivek Rao <vivekr...@yahoo.com> wrote:
> Thank you. I see that the IBM.Open, IBM.High, IBM.Low, and IBM.Close columns
> are adjusted for dividends, and IBM.Adjusted column actually contains the
> raw close.

This is not true.  The IBM.Adjusted column contains the split-adjusted
close.  It's the same as the raw close for this time period though,
because IBM has not had a split since mid-1999.

getSymbols("IBM", from ="1900-01-01")
head(IBM)
   IBM.Open IBM.High IBM.Low IBM.Close IBM.Volume IBM.Adjusted
1962-01-02578.5578.5 572  572. 387200 7.626667
1962-01-03572.0577.0 572  577. 288000 7.69
1962-01-04577.0577.0 571  571.2501 256000 7.616667
1962-01-05570.5570.5 559  560. 363200 7.47
1962-01-08559.5559.5 545  549.5001 544000 7.326667
1962-01-09552.0563.0 552  556. 491200 7.41
tail(IBM["1999-05"])
   IBM.Open IBM.High IBM.Low IBM.Close IBM.Volume IBM.Adjusted
1999-05-21  232.750  233.375 229.188  230.37506899800 115.1875
1999-05-24  230.312  230.688 221.750  223.75008598200 111.8750
1999-05-25  222.500  226.000 221.000  221.18759405000 110.5938
1999-05-26  223.000  236.625 221.438  236.2500   16628000 118.1250
1999-05-27  116.688  116.875 112.625  116.   10552500 116.
1999-05-28  116.000  116.750 114.188  116.6379500 116.


> This is fine as long the user knows this -- the naming of the columns could
> suggest
> the reverse.
>
> Before Yahoo changed its data format, when I used getYahooData from package
> TTR to get data, the fields returned were
> Open,High,Low,Close,Volume,Unadj.Close,Div,Split,Adj.Div . I think the label
> "Unadj.Close" for the raw close
> is more descriptive.
>
> Vivek Rao
>
> 
> From: Joshua Ulrich <josh.m.ulr...@gmail.com>
> To: Ilya Kipnis <ilya.kip...@gmail.com>
> Cc: Vivek Rao <vivekr...@yahoo.com>; "r-sig-finance@r-project.org"
> <r-sig-finance@r-project.org>
> Sent: Friday, June 2, 2017 10:51 AM
> Subject: Re: [R-SIG-Finance] does quantmod::adjustOHLC adust for dividends?
>
> On Fri, Jun 2, 2017 at 9:47 AM, Ilya Kipnis <ilya.kip...@gmail.com> wrote:
>> That's a function of yahoo data no longer adjusting for dividends.
>>
> No, it isn't.
>
>> On Fri, Jun 2, 2017 at 10:45 AM, Vivek Rao via R-SIG-Finance <
>> r-sig-finance@r-project.org> wrote:
>>
>>> (I tried sending this message before joining the group, but it was held
>>> for moderation.)
>>>
>>> It appears that the adjustOHLC function of the quantmod package does not
>>> create an .Adjusted field
>>> that reflects dividends.
>>>
>>> The code
>>>
>>> library("quantmod")
>>> sym <- "IBM"
>>> START.DATE = "2016-01-01"
>>> div <- getDividends(sym,auto.assign=FALSE,from=START.DATE)
>>> xx <- getSymbols(sym, from=START.DATE, src="yahoo", auto.assign=FALSE)
>>> xx.a <- adjustOHLC(xx)
>>> xx.uA <- adjustOHLC(xx, use.Adjusted=TRUE)
>
> The issue is that you must set the symbol.name argument if the first
> argument to adjustOHLC() is not named the same as the symbol being
> adjusted.
>
> This works:
>
> xx.a2 <- adjustOHLC(xx, symbol.name = sym)
> head(xx.a2)
>   IBM.Open IBM.High  IBM.Low IBM.Close IBM.Volume IBM.Adjusted
> 2016-01-04 128.3440 128.6942 127.0568  128.67535229400  135.95
> 2016-01-05 129.4420 129.5650 127.6342  128.58073924800  135.85
> 2016-01-06 127.1893 128.3251 126.4700  127.93714310900  135.17
> 2016-01-07 126.5457 127.7951 125.3437  125.75077025800  132.86
> 2016-01-08 126.0535 126.6593 124.2931  124.58654762700  131.63
> 2016-01-11 124.7568 126.6593 124.7095  126.10094974400  133.23
>
>>> cat("\ndiv\n")
>>> print(head(div))
>>> cat("\nxx\n")
>>> print(head(xx))
>>> cat("\nxx.a\n")
>>> print(head(xx.a))
>>> cat("\nxx.uA\n")
>>> print(head(xx.uA))
>>>
>>> produces the output below. I'd expect that IBM.Adjusted field to have
>>> different values
>>> at the beginning of the period, depending on whether one adjusts for
>>> dividends.
>>>
>>> div
>>> IBM.div
>>> 2016-02-081.3
>>> 2016-05-061.4
>>> 2016-08-081.4
>>> 2016-11-081.4
>>> 2017-02-081.4
>>> 2017-05-081.5
>>>

Re: [R-SIG-Finance] does quantmod::adjustOHLC adust for dividends?

2017-06-02 Thread Joshua Ulrich
Also note that this issue is discussed here:
https://github.com/joshuaulrich/quantmod/issues/152

Comments welcome!

On Fri, Jun 2, 2017 at 9:51 AM, Joshua Ulrich <josh.m.ulr...@gmail.com>
wrote:

> On Fri, Jun 2, 2017 at 9:47 AM, Ilya Kipnis <ilya.kip...@gmail.com> wrote:
> > That's a function of yahoo data no longer adjusting for dividends.
> >
> No, it isn't.
>
> > On Fri, Jun 2, 2017 at 10:45 AM, Vivek Rao via R-SIG-Finance <
> > r-sig-finance@r-project.org> wrote:
> >
> >> (I tried sending this message before joining the group, but it was held
> >> for moderation.)
> >>
> >> It appears that the adjustOHLC function of the quantmod package does not
> >> create an .Adjusted field
> >> that reflects dividends.
> >>
> >> The code
> >>
> >> library("quantmod")
> >> sym <- "IBM"
> >> START.DATE = "2016-01-01"
> >> div <- getDividends(sym,auto.assign=FALSE,from=START.DATE)
> >> xx <- getSymbols(sym, from=START.DATE, src="yahoo", auto.assign=FALSE)
> >> xx.a <- adjustOHLC(xx)
> >> xx.uA <- adjustOHLC(xx, use.Adjusted=TRUE)
>
> The issue is that you must set the symbol.name argument if the first
> argument to adjustOHLC() is not named the same as the symbol being
> adjusted.
>
> This works:
>
> xx.a2 <- adjustOHLC(xx, symbol.name = sym)
> head(xx.a2)
>IBM.Open IBM.High  IBM.Low IBM.Close IBM.Volume IBM.Adjusted
> 2016-01-04 128.3440 128.6942 127.0568  128.67535229400   135.95
> 2016-01-05 129.4420 129.5650 127.6342  128.58073924800   135.85
> 2016-01-06 127.1893 128.3251 126.4700  127.93714310900   135.17
> 2016-01-07 126.5457 127.7951 125.3437  125.75077025800   132.86
> 2016-01-08 126.0535 126.6593 124.2931  124.58654762700   131.63
> 2016-01-11 124.7568 126.6593 124.7095  126.10094974400   133.23
>
> >> cat("\ndiv\n")
> >> print(head(div))
> >> cat("\nxx\n")
> >> print(head(xx))
> >> cat("\nxx.a\n")
> >> print(head(xx.a))
> >> cat("\nxx.uA\n")
> >> print(head(xx.uA))
> >>
> >> produces the output below. I'd expect that IBM.Adjusted field to have
> >> different values
> >> at the beginning of the period, depending on whether one adjusts for
> >> dividends.
> >>
> >> div
> >> IBM.div
> >> 2016-02-08 1.3
> >> 2016-05-06 1.4
> >> 2016-08-08 1.4
> >> 2016-11-08 1.4
> >> 2017-02-08 1.4
> >> 2017-05-08 1.5
> >>
> >> xx
> >> IBM.Open IBM.High IBM.Low IBM.Close IBM.Volume IBM.Adjusted
> >> 2016-01-04   135.60   135.97  134.24135.955229400   135.95
> >> 2016-01-05   136.76   136.89  134.85135.853924800   135.85
> >> 2016-01-06   134.38   135.58  133.62135.174310900   135.17
> >> 2016-01-07   133.70   135.02  132.43132.867025800   132.86
> >> 2016-01-08   133.18   133.82  131.32131.634762700   131.63
> >> 2016-01-11   131.81   133.82  131.76133.234974400   133.23
> >>
> >> xx.a
> >> IBM.Open IBM.High IBM.Low IBM.Close IBM.Volume IBM.Adjusted
> >> 2016-01-04   135.60   135.97  134.24135.955229400   135.95
> >> 2016-01-05   136.76   136.89  134.85135.853924800   135.85
> >> 2016-01-06   134.38   135.58  133.62135.174310900   135.17
> >> 2016-01-07   133.70   135.02  132.43132.867025800   132.86
> >> 2016-01-08   133.18   133.82  131.32131.634762700   131.63
> >> 2016-01-11   131.81   133.82  131.76133.234974400   133.23
> >>
> >> xx.uA
> >> IBM.Open IBM.High IBM.Low IBM.Close IBM.Volume IBM.Adjusted
> >> 2016-01-04   135.60   135.97  134.24135.955229400   135.95
> >> 2016-01-05   136.76   136.89  134.85135.853924800   135.85
> >> 2016-01-06   134.38   135.58  133.62135.174310900   135.17
> >> 2016-01-07   133.70   135.02  132.43132.867025800   132.86
> >> 2016-01-08   133.18   133.82  131.32131.634762700   131.63
> >> 2016-01-11   131.81   133.82  131.76133.234974400   133.23
> >>
> >> Vivek Rao
> >>
> >> _______
> >> R-SIG-Finance@r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> >> -- Subscriber-posting only.

Re: [R-SIG-Finance] does quantmod::adjustOHLC adust for dividends?

2017-06-02 Thread Joshua Ulrich
On Fri, Jun 2, 2017 at 9:47 AM, Ilya Kipnis <ilya.kip...@gmail.com> wrote:
> That's a function of yahoo data no longer adjusting for dividends.
>
No, it isn't.

> On Fri, Jun 2, 2017 at 10:45 AM, Vivek Rao via R-SIG-Finance <
> r-sig-finance@r-project.org> wrote:
>
>> (I tried sending this message before joining the group, but it was held
>> for moderation.)
>>
>> It appears that the adjustOHLC function of the quantmod package does not
>> create an .Adjusted field
>> that reflects dividends.
>>
>> The code
>>
>> library("quantmod")
>> sym <- "IBM"
>> START.DATE = "2016-01-01"
>> div <- getDividends(sym,auto.assign=FALSE,from=START.DATE)
>> xx <- getSymbols(sym, from=START.DATE, src="yahoo", auto.assign=FALSE)
>> xx.a <- adjustOHLC(xx)
>> xx.uA <- adjustOHLC(xx, use.Adjusted=TRUE)

The issue is that you must set the symbol.name argument if the first
argument to adjustOHLC() is not named the same as the symbol being
adjusted.

This works:

xx.a2 <- adjustOHLC(xx, symbol.name = sym)
head(xx.a2)
   IBM.Open IBM.High  IBM.Low IBM.Close IBM.Volume IBM.Adjusted
2016-01-04 128.3440 128.6942 127.0568  128.67535229400   135.95
2016-01-05 129.4420 129.5650 127.6342  128.58073924800   135.85
2016-01-06 127.1893 128.3251 126.4700  127.93714310900   135.17
2016-01-07 126.5457 127.7951 125.3437  125.75077025800   132.86
2016-01-08 126.0535 126.6593 124.2931  124.58654762700   131.63
2016-01-11 124.7568 126.6593 124.7095  126.10094974400   133.23

>> cat("\ndiv\n")
>> print(head(div))
>> cat("\nxx\n")
>> print(head(xx))
>> cat("\nxx.a\n")
>> print(head(xx.a))
>> cat("\nxx.uA\n")
>> print(head(xx.uA))
>>
>> produces the output below. I'd expect that IBM.Adjusted field to have
>> different values
>> at the beginning of the period, depending on whether one adjusts for
>> dividends.
>>
>> div
>> IBM.div
>> 2016-02-08 1.3
>> 2016-05-06 1.4
>> 2016-08-08 1.4
>> 2016-11-08 1.4
>> 2017-02-08 1.4
>> 2017-05-08 1.5
>>
>> xx
>> IBM.Open IBM.High IBM.Low IBM.Close IBM.Volume IBM.Adjusted
>> 2016-01-04   135.60   135.97  134.24135.955229400   135.95
>> 2016-01-05   136.76   136.89  134.85135.853924800   135.85
>> 2016-01-06   134.38   135.58  133.62135.174310900   135.17
>> 2016-01-07   133.70   135.02  132.43132.867025800   132.86
>> 2016-01-08   133.18   133.82  131.32131.634762700   131.63
>> 2016-01-11   131.81   133.82  131.76133.234974400   133.23
>>
>> xx.a
>> IBM.Open IBM.High IBM.Low IBM.Close IBM.Volume IBM.Adjusted
>> 2016-01-04   135.60   135.97  134.24135.955229400   135.95
>> 2016-01-05   136.76   136.89  134.85135.853924800   135.85
>> 2016-01-06   134.38   135.58  133.62135.174310900   135.17
>> 2016-01-07   133.70   135.02  132.43132.867025800   132.86
>> 2016-01-08   133.18   133.82  131.32131.634762700   131.63
>> 2016-01-11   131.81   133.82  131.76133.234974400   133.23
>>
>> xx.uA
>> IBM.Open IBM.High IBM.Low IBM.Close IBM.Volume IBM.Adjusted
>> 2016-01-04   135.60   135.97  134.24135.955229400   135.95
>> 2016-01-05   136.76   136.89  134.85135.853924800   135.85
>> 2016-01-06   134.38   135.58  133.62135.174310900   135.17
>> 2016-01-07   133.70   135.02  132.43132.867025800   132.86
>> 2016-01-08   133.18   133.82  131.32131.634762700   131.63
>> 2016-01-11   131.81   133.82  131.76133.234974400   133.23
>>
>> Vivek Rao
>>
>> ___
>> R-SIG-Finance@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.
>>
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Error in addTxn - Quantstrat

2017-05-25 Thread Joshua Ulrich
This is now fixed in:
https://github.com/braverock/blotter/commit/537f7870665859346a1157b2bc786c6d7325f6fb

Thanks for the report!

On Wed, May 24, 2017 at 3:46 PM, John Kumar <rj...@yahoo.com> wrote:

> Thanks for taking the time to look at this guys. Sorry for the verbose
> example but minimal means different things to different people depending on
> their skills, or lack thereof in my case. Cheers
> John
>
> -Original Message-----
> From: Joshua Ulrich [mailto:josh.m.ulr...@gmail.com]
> Sent: Wednesday, 24 May 2017 10:31 PM
> To: Daniel Cegiełka <daniel.cegie...@gmail.com>
> Cc: John Kumar <rj...@yahoo.com>; r-sig-finance <
> R-SIG-Finance@r-project.org>
> Subject: Re: [R-SIG-Finance] Error in addTxn - Quantstrat
>
> On Wed, May 24, 2017 at 1:10 PM, Daniel Cegiełka <
> daniel.cegie...@gmail.com> wrote:
> > 2017-05-24 19:45 GMT+02:00 Joshua Ulrich <josh.m.ulr...@gmail.com>:
> >>
> >> This is a bug that was introduced here:
> >> https://github.com/braverock/blotter/commit/24b578628415111885d29ef97
> >> d5ab0eed1c7bb75
> >
> >
> > https://github.com/braverock/blotter/commit/24b578628415111885d29ef97d
> > 5ab0eed1c7bb75#diff-7347fe5a0f184f79ef064e92e3beb297R69
> >
> > https://github.com/braverock/blotter/blob/master/R/addTxn.R#L85
> >
> > why end() from stats?
> >
> Because stats::end is the generic.
>
> > https://github.com/braverock/blotter/blob/master/R/addTxn.R#L154
> >
> > Should be end.xts(), eg:
> >
> end.xts() is not exported from the xts namespace.  And it's generally a
> bad idea to call methods directly, because you do not know if that method
> will be able to handle objects of different classes.
>
> > end.xts <- function (x, ...)
> > {
> > if (!length(x)) {
> > index(x[length(.index(x)), ])
> > } else
> > index(x[NROW(x), ])
> > }
> >
> > If I understood the problem correctly...
> >
> > Best,
> > Daniel
> >
> >
> >>
> >>
> >>
> >> Here's a *minimal* reproducible example:
> >> require(blotter)
> >> currency("USD")
> >> initPortf("test", symbols="AAPL", currency="USD")
> >>
> >> addTxn("test", "AAPL", as.Date("2017-01-01"),  1, 10) addTxn("test",
> >> "AAPL", as.Date("2017-01-02"), -1, 10)
> >>
> >> Thanks for the report!  I'll work on a fix.
> >>
> >> Best,
> >> Josh
> >>
>
>
>
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com
> R/Finance 2017 | www.rinfinance.com
>
>


-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

[[alternative HTML version deleted]]

___
R-SIG-Finance@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.

Re: [R-SIG-Finance] Fwd: Error in addTxn - Quantstrat

2017-05-24 Thread Joshua Ulrich
On Wed, May 24, 2017 at 2:37 PM, Daniel Cegiełka
<daniel.cegie...@gmail.com> wrote:
>
> ok, I found a bug.
>
> https://github.com/braverock/blotter/blob/master/R/addTxn.R#L81
>
> as.Date("2017-01-01") return time-based object:
>
> if(!is.timeBased(TxnDate) ){
> TxnDate<-as.POSIXct(TxnDate)
> }
>
> and TxnDate != POSIXct
>
Yes, I arrived at the same conclusion before I sent my initial email.
I mentioned it in the bug report I created:
https://github.com/braverock/blotter/issues/51

Apologies for not mentioning it in the email... there was no need for
you to spend time on it.

> Best,
> Daniel
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.

Re: [R-SIG-Finance] Error in addTxn - Quantstrat

2017-05-24 Thread Joshua Ulrich
On Wed, May 24, 2017 at 1:10 PM, Daniel Cegiełka
<daniel.cegie...@gmail.com> wrote:
> 2017-05-24 19:45 GMT+02:00 Joshua Ulrich <josh.m.ulr...@gmail.com>:
>>
>> This is a bug that was introduced here:
>> https://github.com/braverock/blotter/commit/24b578628415111885d29ef97d5ab0eed1c7bb75
>
>
> https://github.com/braverock/blotter/commit/24b578628415111885d29ef97d5ab0eed1c7bb75#diff-7347fe5a0f184f79ef064e92e3beb297R69
>
> https://github.com/braverock/blotter/blob/master/R/addTxn.R#L85
>
> why end() from stats?
>
Because stats::end is the generic.

> https://github.com/braverock/blotter/blob/master/R/addTxn.R#L154
>
> Should be end.xts(), eg:
>
end.xts() is not exported from the xts namespace.  And it's generally
a bad idea to call methods directly, because you do not know if that
method will be able to handle objects of different classes.

> end.xts <- function (x, ...)
> {
> if (!length(x)) {
> index(x[length(.index(x)), ])
> } else
> index(x[NROW(x), ])
> }
>
> If I understood the problem correctly...
>
> Best,
> Daniel
>
>
>>
>>
>>
>> Here's a *minimal* reproducible example:
>> require(blotter)
>> currency("USD")
>> initPortf("test", symbols="AAPL", currency="USD")
>>
>> addTxn("test", "AAPL", as.Date("2017-01-01"),  1, 10)
>> addTxn("test", "AAPL", as.Date("2017-01-02"), -1, 10)
>>
>> Thanks for the report!  I'll work on a fix.
>>
>> Best,
>> Josh
>>



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.

Re: [R-SIG-Finance] Error in addTxn - Quantstrat

2017-05-24 Thread Joshua Ulrich
ty=+.orderqty,
> replace=FALSE
>  ),
>  type='enter',
>  label='EnterLONG'
> )
>
> add.rule(strategy.st, name='ruleSignal',
>  arguments=list(sigcol='short', sigval=TRUE,
>         orderside='short',
> ordertype='stoplimit', prefer='Low',
> threshold=-.threshold,
> orderqty=-.orderqty,
> replace=FALSE
>  ),
>  type='enter',
>  label='EnterSHORT'
> )
>
> 
> ###
>
> applyStrategy(strategy.st, portfolio.st)
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] blotter failed to build status

2017-05-19 Thread Joshua Ulrich
We moved blotter from R-Forge to GitHub awhile ago.  You can find it here:
https://github.com/braverock/blotter

On Fri, May 19, 2017 at 1:46 PM, John Kumar via R-SIG-Finance
<r-sig-finance@r-project.org> wrote:
> Hi All,
> I am trying to install blotter on R 3.4, but getting 404 error and R forge
> page says failed to build (rev. 1749) so unavailable. Anyone know how I can
> get an older revision to install from source or some such workaround.
>
> I did try to install from the github page but that led to previously working
> code throwing errors they never used to like:
>
> Error in addTxn(Portfolio = portfolio, Symbol = symbol, TxnDate = txntime,
> :
>   Transactions must be added in order. TxnDate (2009-01-12) is before last
> transaction in portfolio (1995-01-01)
>
>
> Thanks in advance
> John
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


[R-SIG-Finance] R/Finance 2017: Live streamed

2017-05-19 Thread Joshua Ulrich
Hi All,

I wanted to let the list know that this year's conference is being
live-streamed by Microsoft.  The stream includes slides and audio.

All but a few presentations will be recorded, and they will also be
available after the conference as well.

The live-stream link is:
aka.ms/r_finance

-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Question / Bug Report with quantmod

2017-05-17 Thread Joshua Ulrich
On Wed, May 17, 2017 at 8:55 PM, Ernest Stokely <wizardc...@gmail.com> wrote:
> Sorry if this is a neophyte question, but when I execute
>
> devtools::install_github("joshuaulrich/quantmod", ref="157_yahoo_502”)
>
> I get the following error message:
>
> "Installation failed: Could not find build tools necessary to build
> quantmod”
>
See the second-to-last bullet in the Installation section of quantmod's README:
https://github.com/joshuaulrich/quantmod#installation

> Help much appreciated.
>
> Ernie
>
> On May 17, 2017, at 4:30 PM, Joshua Ulrich <josh.m.ulr...@gmail.com> wrote:
>
> On Wed, May 17, 2017 at 4:23 PM, Robert Sherry <rsher...@comcast.net> wrote:
>
> When I run the following two commands:
>
>library(quantmod)
>
>d1=getDividends( "XOM" )
>
> I get the messages:
>
> Error in download.file(paste(yahoo.URL, Symbol.name, "=", from.m, "=",
> :
>  cannot open URL
> 'https://ichart.finance.yahoo.com/table.csv?s=XOM=0=01=1970=4=17=2017=v=.csv'
> In addition: Warning message:
> In download.file(paste(yahoo.URL, Symbol.name, "=", from.m, "=",  :
>  cannot open: HTTP status was '502 Connection refused'
>
> I am using version 3.2.2 of R. If appropriate, I would be happy to report on
> bug at:
>
>https://github.com/joshuaulrich/quantmod/issues
>
> Please comment.
>
> Had you clicked the link you provided, you would see that the first issue
> is:
> https://github.com/joshuaulrich/quantmod/issues/157
>
> Which is what you've reported.
>
> Thanks,
>
> Bob
>
> ___
> R-SIG-Finance@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
> R/Finance 2017 | www.rinfinance.com
>
> _______
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.

Re: [R-SIG-Finance] Yahoo Finance API change

2017-05-17 Thread Joshua Ulrich
Some notes from tinkering with a potential fix:

- You need an established session with cookies to download data
- The URL requires a 'crumb'
- The columns of the CSV are in OHLCAV order (vs OHLCVA)
- The OHL columns are already split-adjusted; the Close columns is not
- Observations for some dates may be "null" in the CSV
- The format of the CSV for split data changed

The the commit messages and diffs for details:
https://github.com/joshuaulrich/quantmod/compare/157_yahoo_502

On Tue, May 16, 2017 at 8:11 PM, Joshua Ulrich <josh.m.ulr...@gmail.com> wrote:
> Hi all,
>
> Just wanted to let the list know that Yahoo Finance changed their API
> and most download functions will no longer work.  It looks like
> getting it working will require creating and tracking a session with
> the Yahoo Finance servers.
>
> If you're interested in quantmod::getSymbols.yahoo, you can track
> progress on the fix on the GitHub issue I created:
> https://github.com/joshuaulrich/quantmod/issues/157
>
> Best,
> Josh
>
>
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com
> R/Finance 2017 | www.rinfinance.com



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Question / Bug Report with quantmod

2017-05-17 Thread Joshua Ulrich
On Wed, May 17, 2017 at 4:23 PM, Robert Sherry <rsher...@comcast.net> wrote:
> When I run the following two commands:
>
> library(quantmod)
>
> d1=getDividends( "XOM" )
>
> I get the messages:
>
> Error in download.file(paste(yahoo.URL, Symbol.name, "=", from.m, "=",
> :
>   cannot open URL
> 'https://ichart.finance.yahoo.com/table.csv?s=XOM=0=01=1970=4=17=2017=v=.csv'
> In addition: Warning message:
> In download.file(paste(yahoo.URL, Symbol.name, "=", from.m, "=",  :
>   cannot open: HTTP status was '502 Connection refused'
>
> I am using version 3.2.2 of R. If appropriate, I would be happy to report on
> bug at:
>
> https://github.com/joshuaulrich/quantmod/issues
>
> Please comment.
>
Had you clicked the link you provided, you would see that the first issue is:
https://github.com/joshuaulrich/quantmod/issues/157

Which is what you've reported.

> Thanks,
>
> Bob
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Yahoo Finance API change

2017-05-16 Thread Joshua Ulrich
On Tue, May 16, 2017 at 8:17 PM, Alec Schmidt <aschm...@stevens.edu> wrote:
> IMHO it's not necessarily quantmod problem. I use get.hist.quote() from 
> tseries, which, too,  yields the same error 502.

I don't think it's only a quantmod problem either, which is why I said
most functions that download from Yahoo Finance will no longer work.

I mentioned getSymbols.yahoo because that's the most popular function
I maintain that uses the Yahoo Finance API.

> 
> From: R-SIG-Finance <r-sig-finance-boun...@r-project.org> on behalf of Joshua 
> Ulrich <josh.m.ulr...@gmail.com>
> Sent: Tuesday, May 16, 2017 9:11 PM
> To: r-sig-finance
> Subject: [R-SIG-Finance] Yahoo Finance API change
>
> Hi all,
>
> Just wanted to let the list know that Yahoo Finance changed their API
> and most download functions will no longer work.  It looks like
> getting it working will require creating and tracking a session with
> the Yahoo Finance servers.
>
> If you're interested in quantmod::getSymbols.yahoo, you can track
> progress on the fix on the GitHub issue I created:
> https://github.com/joshuaulrich/quantmod/issues/157
>
> Best,
> Josh
>
>
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com
> R/Finance 2017 | www.rinfinance.com
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Yahoo Did not update

2017-05-16 Thread Joshua Ulrich
On Tue, May 16, 2017 at 8:12 PM, Erol Biceroglu
<erol.bicero...@alumni.utoronto.ca> wrote:
> Pasting
> https://ichart.finance.yahoo.com/table.csv?s=XLE=0=01=1998=11=30=2016=d=q=0=XLE=.csv
> in a browser yields the following message from yahoo:
>
> "Will be right back... Thank you for your patience. Our engineers are
> working quickly to resolve the issue."
>
> Is is possible that it's a temporary issue?
>
Doubt it. Looks like they changed it to be more secure and harder to scrape.

>
> Erol Biceroglu
> 416-275-7970
> *LinkedIn <http://ca.linkedin.com/in/erolbiceroglu> | Wordpress
> <https://propfoliomanagement.wordpress.com/>*
>
> On Tue, May 16, 2017 at 8:56 PM, Alec Schmidt <aschm...@stevens.edu> wrote:
>
>> Roger,
>> I'm getting nervous with yahoo outage. Google works indeed, but it
>> provides only closing but not adjusted prices. Any way around?
>> Thanks, Alec
>>
>> 
>> From: R-SIG-Finance <r-sig-finance-boun...@r-project.org> on behalf of
>> Roger Bos <roger@gmail.com>
>> Sent: Tuesday, May 16, 2017 6:11 PM
>> To: R P Herrold
>> Cc: r-sig-finance
>> Subject: Re: [R-SIG-Finance] Yahoo Did not update
>>
>> Google still works
>>
>>
>> On May 16, 2017 4:25 PM, "R P Herrold" <herr...@owlriver.com> wrote:
>>
>> > On Tue, 16 May 2017, Ilya Kipnis wrote:
>> >
>> > > Can confirm. Having issues downloading from Yahoo, getting a 502 error.
>> > > Should I reinstall quantmod?
>> >
>> > If your personal vehicle runs out of fuel, would you discard
>> > it and purchase a new car?
>> >
>> > Yahoo! Finance data is just fuel for quantmod in my analogy --
>> > other data providers and vendors exist
>> >
>> > https://www.quandl.com/
>> > http://www.tickdata.com/html/downloads.shtml
>> > https://orats.com/
>> > http://www.nanex.net/
>> > https://www.bloomberg.com/markets/chart/data/1D/AAPL:US
>> > http://www.interactivebrokers.com/
>> >
>> > Some on that list offer some data without charge
>> >
>> > -- Russ herrold
>> >
>> > ___
>> > R-SIG-Finance@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.
>> >
>>
>> [[alternative HTML version deleted]]
>>
>> ___
>> R-SIG-Finance@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.
>>
>> ___
>> R-SIG-Finance@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.
>>
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


[R-SIG-Finance] Yahoo Finance API change

2017-05-16 Thread Joshua Ulrich
Hi all,

Just wanted to let the list know that Yahoo Finance changed their API
and most download functions will no longer work.  It looks like
getting it working will require creating and tracking a session with
the Yahoo Finance servers.

If you're interested in quantmod::getSymbols.yahoo, you can track
progress on the fix on the GitHub issue I created:
https://github.com/joshuaulrich/quantmod/issues/157

Best,
Josh


-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Trying to Extract Option Quotes with R

2017-05-13 Thread Joshua Ulrich
On Fri, May 12, 2017 at 3:39 PM, Robert Sherry <rsher...@comcast.net> wrote:
> Joshua and Frank,
>
> Thanks for your responses. I am using version 3.2.2 of R. I
> installed/reinstalled jsonlite and curl. I still get the same problem. I
> then updated my version of quantmod. After doing this, I ran the command:
>
> getOptionChain( "XOM", Exp=NULL )
>
> and  I got the message:
> Error in data.frame(Strike = strike, Last = lastprice, Chg = change, Bid =
> bid,  :
>   object 'contractsymbol' not found
> Since, it is not working for you either, I guess that quantmod has a
> significant bug.
>
This is now fixed on GitHub:
https://github.com/joshuaulrich/quantmod/issues/155

You can install with:
remotes::install_github("joshuaulrich/quantmod")

> Is there a better way to get free option quotes in R?
>
> Thank you,
>
> Bob
>
> On 5/12/2017 2:09 PM, Joshua Ulrich wrote:
>
> On Fri, May 12, 2017 at 1:02 PM, Frank <frankm60...@gmail.com> wrote:
>
> It looks like some of the dependencies don't load automatically. I was using
> R x64 3.2.2:
>
> They load automatically.  They are not *installed* automatically.
>
> 1) Updated my R to the later version
> 2) I installed package jsonlite  ("package:"jsonlite"cannot be loaded.")
> 3) I installed package curl ("Error: Required package curl not found. Please
> run: install.packages('curl')"
> 4) I updated to R x64 3.2.5 then R x64 3.3.3 re-installed the above.
>
> I now get
>
> " Error in data.frame(Strike = strike, Last = lastprice, Chg = change, Bid =
> bid,  :
>   object 'contractsymbol' not found"
>
> The complete output is now:
>
> "
> version 3.3.3 (2017-03-06) -- "Another Canoe"
> Copyright (C) 2017 The R Foundation for Statistical Computing
> Platform: x86_64-w64-mingw32/x64 (64-bit)
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
>
>   Natural language support but running in an English locale
>
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
>
>  library(quantmod)
>
> Loading required package: xts
> Loading required package: zoo
>
> Attaching package: 'zoo'
>
> The following objects are masked from 'package:base':
>
> as.Date, as.Date.numeric
>
> Loading required package: TTR
> Version 0.4-0 included new data defaults. See ?getSymbols.
>
>  optData = getOptionChain( "XOM", Exp=NULL )
>
> Error in data.frame(Strike = strike, Last = lastprice, Chg = change, Bid =
> bid,  :
>   object 'contractsymbol' not found
> Calls: getOptionChain ...  -> with -> with.default -> eval ->
> eval -> data.frame
> Execution halted
>
> I get the same error.  It looks like Yahoo changed something so that
> now fromJSON returns an empty list for the put/call tables instead of
> NULL.
>
> -Original Message-
> From: R-SIG-Finance [mailto:r-sig-finance-boun...@r-project.org] On Behalf
> Of Robert Sherry
> Sent: Friday, May 12, 2017 11:35 AM
> To: r-sig-finance@r-project.org
> Subject: [R-SIG-Finance] Trying to Extract Option Quotes with R
>
> I executed the following commands in R:
>
>  library(quantmod)
>  optData = getOptionChain( "XOM", Exp=NULL )
>  nrow(optData)
>
> The last command returned NULL. What am I doing wrong?
>
> Bob
>
> ___
> R-SIG-Finance@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.
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Trying to Extract Option Quotes with R

2017-05-12 Thread Joshua Ulrich
On Fri, May 12, 2017 at 1:02 PM, Frank <frankm60...@gmail.com> wrote:
> It looks like some of the dependencies don't load automatically. I was using
> R x64 3.2.2:
>
They load automatically.  They are not *installed* automatically.

> 1) Updated my R to the later version
> 2) I installed package jsonlite  ("package:"jsonlite"cannot be loaded.")
> 3) I installed package curl ("Error: Required package curl not found. Please
> run: install.packages('curl')"
> 4) I updated to R x64 3.2.5 then R x64 3.3.3 re-installed the above.
>
> I now get
>
> " Error in data.frame(Strike = strike, Last = lastprice, Chg = change, Bid =
> bid,  :
>   object 'contractsymbol' not found"
>
> The complete output is now:
>
> "
> version 3.3.3 (2017-03-06) -- "Another Canoe"
> Copyright (C) 2017 The R Foundation for Statistical Computing
> Platform: x86_64-w64-mingw32/x64 (64-bit)
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
>
>   Natural language support but running in an English locale
>
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
>
>>  library(quantmod)
> Loading required package: xts
> Loading required package: zoo
>
> Attaching package: 'zoo'
>
> The following objects are masked from 'package:base':
>
> as.Date, as.Date.numeric
>
> Loading required package: TTR
> Version 0.4-0 included new data defaults. See ?getSymbols.
>>  optData = getOptionChain( "XOM", Exp=NULL )
> Error in data.frame(Strike = strike, Last = lastprice, Chg = change, Bid =
> bid,  :
>   object 'contractsymbol' not found
> Calls: getOptionChain ...  -> with -> with.default -> eval ->
> eval -> data.frame
> Execution halted
>
I get the same error.  It looks like Yahoo changed something so that
now fromJSON returns an empty list for the put/call tables instead of
NULL.

>
> -Original Message-
> From: R-SIG-Finance [mailto:r-sig-finance-boun...@r-project.org] On Behalf
> Of Robert Sherry
> Sent: Friday, May 12, 2017 11:35 AM
> To: r-sig-finance@r-project.org
> Subject: [R-SIG-Finance] Trying to Extract Option Quotes with R
>
> I executed the following commands in R:
>
>  library(quantmod)
>  optData = getOptionChain( "XOM", Exp=NULL )
>  nrow(optData)
>
> The last command returned NULL. What am I doing wrong?
>
> Bob
>
> ___
> R-SIG-Finance@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.
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] R/Finance 2017 Update

2017-05-09 Thread Joshua Ulrich
Last reminder.  Early-bird registration ends tonight!

On Fri, May 5, 2017 at 3:09 PM, Joshua Ulrich <josh.m.ulr...@gmail.com> wrote:
> Quick reminder that prices increase 50% on Monday!
>
> On Mon, May 1, 2017 at 12:13 PM, Joshua Ulrich <josh.m.ulr...@gmail.com> 
> wrote:
>> The R/Finance 2017 program is published!
>>
>> The conference will take place on May 19 and 20, at UIC in Chicago.
>> Building on the success of the previous conferences in 2009-2016, we
>> expect more than 250 attendees from around the world. R users from
>> industry, academia, and government will joining 50 presenters covering
>> all areas of finance with R.
>>
>> We are very excited about the two keynote presentations given by Dave
>> DeMers and Szilard Pafka.  The conference agenda (currently) includes
>> 19 full presentations and 31 shorter "lightning talks".  As in
>> previous years, several (optional) pre-conference seminars are offered
>> on Friday morning.
>>
>> There is also an (optional) conference dinner at the Penthouse
>> Ballroom and Terrace at the Wyndham Grand Chicago Riverfront.  From
>> the 39th floor, you can gaze at sweeping views of the downtown skyline
>> and Chicago River, and continue conversations while dining and
>> drinking.
>>
>> Program details and registration information are available at:
>>   http://www.RinFinance.com/
>>
>> Please note that registration fees will increase by 50% at the end of
>> early registration on May 8, 2017 (1 week!).
>>
>> We would to thank our 2017 Sponsors for the continued support enabling
>> us to host such an exciting conference:
>>
>>   UIC Liautaud Master of Science in Finance
>>   Microsoft
>>
>>   Interactive Brokers
>>   RStudio
>>   William Blair
>>
>> On behalf of the committee and sponsors, we look forward to seeing you
>> in Chicago!
>>
>>   Gib Bassett, Peter Carl, Dirk Eddelbuettel, Brian Peterson, Dale
>> Rosenthal, Jeffrey Ryan, Joshua Ulrich
>>
>> --
>> Joshua Ulrich  |  about.me/joshuaulrich
>> FOSS Trading  |  www.fosstrading.com
>> R/Finance 2017 | www.rinfinance.com
>
>
>
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com
> R/Finance 2017 | www.rinfinance.com



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] R/Finance 2017 Update

2017-05-05 Thread Joshua Ulrich
Quick reminder that prices increase 50% on Monday!

On Mon, May 1, 2017 at 12:13 PM, Joshua Ulrich <josh.m.ulr...@gmail.com> wrote:
> The R/Finance 2017 program is published!
>
> The conference will take place on May 19 and 20, at UIC in Chicago.
> Building on the success of the previous conferences in 2009-2016, we
> expect more than 250 attendees from around the world. R users from
> industry, academia, and government will joining 50 presenters covering
> all areas of finance with R.
>
> We are very excited about the two keynote presentations given by Dave
> DeMers and Szilard Pafka.  The conference agenda (currently) includes
> 19 full presentations and 31 shorter "lightning talks".  As in
> previous years, several (optional) pre-conference seminars are offered
> on Friday morning.
>
> There is also an (optional) conference dinner at the Penthouse
> Ballroom and Terrace at the Wyndham Grand Chicago Riverfront.  From
> the 39th floor, you can gaze at sweeping views of the downtown skyline
> and Chicago River, and continue conversations while dining and
> drinking.
>
> Program details and registration information are available at:
>   http://www.RinFinance.com/
>
> Please note that registration fees will increase by 50% at the end of
> early registration on May 8, 2017 (1 week!).
>
> We would to thank our 2017 Sponsors for the continued support enabling
> us to host such an exciting conference:
>
>   UIC Liautaud Master of Science in Finance
>   Microsoft
>
>   Interactive Brokers
>   RStudio
>   William Blair
>
> On behalf of the committee and sponsors, we look forward to seeing you
> in Chicago!
>
>   Gib Bassett, Peter Carl, Dirk Eddelbuettel, Brian Peterson, Dale
> Rosenthal, Jeffrey Ryan, Joshua Ulrich
>
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com
> R/Finance 2017 | www.rinfinance.com



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


[R-SIG-Finance] R/Finance 2017 Update

2017-05-01 Thread Joshua Ulrich
The R/Finance 2017 program is published!

The conference will take place on May 19 and 20, at UIC in Chicago.
Building on the success of the previous conferences in 2009-2016, we
expect more than 250 attendees from around the world. R users from
industry, academia, and government will joining 50 presenters covering
all areas of finance with R.

We are very excited about the two keynote presentations given by Dave
DeMers and Szilard Pafka.  The conference agenda (currently) includes
19 full presentations and 31 shorter "lightning talks".  As in
previous years, several (optional) pre-conference seminars are offered
on Friday morning.

There is also an (optional) conference dinner at the Penthouse
Ballroom and Terrace at the Wyndham Grand Chicago Riverfront.  From
the 39th floor, you can gaze at sweeping views of the downtown skyline
and Chicago River, and continue conversations while dining and
drinking.

Program details and registration information are available at:
  http://www.RinFinance.com/

Please note that registration fees will increase by 50% at the end of
early registration on May 8, 2017 (1 week!).

We would to thank our 2017 Sponsors for the continued support enabling
us to host such an exciting conference:

  UIC Liautaud Master of Science in Finance
  Microsoft

  Interactive Brokers
  RStudio
  William Blair

On behalf of the committee and sponsors, we look forward to seeing you
in Chicago!

  Gib Bassett, Peter Carl, Dirk Eddelbuettel, Brian Peterson, Dale
Rosenthal, Jeffrey Ryan, Joshua Ulrich

-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] quantmod getSymbols() failing on Yahoo

2017-04-20 Thread Joshua Ulrich
On Thu, Apr 20, 2017 at 3:57 PM, Keith Sabol <sabo...@gmail.com> wrote:
> Marco,
> Updating your version of quantmod, as suggested by Josh, should work. Did for 
> me.
>
> Keith
>
>> On Apr 20, 2017, at 1:44 PM, Magicaltats Bianchi <marcolondo...@gmail.com> 
>> wrote:
>>
>> I have in fact experienced exactly the same identical situation. Don't 
>> really understand where the problem is coming from, let alone figuring out 
>> what to do to resolve it! Any suggestions welcome. Marco

If you're interested in what happened, there are details in the GitHub issue:
https://github.com/joshuaulrich/quantmod/issues/149

>>
>>> On 20 Apr 2017 7:00 p.m., "Keith Sabol" <sabo...@gmail.com> wrote:
>>> I've been using getSymbols() to retrieve data from Yahoo for some time
>>> without difficulty.  Recently, I've been getting this error:
>>>
>>> getSymbols("IBM")
>>> Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "=", from.m,
>>>  :
>>>   cannot open URL '
>>> http://ichart.finance.yahoo.com/table.csv?s=IBM=0=01=2007=3=20=2017=d=q=0=IBM=.csv
>>> '
>>>
>>>
>>> Pasting this url into my browser works as expected:
>>>
>>> https://ichart.finance.yahoo.com/table.csv?s=IBM=0=01=2007=3=20=2017=d=q=0=IBM=.csv
>>>
>>>
>>> Can someone suggest how I might find/edit the line in the quantmod code
>>> that would enable me to to switch to HTTPS until the package catches up?
>>>
>>> Thanks, in advance, for any assistance.
>>>
>>> Keith
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> ___
>>> R-SIG-Finance@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.
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] quantmod getSymbols() failing on Yahoo

2017-04-20 Thread Joshua Ulrich
On Thu, Apr 20, 2017 at 12:59 PM, Keith Sabol <sabo...@gmail.com> wrote:
> I've been using getSymbols() to retrieve data from Yahoo for some time
> without difficulty.  Recently, I've been getting this error:
>
> getSymbols("IBM")
> Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "=", from.m,
>  :
>   cannot open URL '
> http://ichart.finance.yahoo.com/table.csv?s=IBM=0=01=2007=3=20=2017=d=q=0=IBM=.csv
> '
>
>
> Pasting this url into my browser works as expected:
>
> https://ichart.finance.yahoo.com/table.csv?s=IBM=0=01=2007=3=20=2017=d=q=0=IBM=.csv
>
>
> Can someone suggest how I might find/edit the line in the quantmod code
> that would enable me to to switch to HTTPS until the package catches up?
>
The package caught up yesterday.  You need to upgrade to quantmod 0.4-8 on CRAN.

> Thanks, in advance, for any assistance.
>
> Keith
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] random portfolios

2017-03-21 Thread Joshua Ulrich
On Tue, Mar 21, 2017 at 5:41 AM, Brian G. Peterson <br...@braverock.com> wrote:
>

> To answer the question of whether Rcpp will help is somewhat complex. I'm
> confident that some of the nested loops in the generation code will be sped
> up by Rcpp.  It is possible that more efficient algorithms are available for
> constructing the weight vectors.  A reason that this hasn't been a huge
> priority though is that construction of the random portfolio matrix is
> usually not the time limiter in a large optimization: your objective
> function is.  I think it will be possible to improve the efficiency of this
> step, though it is unclear how much of an impact this should have in
> practice to a large and complicated numerically solved portfolio
> optimization problem.
>
Brian has hinted at this, but I want to say it explicitly.   Whether
or not moving to compiled code is worth it is mostly an empirical
question.  And it's difficult to do more that speculate, unless you
have profiling data.  So I would strongly encourage you to profile
your optimization before you change any code.  I would be happy to
help review the profiling output.

> Regards,
>
> Brian
>
>

>
>
> --
> Brian G. Peterson
> http://braverock.com/brian/
> Ph: 773-459-4973
> IM: bgpbraverock
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] R/Finance 2017: Call for Papers

2017-02-27 Thread Joshua Ulrich
A friendly reminder that the CFP deadline is tomorrow!

On Wed, Jan 4, 2017 at 8:11 AM, Joshua Ulrich <josh.m.ulr...@gmail.com> wrote:
> Call for Papers:
>
> R/Finance 2017: Applied Finance with R
> May 19 and 20, 2017
> University of Illinois at Chicago
>
> The ninth annual R/Finance conference for applied finance using R will
> be held on May 19 and 20, 2017 in Chicago, IL, USA at the University
> of Illinois at Chicago.  The conference will cover topics including
> portfolio management, time series analysis, advanced risk tools,
> high-performance computing, market microstructure, and econometrics.
> All will be discussed within the context of using R as a primary tool
> for financial risk management, portfolio construction, and trading.
>
> Over the past eight years, R/Finance has included attendees from
> around the world.  It has featured presentations from prominent
> academics and practitioners, and we anticipate another exciting
> line-up for 2017.
>
> We invite you to submit complete papers in pdf format for
> consideration.  We will also consider one-page abstracts (in txt or
> pdf format) although more complete papers are preferred.  We welcome
> submissions for both full talks and abbreviated "lightning talks."
> Both academic and practitioner proposals related to R are encouraged.
>
> All slides will be made publicly available at conference time.
> Presenters are strongly encouraged to provide working R code to
> accompany the slides.  Data sets should also be made public for the
> purposes of reproducibility (though we realize this may be limited due
> to contracts with data vendors).  Preference may be given to
> presenters who have released R packages.
>
> Financial assistance for travel and accommodation may be available to
> presenters, however requests must be made at the time of submission.
> Assistance will be granted at the discretion of the conference
> committee.
>
> Please submit proposals online at http://go.uic.edu/rfinsubmit.
>
> Submissions will be reviewed and accepted on a rolling basis with a
> final deadline of February 28, 2017.  Submitters will be notified via
> email by March 31, 2017 of acceptance, presentation length, and
> financial assistance (if requested).
>
> Additional details will be announced via the conference website
>
> http://www.RinFinance.com/
>
> as they become available.  Information on previous years' presenters
> and their presentations are also at the conference website.  We will
> make a separate announcement when registration opens.
>
> For the program committee:
> Gib Bassett, Peter Carl, Dirk Eddelbuettel, Brian Peterson, Dale
> Rosenthal, Jeffrey Ryan, Joshua Ulrich
>


-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] SMA of RSI

2017-02-27 Thread Joshua Ulrich
On Mon, Feb 27, 2017 at 1:49 PM, John Klingensmith <johns...@gmail.com> wrote:
> Hi,
>  How do take a simple moving average of an indicator, like a 5 period SMA
> of a 3 period RSI?
>
Have you tried anything?

What's wrong with something straight-forward and simple like:

R> require(TTR)
Loading required package: TTR
R> data(ttrc)
R> RSI.SMA <- SMA(RSI(ttrc$Close, 3), 5)
R> tail(RSI.SMA)
[1] 56.32127 42.49744 38.26578 37.85953 39.58722 43.33587


> Best,
>  John
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Creating variable based on lags

2017-02-21 Thread Joshua Ulrich
On Wed, Feb 15, 2017 at 2:11 PM, Am Gut <agqua...@gmail.com> wrote:
> Good Afternoon Everyone,
>
> I have a series of returns are was hoping that someone could help me create
> a variable based on a pre-specified set of lagged observations. For
> example, I would want to sum up the last 25 returns to make a new return
> column. I would also like to weight the returns by a factor of 0.25^i with
> i being the lag number. I am intuitively thinking a for loop but can not
> rationalize internally how to write this. I am trying to make a variable
> like below:
>
> newreturn = return(-1)*0.25^1 + return(-2)*0.25^2 +  return(-25)*0.25^25
>
> And obviously I would like to apply this to all new observations past the
> 25th observatios to the end of my dataset. I hope this is clear as I know
> the solution must be relatively simple. I hope to hear from you guys.
>
If you have a set of weights you would like to apply, you can use
TTR::WMA.  It calculates a weighted moving average, and the
denominator in the average is the sum of the weights.  So if you just
want the sum, you can multiply the result by the sum of the weights.
Or you can use a for loop, like you thought.

# random data
set.seed(21)
x <- rnorm(10, 0, 0.01)
n <- 5
# pre-allocate result
y <- x * NA
# weight vector
w <- 0.25^(n:1)

# loop over input
for(i in n:length(x)) {
  y[i] <- sum(x[(i-n+1):i] * w)
}

# Use TTR's WMA function
z <- TTR::WMA(x, n, w) * sum(w)

# verify the results are the same
all.equal(y, z)


> Thanks,
>
> Am Gut
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Quantmod graphing issue

2017-02-14 Thread Joshua Ulrich
On Tue, Feb 14, 2017 at 8:58 AM, Jon Golenbock <jongolenb...@gmail.com> wrote:
> Hi, having an issue and I'm running into a wall. What I'm trying to do is
> set up some alerts given a list of products, terms, and rules. For example,
> look at the prompt 3 months for natural gas and crude, and if there is RSI
> divergence on any of those charts, graph them with the relevant technical
> indicators) and email them out (haven't written this part yet but it should
> be pretty simple I think).
>
> The issue I'm having might be a graphics issue (my suspicion) or I might be
> using a purrr function incorrectly, as I'm still figuring out how to best
> use it's mapping functions.
>
> Code below -- should be spitting out two graphs, but it only creates one
> and then throws the error "Error: is.list(res) is not TRUE". This
> particular (vanilla) example is looking to flag natgas pricing as it breaks
> bollinger bands.
>
> Worth noting, I am using the lmap() function instead of the map() function
> because I want the name passed as well. i.e if I pass df[[1]] to
> graph_send(), it will pass an unnamed dataframe. if i pass df[1], it passes
> a (named) list containing the dataframe, which I can still access using
> mylist[[1]].
>

I have trouble following your code, because my brain does not parse
"%>%" very well.  I've also never used purrr, so I can't help if
that's the issue.  If you truly suspect the issue is with purr, you
should ask your question on a more general forum, because purrr
doesn't really have anything to do with finance.

Based on your description, it seems like a simple for loop works fine:
for (n in names(df)) {
  d <- df[[n]]
  lastobs <- last(d)
  if (lastobs$cross_up || lastobs$cross_dn) {
x <- na.locf(xts(d$PRICE, d$COB_DT))
dev.new()  # open new plot device for each chart
candleChart(x, theme="white", name=n, TA="addBBands()")
  }
}

> [[alternative %>% version deleted]]

I would also note that creating OHLC data from close prices of the
same periodicity is not a good idea.  The day's open is usually not
the prior day's close.

> Any help is appreciated, thank you in advance!!
>
> library(TTR)
> library(dplyr)
> library(purrr)
> library(magrittr)
> library(quantmod)
>
> graph_send <- function(mylist){
>   #print(df %>% str())
>   df2 <- mylist[[1]] %<>% dplyr::select(COB_DT, PRICE,QUOTE_DEF_CD) %>%
> dplyr::rename (Date = COB_DT, Close = PRICE) %>%
> dplyr::mutate (Open = lag(Close))
>
>
>   df2$Open[1] <- df2$Close[1]
>   df2$High <- pmax(df2$Close, df2$Open)
>   df2$Low <- pmin(df2$Close, df2$Open)
>   #print(df2 %>% str())
>
>
>   df3 <- df2 %>% select(Date, Open, High, Low, Close)
>   ts <- xts(df3[,-1], df3[,1]) %>% zoo::na.locf()
>   #print(ts)
>
>
>
>   candleChart(ts, theme = "white", name = names(mylist))
>   plot(addBBands())
> }
>
> df <- structure(list(`Henry Hub xh19` = structure(list(COB_DT =



>   ))
> process_lgl <- df %>%  map_lgl( ~ .$cross_up[nrow(.)] == TRUE |
> .$cross_dn[nrow(.)] == TRUE)
> process_df <-  data.frame(Names = names(process_lgl), Process =
> process_lgl, row.names = NULL)
> process_df
> df[process_df$Process == TRUE] %>% lmap(graph_send)
>
> [[alternative HTML version deleted]]
>
Please follow the posting guide and send plain text. The list server
doesn't like HTML.

> ___
> R-SIG-Finance@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
R/Finance 2017 | www.rinfinance.com

___
R-SIG-Finance@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.


[R-SIG-Finance] R/Finance 2017: Call for Papers

2017-01-04 Thread Joshua Ulrich
Call for Papers:

R/Finance 2017: Applied Finance with R
May 19 and 20, 2017
University of Illinois at Chicago

The ninth annual R/Finance conference for applied finance using R will
be held on May 19 and 20, 2017 in Chicago, IL, USA at the University
of Illinois at Chicago.  The conference will cover topics including
portfolio management, time series analysis, advanced risk tools,
high-performance computing, market microstructure, and econometrics.
All will be discussed within the context of using R as a primary tool
for financial risk management, portfolio construction, and trading.

Over the past eight years, R/Finance has included attendees from
around the world.  It has featured presentations from prominent
academics and practitioners, and we anticipate another exciting
line-up for 2017.

We invite you to submit complete papers in pdf format for
consideration.  We will also consider one-page abstracts (in txt or
pdf format) although more complete papers are preferred.  We welcome
submissions for both full talks and abbreviated "lightning talks."
Both academic and practitioner proposals related to R are encouraged.

All slides will be made publicly available at conference time.
Presenters are strongly encouraged to provide working R code to
accompany the slides.  Data sets should also be made public for the
purposes of reproducibility (though we realize this may be limited due
to contracts with data vendors).  Preference may be given to
presenters who have released R packages.

Financial assistance for travel and accommodation may be available to
presenters, however requests must be made at the time of submission.
Assistance will be granted at the discretion of the conference
committee.

Please submit proposals online at http://go.uic.edu/rfinsubmit.

Submissions will be reviewed and accepted on a rolling basis with a
final deadline of February 28, 2017.  Submitters will be notified via
email by March 31, 2017 of acceptance, presentation length, and
financial assistance (if requested).

Additional details will be announced via the conference website

http://www.RinFinance.com/

as they become available.  Information on previous years' presenters
and their presentations are also at the conference website.  We will
make a separate announcement when registration opens.

For the program committee:
Gib Bassett, Peter Carl, Dirk Eddelbuettel, Brian Peterson, Dale
Rosenthal, Jeffrey Ryan, Joshua Ulrich


-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Properly making a xts object from csv file

2016-11-15 Thread Joshua Ulrich
Hi Colton,

On Tue, Nov 15, 2016 at 12:50 PM, Colton Smith <coltonsmith...@gmail.com> wrote:
> Hello,
>
> I'm currently wokring with a csv file that looks like this:
>
Pictures of data aren't particularly helpful.  Someone would have to
hand-enter those values to be able to do anything meaningful with the
data.

> I'm trying to make it an xts object so I can use it for backtesting. If I
> detach dplyr, errors happen on the stock() line and if I have dplyr attached
> errors happen initPortf()/initOrders().
>
Pictures of code are even less helpful than pictures of data.  No one
can copy/paste your picture into their R console to try and replicate
your results. ;)

> I'm aware of the frustrating interactions between dplyr and finance
> packages. I assume there is a proper way to go about this without using
> dplyr. If anybody could link me to an example or explain what I need to use,
> that'd be great!
>
Nothing in FinancialInstrument depends on dplyr, so there's no way
that *not* having dplyr attached could cause an issue with stock().
The problem is that you're passing an xts object as the 'primary_id',
when the documentation says:

primary_id: String describing the unique ID for the instrument. Most of
  the wrappers allow this to be a vector.

dplyr shouldn't cause issues with most package code, because most
packages should now protect themselves from the sort of badness in
dplyr (I'm looking at you, dplyr::lag).  But it will cause issues for
you at the top-level, because calling lag() on an xts object won't do
what you'd expect.

> Thanks,
> Colton Smith
>
> ___
> R-SIG-Finance@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
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] blotter updatePortf

2016-11-05 Thread Joshua Ulrich
On Sat, Nov 5, 2016 at 10:51 AM, Michael Chen <mwc4...@hotmail.com> wrote:
> I have found in running my own customized strategy using blotter and 
> updatePortf that whether I call updatePortf after completely applying my 
> strategy/transactions or call updatePortf at regular intervals like weekly or 
> monthly after each period's transactions, the performance statistics are the 
> same.  So, is there a reason that I should updatePortf regularly during a run 
> or just wait till the end?  I am puzzled.
>
Calling updatePortf marks your portfolio to market.  I assume (since
you didn't specify in your message) that your transaction sizing is
invariant to portfolio equity.  In that case, you should not expect
calling updatePortf to change strategy performance.

In short, if your strategy doesn't depend on your portfolio market
value, there's no need to call updatePortf until the end of the
simulation.

> Thanks,
>
> Michael
>
> ___
> R-SIG-Finance@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
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] PortfolioAttribution

2016-10-28 Thread Joshua Ulrich
On Fri, Oct 28, 2016 at 12:45 PM, Daniel Cegiełka
<daniel.cegie...@gmail.com> wrote:
> 2016-10-28 16:04 GMT+02:00 fceci via R-SIG-Finance
> <r-sig-finance@r-project.org>:
>>
>> Hi everybody,
>> first of all thanks for making the Rmetrics suite available to all. I really 
>> find these libraries very useful.
>> I have an issue installing the PortfolioAttribution package. The usual 
>> command  
>> install.packages("PortfolioAttribution",repos="http://R-Forge.R-project.org;)
>>  does not work and indeed the link to the tar.gz 
>> file:http://download.r-forge.r-project.org/src/contrib/PortfolioAttribution_0.3.tar.gz
>> returns a 404 error.
>> Is this package still available somewhere?

The package is still available on R-Forge.  For some reason, R-Forge
is not providing the tar.gz file produced by R CMD build, but the
source is available.  You can install from source yourself by
following the instructions in this StackOverflow Q+A:
http://stackoverflow.com/q/11105131/271616

>> Thanks! Frank
>>
>
> Hi Frank,
>
> https://github.com/R-Finance/PortfolioAttribution
>
This is a read-only mirror.  R-Forge is still the authoritative
repository for this package.  Regardless, GitHub does not provide the
tar.gz files produced by R CMD build that Frank is asking for.

> Best regards,
> Daniel
>
> ___
> R-SIG-Finance@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
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.

Re: [R-SIG-Finance] Multi Asset portfolio failing at applyStrategy with 'data' must be of a vector type, was 'NULL'

2016-08-09 Thread Joshua Ulrich
.UTF-8
 [7] LC_PAPER=en_US.UTF-8   LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] quantstrat_0.9.1739   foreach_1.4.2
[3] blotter_0.10.2PerformanceAnalytics_1.4.3541
[5] FinancialInstrument_1.2.0 quantmod_0.4-5
[7] TTR_0.23-1xts_0.10-0
[9] zoo_1.7-13

loaded via a namespace (and not attached):
[1] codetools_0.2-14 grid_3.3.1   iterators_1.0.7  boot_1.3-18
[5] lattice_0.20-33

>
> On Mon, Aug 8, 2016 at 4:58 PM, Joshua Ulrich <josh.m.ulr...@gmail.com>
> wrote:
>>
>> On Mon, Aug 8, 2016 at 7:48 AM, golam sakline <golam.sakl...@gmail.com>
>> wrote:
>> > Hi All,
>> >
>> > I have an error at applyStrategy that is failing with "Error in array(x,
>> > c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 'data' must
>> > be
>> > of a vector type, was 'NULL'" .
>> > I believe the problem is occurring at add.indicator function "RT" that
>> > takes in OHLC(mktdata) data and outputs an univariate series.
>> > This error doesn't occur when I replace RT with MACD function that takes
>> > in
>> > Cl(mktdata) rather than OHLC.
>> > This error doesn't occur when I am using RT function with a single asset
>> > in
>> > the symbol i.e. the length(symbol) = 1.
>> >
>> > What am I doing wrong or missing here?
>> >
>> It is nearly impossible for anyone to help you because your example
>> uses data (CSVs on your local hard drive) and functions (in
>> functions.R) that no one else has access to.  And you suspect the
>> error is related to one of those functions...
>>
>> > Thanks in advance. Much appreciated.
>> >
>> > G
>> >
>> >
>> > ##
>> > rm(list = ls(all = TRUE))
>> > setwd("/Users/mm/Documents/R")
>> > library(lattice)
>> > library(timeSeries)
>> > library(timeDate)
>> > library(PerformanceAnalytics)
>> > library(quantmod)
>> > library(xts)
>> > library(blotter)
>> > library(TTR)
>> > library(quantstrat)
>> > library(FinancialInstrument)
>> > source("functions.R")
>> >
>> > setwd("/Users/mm/Documents/R/UAE")
>> > options("getSymbols.warning4.0" = FALSE)
>> > #sessionInfo()
>> >
>> > startDate = "2015-07-01"
>> > symbols <- c("DFMC", "ARTC", "EMAARMALLS", "DUBAIPARKS")
>> > Sys.setenv(TZ="UTC")
>> >
>> > getSymbols("DFM", src="csv",
>> > col.names=c("Open","High","Low","Close","Volume"))
>> > getSymbols(symbols, src="csv",
>> > col.names=c("Open","High","Low","Close","Volume"))
>> >
>> >
>> > initDate <- "2015-07-01"
>> > initEq <- 10
>> > tradeSize <- initEq/length(symbols)
>> > currency("USD")
>> > stock(symbols, currency="USD",multiplier=1)
>> >
>> > myTheme<-chart_theme()
>> > myTheme$col$dn.col<- 'lightblue'
>> > myTheme$col$dn.border <-  'lightgray'
>> > myTheme$col$up.border <-  'lightgray'
>> >
>> >
>> > par(mfrow=c(2,2))
>> > for(symbol in symbols)
>> > {
>> >   plot(chart_Series(get(symbol),name=symbol))
>> > }
>> > par(mfrow=c(1,1))
>> >
>> >
>> > if(exists('.strategy')) rm.strat(qs.strategy)
>> > if(!exists('.blotter')) .blotter <- new.env()
>> > if(!exists('.strategy')) .strategy <- new.env()
>> >
>> > qs.strategy <- "AD26"
>> > initPortf(qs.strategy, symbols, initDate=initDate)
>> > initAcct(qs.strategy,portfolios=qs.strategy, initDate=initDate,
>> > initEq=initEq)
>> > initOrders(portfolio=qs.strategy,initDate=initDate)
>> > strategy(qs.strategy,store=TRUE)
>> >
>> > add.indicator("AD26", name = "RT",
>> >   arguments = list(x=quote(OHLC(mktdata))),label= "RT")
>> >
>> > summary(getStrategy(qs.strategy))
>> >
>> >
>> > #

Re: [R-SIG-Finance] Multi Asset portfolio failing at applyStrategy with 'data' must be of a vector type, was 'NULL'

2016-08-08 Thread Joshua Ulrich
TxnFees=-5,
>   orderset = "ocolong"
>  ),
>  type='exit',
>  label = "LX"
> )
>
> add.rule(qs.strategy, name='ruleSignal',
>  arguments = list(sigcol="Buy", sigval=TRUE,
>   replace =FALSE,
>   orderqty="all",
>   ordertype='stoplimit',
>   orderside='long',
>   tmult = TRUE,
>   threshold = quote(stopLossPercent),
>   TxnFees=-5,
>   orderset = "ocolong"
>  ),
>  type='chain',
>  parent = "LE",
>  label = "StopLossLong",
>  enabled = FALSE
> )
>
> summary(getStrategy(qs.strategy))
>
> #enable.rule(qs.strategy, type="chain", label ="StopLoss")
>
> applyStrategy(strategy=qs.strategy , portfolios=qs.strategy, verbose=TRUE)
>
> updatePortf(qs.strategy)
> updateAcct(qs.strategy)
> updateEndEq(qs.strategy)
>
> checkBlotterUpdate("AD26", "AD26")
>
> ##
>
> OUTPUT:
>

>> applyStrategy(strategy=qs.strategy , portfolios=qs.strategy, verbose=TRUE)
> *Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),
>  : *
> *  'data' must be of a vector type, was 'NULL'*
> *In addition: Warning messages:*
> *1: In min(j, na.rm = TRUE) :*
> *  no non-missing arguments to min; returning Inf*
> *2: In max(j, na.rm = TRUE) :*
> *  no non-missing arguments to max; returning -Inf*
> *Called from: array(x, c(length(x), 1L), if (!is.null(names(x)))
> list(names(x), *
> *NULL) else NULL)*
> Browse[1]>
>> updatePortf(qs.strategy)
> [1] "AD26"
>> updateAcct(qs.strategy)
> [1] "AD26"
>> updateEndEq(qs.strategy)
> [1] "AD26"
>>
>> checkBlotterUpdate("AD26", "AD26")
> [1] TRUE
>>
>> sessionInfo()
> R version 3.2.4 (2016-03-10)
> Platform: x86_64-apple-darwin13.4.0 (64-bit)
> Running under: OS X 10.11.6 (El Capitan)
>
> locale:
> [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
>
> other attached packages:
>  [1] quantstrat_0.9.1739   foreach_1.4.3
> blotter_0.9.1741
>  [4] FinancialInstrument_1.2.0 quantmod_0.4-5TTR_0.23-1
>
>  [7] PerformanceAnalytics_1.4.3541 xts_0.9-7 zoo_1.7-13
>
> [10] timeSeries_3022.101.2 timeDate_3012.100
> lattice_0.20-33
>
> loaded via a namespace (and not attached):
> [1] rsconnect_0.4.2.2 tools_3.2.4   codetools_0.2-14  grid_3.2.4
>  iterators_1.0.8
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] apply.paramset.signal.analysis error

2016-08-02 Thread Joshua Ulrich
Pos"
> , symbol = "SPY"
>  )
>  , type = "enter"
> )
>
>
> add.rule(strategy = maStrategy
>  , name = "ruleSignal"
>  , arguments = list(sigcol = "SPY.lte.ma"
> , sigval = TRUE
> , orderqty = "all"
> , ordertype = "market"
> , orderside = NULL
> , osFUN = "osMaxPos"
> , symbol = "SPY"
>  )
>  , type = "exit"
> )
>
>
> applyStrategy(strategy = maStrategy
>   , portfolios = maStrategy
> )
>
> updatePortf(maStrategy)
> updateAcct(maStrategy)
> updateEndEq(maStrategy)
>
>
> maLag <- seq(5,10,1)
> 
> #delete.paramset(maStrategy,"maLagDist")
> add.distribution(strategy = maStrategy
>  , paramset.label = "maLagDist"
>  , component.type = "indicator"
>  , component.label = "SPYma"
>  , variable = list(n = maLag)
>  , label = "lagDist"
>
> )
>
>
>
> library(foreach)
> library(doParallel)
> cl <- makeForkCluster(nnodes = detectCores())
> registerDoParallel(cl)
> maStrategyAP <-
>   apply.paramset(strategy.st = maStrategy
>  , paramset.label = "maLagDist"
>  , portfolio.st = maStrategy
>  , account.st = maStrategy
>   )
> stopCluster(cl = cl)
> cl <- NULL
> closeAllConnections()
> gc()
>
>
> #this works
> maStrategyAP$tradeStats$Profit.To.Max.Draw
>
>
> head(mktdata)
>
> #undebug(apply.paramset.signal.analysis)
> maStrategyAPSA <-
>   apply.paramset.signal.analysis(strategy.st = maStrategy
>  , paramset.label = "maLagDist"
>  , portfolio.st = maStrategy
>  , sigcol = "SPY.gt.ma"
>  , sigval = 1
>  , on = NULL
>  , forward.days = 5
>  , include.day.of.signal = TRUE
>   )
>
>
> ##
>
>
>
> Erol Biceroglu
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Option pricing, basic question

2016-06-16 Thread Joshua Ulrich
On Thu, Jun 16, 2016 at 9:45 AM, thp <t...@2pimail.com> wrote:
> Hello Frank / all,
>
> the getSymbols() code written down before in relation to my option pricing
> question (see citation below)
> somehow did not work with me. I got
>
> library(quantmod)
>
>
> Version 0.4-0 included new data defaults. See ?getSymbols.
> Warning messages:
> 1: package .quantmod. was built under R version 2.14.2
> 2: package .Defaults. was built under R version 2.14.2
>
>
> getSymbols('DGS3MO', verbose=TRUE,src='FRED')
>
>
> As of 0.4-0, .getSymbols. uses env=parent.frame() and
>  auto.assign=TRUE by default.
>
>   ...
>
> trying URL
> 'http://research.stlouisfed.org/fred2/series/DGS3MO/downloaddata/DGS3MO.csv'
> Error in download.file(paste(FRED.URL, "/", Symbols[[i]], "/",
> "downloaddata/",  :
>   cannot open URL
> 'http://research.stlouisfed.org/fred2/series/DGS3MO/downloaddata/DGS3MO.csv'
>
>
> This is even though I could download the data at the specified url manually.
>
This has been fixed for almost a year.  You need to upgrade.
https://github.com/joshuaulrich/quantmod/issues/56

> ~Tom
>
> On 2016-06-09 15:42, Frank wrote:
>>
>> I use the 3-month constant maturity Treasury bill rate from FRED (Federal
>> Reserve Economic ??Database??) for the risk-free rate. For options with
>> substantially more than 3 months until expiration, I think it makes sense
>> to
>> use a maturity that best matches the option. The R code I use is:
>>
>> library(quantmod)
>> library(chron)
>>
>>
>> ##
>> ## Get DGS3MO Treasury yield from FRED
>> ##
>>
>> getSymbols('DGS3MO',src='FRED')
>> DGS3MO<-na.locf(DGS3MO/100.0,na.rm = TRUE)
>> tail(DGS3MO)
>> file_name <- "DGS3MO.csv"
>> write.zoo(DGS3MO, file = file_name, append = FALSE, quote = TRUE, sep =
>> ",")
>> quit()
>>
>> I run this text from a batch file in Windows 7 Pro 64-bit. The text in the
>> batch file is:
>>
>> REM on Microsoft Windows (adjust the path to R.exe as needed)
>> DEL *DGS3MO.csv
>>
>> "C:\Program Files\R\R-3.2.2\bin\x64\R.exe" CMD BATCH
>> "C:\Users\Frank\Documents\R\Projects\DGS3MO\DGS3MO.txt"
>> "C:\Users\Frank\Documents\R\Projects\DGS3MO\DGS3MO.out"
>> COPY DGS3MO.BAT DGS3MO.BAK
>> COPY DGS3MO.TXT DGS3MO.TXT.BAK
>> REM PAUSE
>> ...
>
>
> ___
> R-SIG-Finance@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
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Position Limits

2016-05-29 Thread Joshua Ulrich
On Fri, May 27, 2016 at 3:48 PM, John Klingensmith <johns...@gmail.com> wrote:
> Hi,
>  I am relatively new to R and QuantStrat, etc. I am playing with a real
> simple strategy that goes long when the market closes at its lowest close
> in 3 days and reverses the position when the market closes at its highest
> close in 3 day.  I am trying to limit the position size to 1 lot in either
> direction by using osMaxPos and addPosLimit, but for whatever reason the
> position limits are not getting imposed. I also read the "Long Enter
> Position do not "block" Short Enter Orders" question and tried making a
> custom function.
>
> My questions are as follows:

>
> 4) I am using S index data; although you cannot actually trade the index,
> it is a good proxy for what I am trying to test. When I download the index
> data (symbol ^GSPC) the symbol stored is "GSPC" without the carrot;
> therefore, I cannot simply use "symbols <- "^GSPC" and reference "symbols"
> in my code as I would normally if it were an ETF. Can someone explain why
> this is?
>
Because syntactic names must start with a letter, or a period not
followed by a digit.  See the "Names and Identifiers" section of
?Quotes.

> Thanks for any help.
> Best,
>  John
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Passing two distributions to one parameter

2016-05-29 Thread Joshua Ulrich
rqty= fixedSizeShort,   
> ordertype='market',  orderside='short',   
>orderset='ocoshort',  TxnFees = 
> txn.model), type='enter', label='shortenter', 
> enabled=TRUE)
> # Short Exit 
> Rule-add.rule(strategy.st,
>  name='ruleSignal', arguments = list(sigcol="sar.gt.close",   
>sigval=TRUE,  prefer="Open",   
> orderqty='all',  
> ordertype='market',  orderside='short',   
>orderset='ocoshort',  TxnFees = 
> txn.model), type='exit', label='shortexit', 
> enabled=TRUE)
>
>
>
> #SAR 
> Optimization-#add.distribution(strategy.st,
>  #paramset.label = paramset.label.name,  #   
> component.type = 'indicator',   #  component.label = 'sar',   
># variable = list( accel = accels.df), 
> #label = "sar.accels")
>
>
> #add.distribution(strategy.st,# paramset.label = 
> paramset.label.name,# component.type = 'indicator',#  
>component.label = 'sar',  # 
> variable = list( accel[1] = accel.factor),# label = 
> "sar.accels.factor")
>
> #add.distribution(strategy.st,# paramset.label = 
> paramset.label.name,# component.type = 'indicator',#  
>component.label = 'sar',  # 
> variable = list( accel[2] = max.accel.factor),# label 
> = "sar.accels.max")
>
> #add.distribution(strategy.st,# paramset.label = 
> paramset.label.name,# component.type = 'indicator',#  
>component.label = 'sar',  # 
> variable = list( accel = accel.factor,max.accel.factor),# 
> label = "sar.accels.2")
>
>
>
> summary(getStrategy(strategy.st))
> paramsetenv<-new.env()results <- 
> apply.paramset(strategy.st,paramset.label=paramset.label.name,
>   portfolio=strategy.st, account=strategy.st,nsamples=0,verbose = 
> TRUE,  audit=paramsetenv)
> results.df <- data.frame(results$tradeStats)
>
> 
> Atakan Okan
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Fwd: dataset to xts conversion issue with timeseries data

2016-05-13 Thread Joshua Ulrich
security (assume).
>>>
>>> Now this data is coming in standard dataset format to R from data
>>> server. When I try to convert it to XTS it becomes like below
>>>
>>> askValueaskSize stockName   askType 01/02/2016
>>> 9:15 " 91.80"" 500"  "ABCD IS Equity" "Ask"
>>> 01/02/2016 9:15 "474.45"" 300"  "EFGH IS Equity"
>>> "Ask" 01/02/2016 9:15 "455.00"" 100"  "XYZW IS
>>> Equity" "Ask" 01/02/2016 9:15 "101.50"" 2799"
>>> "MNP IS Equity" "Ask" 01/02/2016 9:15 "194.95""
>>> 1600" "IJK IS Equity" "Ask" 01/02/2016 9:15
>>> "293.45"" 13"   "PQRS IS Equity" "Ask"
>>>
>>> You can see the the column name "times" is becoming here index.
>>> And
> that's
>>> why after data conversion to xts object I am not able to match my
>>> quote data which are bid dataset and ask dataset.
>>>
>>> Can anyone please suggest on this data set to xts conversion.
>>>
>>> PS: When I am downloading data in excel and then transforming data
>>> from excel to xts then it is working fine.
>>>
>>> DateTypePrice   Size 1   01/03/2016 9:15 ASK
>>> 538.9   50 2   01/03/2016 9:15 ASK 538.8   75 3
>>> 01/03/2016 9:15 ASK 538.7   50 4   01/03/2016 9:15
>>> ASK 538.3   75 5   01/03/2016 9:15 ASK 538.85
>>> 798 6   01/03/2016 9:15 ASK 538.9   93
>>>
>>> But as I am trying to run for multiple stocks data download script
>>> at
> same
>>> time and it is high-frequency data, so I am using R script to
> download data
>>> from server to R directly skipping excel using Rblpapi package.
>>>
>>> -- Thanks, Aritra
>>>
> --
> Brian G. Peterson
> http://braverock.com/brian/
> Ph: 773-459-4973
> IM: bgpbraverock
>
> ___
> R-SIG-Finance@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.
>
> ___
> R-SIG-Finance@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
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] R/Finance 2016 registration now open

2016-05-02 Thread Joshua Ulrich
A friendly reminder that early registration ends this Friday, May 6,
2016.  Registration fees will increase by 50% after Friday.


On Mon, Apr 11, 2016 at 8:23 AM, Joshua Ulrich <josh.m.ulr...@gmail.com> wrote:
> Registration for R/Finance 2016 is now open!
>
> The conference will take place on May 20 and 21, at UIC in Chicago.
> Building on the success of the previous conferences in 2009-2015, we
> expect more than 250 attendees from around the world. R users from
> industry, academia, and government will joining 50 presenters covering
> all areas of finance with R.
>
> We are very excited about the four keynote presentations given by
> Patrick Burns, Frank Diebold, Tarek Eldin, and Rishi Narang.  The
> conference agenda (currently) includes 17 full presentations and 33
> shorter "lightning talks".  As in previous years, several (optional)
> pre-conference seminars are offered on Friday morning.
>
> There is also an (optional) conference dinner at The Riverside Room
> and Gallery at Trump.  Situated directly on the hotel's new River
> Walk, it is a perfect venue to continue conversations while dining and
> drinking.
>
> As they are finalized, agenda details are available at:
>   http://www.RinFinance.com/agenda/
>
> Registration information is available at:
>   http://www.RinFinance.com/register/
>
> and can also be directly accessed by going to:
>   http://go.uic.edu/rfinance
>
> Please note that registration fees will increase by 50% at the end of
> early registration on May 6, 2016.
>
> We would to thank our 2016 Sponsors for the continued support enabling us
> to host such an exciting conference:
>
>   UIC Liautaud Master of Science in Finance
>
>   Microsoft
>   MS-Computational Finance and Risk Management at University of Washington
>
>   Charles Schwab
>   Hull Investments
>   Interactive Brokers
>   OneMarketData
>   RStudio
>
> On behalf of the committee and sponsors, we look forward to seeing you
> in Chicago!
>
>   Gib Bassett, Peter Carl, Dirk Eddelbuettel, Brian Peterson, Dale
> Rosenthal, Jeffrey Ryan, Joshua Ulrich
>
>
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com
> R/Finance 2016 | www.rinfinance.com



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Custom Txnfee function in apply.paramset vs applyStrategy

2016-04-25 Thread Joshua Ulrich
The problem is that you're sending HTML, which the posting guide tells
you not to do:
https://www.r-project.org/posting-guide.html
See also the first paragraph in the "General Instructions" section at
the bottom of:
https://www.r-project.org/mail.html

On Mon, Apr 25, 2016 at 10:43 AM, Atakan Okan <atakano...@outlook.com> wrote:
> So the code seems a bit odd, the indentation must have somehow caused some 
> problems when emailing.
> This a better and a little bit more compact one:

> From: atakano...@outlook.com
> To: r-sig-finance@r-project.org
> Subject: Custom Txnfee function in apply.paramset vs applyStrategy
> Date: Sun, 24 Apr 2016 21:36:33 +0300
>
>
>
>
> Hi,
> I have been experimenting with different custom transaction fee models for 
> different assets and I realized that apply.paramset and applyStrategy yields 
> different results when a custom transaction fee function is used.
> The reproducible example is below, and even though apply.paramset yields a 
> NetPnL result of 21779 with the custom transaction fee model, applyStrategy 
> yields 21509, which makes me believe that apply.paramset somehow is not 
> incorporating the fees. The comparison of NetPnL results were made with the 
> parameter combination of FastSMA=5, SlowSMA=50 and Stoploss=0.005.
> Any help is appreciated, thanks.
> Atakan Okan
> Code:

> [[alternative HTML version deleted]]
>
^^^ There's your problem.

> ___
> R-SIG-Finance@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
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] adjustOHLC.R issues

2016-04-12 Thread Joshua Ulrich
On Mon, Apr 11, 2016 at 8:48 PM, Ernie Stokely <wizardc...@gmail.com> wrote:
> OK, I am prepared for the stones that will be thrown at me for being naive,
> but here goes anyway.
>
> Most of the references on adjusting OHLC values for splits and dividends say
> to use the following adjustment:
>
> K = Ca/C
> Om = K * O
> Hm = K * H
> Lm = K * L
> Cm = K * C = Ca
>
> where: Ca = adjusted close, OHLC are the unadjusted values, and OmHmLmCm are
> the modified (adjusted) values of OHLC.
>
The adjusted close from Yahoo used to only have 2 decimal places, so
what you describe would have been subject to massive loss of accuracy
when there were many adjustments.  That's the entire reason I wrote
TTR::adjRatios and why quantmod::adjustOHLC exists.

That said, they provide more decimal places now, and adjustOHLC
provides a use.Adjusted argument, so you could have used the
adjustments you describe above by calling: adjustOHLC(VTI,
use.Adjusted=TRUE).

> If I use adjustOHLC() in quantmod to do the adjustment I find these are not
> the equations being used. For example, for VTI here is the unadjusted
> OHLCadjC data read from Yahoo:
>
> VTI.Open VTI.High VTI.Low VTI.Close VTI.Volume VTI.Adjusted
> 2006-03-01 128.15 128.90 127.79 128.70 216400 52.56795
> 2006-03-02 128.50 128.76 128.01 128.61 148800 52.53119
> 2006-03-03 128.26 129.43 128.20 128.40 323200 52.44541
> 2006-03-06 128.64 128.64 127.27 127.46 279800 52.06147
> 2006-03-07 127.15 127.31 126.65 126.94 218400 51.84907
> 2006-03-08 126.72 127.49 126.20 127.30 491800 51.99612
>
> If I apply adjustOHLC() to these data I get:
>
> VTI.Open VTI.High VTI.Low VTI.Close VTI.Volume VTI.Adjusted
> 2006-03-01 59.15007 59.49625 58.98391 59.40394 216400 52.56795
> 2006-03-02 59.31162 59.43163 59.08545 59.36240 148800 52.53119
> 2006-03-03 59.20084 59.74088 59.17315 59.26546 323200 52.44541
> 2006-03-06 59.37624 59.37624 58.74389 58.83159 279800 52.06147
> 2006-03-07 58.68851 58.76235 58.45772 58.59158 218400 51.84907
> 2006-03-08 58.49003 58.84544 58.25001 58.75774 491800 51.99612
>
Works fine for me using the latest quantmod and TTR on CRAN:

R> getSymbols("VTI", from="2006-03-01")
[1] "VTI"
R> first(VTI)
   VTI.Open VTI.High VTI.Low VTI.Close VTI.Volume VTI.Adjusted
2006-03-01   128.15128.9  127.79 128.7 216400 52.56795
R> first(adjustOHLC(VTI))
   VTI.Open VTI.High  VTI.Low VTI.Close VTI.Volume VTI.Adjusted
2006-03-01  52.3433 52.64964 52.19626  52.56795 216400 52.56795

Perhaps you're using an older version of one/both packages?

> Obviously, VTI.Adjusted (Ca) is not equal to VTI.Close (Cm) as required by
> the formula above. I have a colleague who has been trading for 40 years and
> he says this is an erroneous result (that Cm must equal Ca). When I explore
> the package reference file for adjustOHLC() I see this paragraph:
>
> "New columns are derived by taking the ratio of adjusted value to original
> Close, and multiplying by the difference of the respective column and the
> original Close. This is then added to the modified Close column to arrive at
> the remaining ‘adjusted’ Open, High, Low column values."
>
> I am not quite sure how to translate this verbal description into an
> equation, but it doesn't sound like the same correction I see recommended
> elsewhere and described at the beginning of this note.
>
> Can someone shed some light on this discrepancy or send me a link to more
> enlightenment? Thanks in advance.
>
Yahoo describes their adjusted close column here:
https://help.yahoo.com/kb/finance/SLN2311.html

> Ernie
>
> ___
> R-SIG-Finance@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
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.

Re: [R-SIG-Finance] [VC++ calling R] How to create a real-time interactive ticking time-series chart using dygraph via RInside?

2016-04-11 Thread Joshua Ulrich
Please choose *one* _relevant_ mailing list.  Spamming 5 (!)
mailing lists fragments the conversation and makes things difficult
for everyone involved.

On Mon, Apr 11, 2016 at 10:03 AM, Mike Deanza <mikedea...@outlook.com> wrote:
> Hi all,
>
>
> I am trying to figure out how to do this in R and I need your help.
>
>
> My journey started from something like the following:
>
>
> http://stackoverflow.com/questions/11365857/real-time-auto-updating-incremental-plot-in-r/1#1
>
>
> n=1000
> df=data.frame(time=1:n,y=runif(n))
> window=100
> for(i in 1:(n©\window)) {
> flush.console()
> plot(df$time,df$y,type='l',xlim=c(i,i+window))
> Sys.sleep(.09)
> }
>
>
> Then I wanted to make it nicer looking so I went to dygraph.
>
>
> And then, I would like to be able to live send tick data from within Visual 
> C++ so I started to investigate RInside.
>
>
> Following the example code here:
>
>
> http://dirk.eddelbuettel.com/papers/useR2009RcppRInside.pdf
>
>
> I can open an RInside object in VC++, and then send some data to it, and then 
> execute some command in it, and then get data back.
>
>
> It is really great.
>
>
> However, is there a way to have the real-time updating ticking plots to be 
> drawn on dygraph inside RInside?
>
>
> It turns out the dygraph package tends to draw onto a browser. That makes the 
> real-time updating pretty slow.
>
>
> Is there a way to set the dygraph to plot to a GUI window in VC++? For 
> example, a QT or MFC GUI window?
>
>
> My working environment is Win7 64bit ,with VS 2013 and VS2015, QT 5.3 32bit.
>
>
> Could anybody please shed some lights on me?
>
>
> Thanks a lot!
>
>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
>
> ___
> R-SIG-Finance@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
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.

[R-SIG-Finance] R/Finance 2016 registration now open

2016-04-11 Thread Joshua Ulrich
Registration for R/Finance 2016 is now open!

The conference will take place on May 20 and 21, at UIC in Chicago.
Building on the success of the previous conferences in 2009-2015, we
expect more than 250 attendees from around the world. R users from
industry, academia, and government will joining 50 presenters covering
all areas of finance with R.

We are very excited about the four keynote presentations given by
Patrick Burns, Frank Diebold, Tarek Eldin, and Rishi Narang.  The
conference agenda (currently) includes 17 full presentations and 33
shorter "lightning talks".  As in previous years, several (optional)
pre-conference seminars are offered on Friday morning.

There is also an (optional) conference dinner at The Riverside Room
and Gallery at Trump.  Situated directly on the hotel's new River
Walk, it is a perfect venue to continue conversations while dining and
drinking.

As they are finalized, agenda details are available at:
  http://www.RinFinance.com/agenda/

Registration information is available at:
  http://www.RinFinance.com/register/

and can also be directly accessed by going to:
  http://go.uic.edu/rfinance

Please note that registration fees will increase by 50% at the end of
early registration on May 6, 2016.

We would to thank our 2016 Sponsors for the continued support enabling us
to host such an exciting conference:

  UIC Liautaud Master of Science in Finance

  Microsoft
  MS-Computational Finance and Risk Management at University of Washington

  Charles Schwab
  Hull Investments
  Interactive Brokers
  OneMarketData
  RStudio

On behalf of the committee and sponsors, we look forward to seeing you
in Chicago!

  Gib Bassett, Peter Carl, Dirk Eddelbuettel, Brian Peterson, Dale
Rosenthal, Jeffrey Ryan, Joshua Ulrich


-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Help on getSymbols

2016-04-09 Thread Joshua Ulrich
On Sat, Apr 9, 2016 at 7:39 AM, Dan Mack <dmac...@verizon.net> wrote:
> Josh,   I have been using the get symbols to bull data from Yahoo via the 
> following code and generally works well.
>
> FromDate = "2002-05-24"
> ToDate = "2016-03-17"
>
>
> userInput=c("SHW","ABC","LEN","PCLN","HAR","ETN","RRC","PNR","MO","MAT","SNDK","EW","SPLS","AGN","F","MMM",
>
> "SWK","EA","KSU","MLM","FCX","XRAY","BDX","DOW","LUK","PHM","TMO","DHI","COH","HOT","STZ","LOW","ADS”,
>
> "SWN","REGN","CSC","VFC","CI","HPQ","CA","TE","PWR","RF","BAX")
> for (i in userInput)
> {
>   getSymbols(Symbols=userInput, src="yahoo", from = FromDate, to = ToDate, 
> auto.assign=TRUE, return.class="data.frame")
> }
>
You're downloading all symbols in each iteration of your for loop.
Either set Symbols=userInput and forgo the for loop, or keep the for
loop and set Symbols=i.

> My issue is that many times it takes a really long time to complete,  like 
> upwards to 20-30 minutes.  Sometimes the process terminate with an error 
> message.   I am trying to replicate it, but no luck right now it is just 
> running.  The error indicated something about a header being off.
>
> I have a hunch that something is not recognizing the download has completed 
> and can’t terminate the call.
>
> I do notice that when I manually stop the get symbols  call after a short 
> time ( 1-2 minutes) all of my data I asked for will be in the global 
> environment.
>
> This is preventing some automation I would like to do for my models.
>
> Do you have any suggestion on what could be causing this or any solutions?
>
> Thanks  Dan



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.

Re: [R-SIG-Finance] Processing time of backtests on a single computer

2016-04-07 Thread Joshua Ulrich
On Thu, Apr 7, 2016 at 11:30 AM, Jersey Fanatic
<jerseyfanat...@gmail.com> wrote:
> Thanks for the insight. I did not know variations in processing time of 20
> minutes or so could happen between different parameter combinations.
>
> I ran the strategy with the same dataset with random parameters without
> Trailing SL, on single core and it took 5.15 minutes. The number of
> transactions were 7800. The amount of processing time seems too much
> compared to yours though. 5sec data of 3 years vs M5 data of just 1 year; 20
> min vs 5 mins.
>
Again, the number of observations is not a good predictor of the
amount of time it will take.  You have 7800 transactions.  My shortest
(longest) run had 25 (1500) transactions.

Seems reasonable to me that a strategy producing nearly 8000
transactions takes about 5 minutes; that's about 25 transactions a
second.

> 2016-04-07 16:32 GMT+03:00 Joshua Ulrich <josh.m.ulr...@gmail.com>:
>>
>> On Thu, Apr 7, 2016 at 8:10 AM, Jersey Fanatic <jerseyfanat...@gmail.com>
>> wrote:
>> > 10 years of daily data makes about 2500 data points. So extrapolating
>> > from
>> > that to 58000 data points (assuming the relation is linear), it should
>> > take
>>
>> Number of data points is not necessarily a good estimator for run time
>> even if the strategies are the same.  What matters more is the number
>> of timestamps/observations that must be evaluated.  That includes
>> signals, moving orders, processing fills, etc.
>>
>> > about 12.2 secs for a single run with my dataset. For 144 runs (total
>> > number of parameter combinations), it should take about 30 mins.
>> > However, I
>>
>> Again, the relationship is not linear.  Different parameter
>> combinations will produce differing amounts of signals, order
>> movement, fills, etc.
>>
>> For example, I ran parameter optimization on ~3 years of 5-second
>> data.  Some parameter combinations took 1-2 minutes, some took >20
>> minutes.
>>
>> > ran apply.paramset() this morning (without trailing stops), it took 4.5
>> > hours. And the code is the one that I sent earlier with Trailing stop
>> > rules
>> > enabled=FALSE'd.
>> >
>> > Did you run the macd demo code with single core? If you did some
>> > parallel
>> > processing, did you use doSNOW package or something else? Maybe that is
>> > the
>> > reason, I am not sure.
>> >
>> > Would deleting trailing stop rules speed things up, instead of defining
>> > them but setting enabled=FALSE?
>> >
>> > 2016-04-07 0:34 GMT+03:00 Brian G. Peterson <br...@braverock.com>:
>> >
>> >> On Wed, 2016-04-06 at 23:58 +0300, Jersey Fanatic wrote:
>> >> > I will try running the same code without trailing stops and see what
>> >> > effect
>> >> > it has on the processing time. I will report back as soon as it is
>> >> > finished.
>> >>
>> >> Running the macd demo code over 10 years of daily data on my machine
>> >> (no
>> >> trailing stops) takes 0.5262365 secs for a single run.
>> >>
>> >>
>> >>
>> >
>> > [[alternative HTML version deleted]]
>> >
>> > ___
>> > R-SIG-Finance@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
>> R/Finance 2016 | www.rinfinance.com
>
>



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Processing time of backtests on a single computer

2016-04-07 Thread Joshua Ulrich
On Thu, Apr 7, 2016 at 8:10 AM, Jersey Fanatic <jerseyfanat...@gmail.com> wrote:
> 10 years of daily data makes about 2500 data points. So extrapolating from
> that to 58000 data points (assuming the relation is linear), it should take

Number of data points is not necessarily a good estimator for run time
even if the strategies are the same.  What matters more is the number
of timestamps/observations that must be evaluated.  That includes
signals, moving orders, processing fills, etc.

> about 12.2 secs for a single run with my dataset. For 144 runs (total
> number of parameter combinations), it should take about 30 mins. However, I

Again, the relationship is not linear.  Different parameter
combinations will produce differing amounts of signals, order
movement, fills, etc.

For example, I ran parameter optimization on ~3 years of 5-second
data.  Some parameter combinations took 1-2 minutes, some took >20
minutes.

> ran apply.paramset() this morning (without trailing stops), it took 4.5
> hours. And the code is the one that I sent earlier with Trailing stop rules
> enabled=FALSE'd.
>
> Did you run the macd demo code with single core? If you did some parallel
> processing, did you use doSNOW package or something else? Maybe that is the
> reason, I am not sure.
>
> Would deleting trailing stop rules speed things up, instead of defining
> them but setting enabled=FALSE?
>
> 2016-04-07 0:34 GMT+03:00 Brian G. Peterson <br...@braverock.com>:
>
>> On Wed, 2016-04-06 at 23:58 +0300, Jersey Fanatic wrote:
>> > I will try running the same code without trailing stops and see what
>> > effect
>> > it has on the processing time. I will report back as soon as it is
>> > finished.
>>
>> Running the macd demo code over 10 years of daily data on my machine (no
>> trailing stops) takes 0.5262365 secs for a single run.
>>
>>
>>
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] rbind and duplicates in monthly futures

2016-04-06 Thread Joshua Ulrich
On Tue, Apr 5, 2016 at 3:06 PM, Peter Neumaier <peter.neuma...@gmail.com> wrote:
> Hi all, in the interim I've managed to import the halfhourly data, cast to a
> matrix, then rbind the two months
> and convert to XTS for later use by my algo strategy.
>
> I am wondering how the data overlap will be treated by the quantstrat
> framework and how
> it might be impacting the calculations (i.e. P during overlaps).
>
It wasn't clear to me from your original question, but I can now see
that you want to create a single continuous futures series using
adjacent futures contracts.  As you probably guessed, the overlap in
data in your APR_MAY object would be very bad.

There is not a single correct way to create a continuous futures
series for every futures market.  You could roll to the next contract
when the current contract expires, when volume or open interest in the
current contract drops below some threshold over the next contract's
volume or open interest, etc.

I realize this doesn't completely answer your question... because your
question is not just about programming.  It's also about the
microstructure of the market you're researching.  Searching for
"continuous futures" or "futures roll" should help give you some ideas
about how to solve the problem for this specific futures market.

> Below the files and the code I am using:
>
> APR <-
> as.matrix(read.zoo("NGF201404_6weeks30mins.csv",sep=",",tz="",header=T))
> MAY <-
> as.matrix(read.zoo("NGF201405_6weeks30mins.csv",sep=",",tz="",header=T))
>
> APR_MAY <- as.xts(rbind(APR,MAY))
>
>
> http://tempsend.com/BBA86DB4ED
>
> http://tempsend.com/0EDA07753B
>
> Thanks
> Peter
>
> On Mon, Apr 4, 2016 at 2:30 PM, Joshua Ulrich <josh.m.ulr...@gmail.com>
> wrote:
>>
>> On Mon, Apr 4, 2016 at 7:24 AM, Peter Neumaier <peter.neuma...@gmail.com>
>> wrote:
>> > Hi all, I am trying to rbind monthly futures to a continuous time series
>> > to
>> > be run through an algo strategy. The problem here is that data is
>> > overlapping, i.e. my Feb contract trades for 6 weeks and when I rbind
>> > with
>> > my March data I get an overlap for last two weeks of Jan.
>> >
>> > How can I create a time series that is continuous, not overlapping and
>> > useable in quantstrat (i.e. XTS format)? I am not posting any code as it
>> > would be really one single rbind statement.
>> >
>> Even though the code may be simple, you still would be more likely to
>> receive help if you provide a minimal reproducible example of the
>> issue.  In this case, the data are not simple, and most people will
>> not take the time to construct sample data in order to attempt to
>> reproduce the issue you describe.
>>
>> > Thanks
>> > Peter
>> >
>> > [[alternative HTML version deleted]]
>> >
>> > ___
>> > R-SIG-Finance@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
>> R/Finance 2016 | www.rinfinance.com
>
>



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] GetOrders with Quantstrat

2016-04-06 Thread Joshua Ulrich
=TRUE)
>
>
>
> #stop loss
> add.rule(strategy.st, name="ruleSignal", arguments=list(sigcol="longentry",
>     sigval=TRUE,
>
> ordertype="stoplimit",
> orderside="long",
> replace=FALSE,
> orderqty="all",
> threshold=quote(.1),
> orderset="ocolong"),
>  type="chain",
>  parent="enterlong",
>  label="stopLossLong",
>  path.dep=TRUE,
>  enable=TRUE)
>
> #apply strategy
> t1 <- Sys.time()
> out2 <- applyStrategy(strategy=strategy.st,portfolios=portfolio.st )
> t2 <- Sys.time()
> print(t2-t1)
>
> #getOrders
> oB <- getOrders(portfolio.st, symbols, status="open")
> View(oB)
>
> On Tue, Apr 5, 2016 at 7:48 PM, Joshua Ulrich <josh.m.ulr...@gmail.com>
> wrote:
>>
>> On Tue, Apr 5, 2016 at 4:26 AM, Ryan Crawford <suchislif...@gmail.com>
>> wrote:
>> > Hello
>> >
>> > I have been trying to view "open" orders from the orderbook in
>> > Quantstrat
>> > and keep running into the same error.
>> >
>> > It seems a reasonably simple process however the error I get is:
>> >
>> > oB <- getOrders(portfolio.st, symbols, status="open")
>> >
>> > Error in orderbook[[portfolio]][[symbol]] :
>> >   recursive indexing failed at level 2
>> >
>> > I've searched extensively and I can't seem to pinpoint the issue.
>> >
>> > Below is a reproducible example that generates the error.
>> >
>> > Thank you in advance for any help.
>> >
>> While reproducible, a strategy with 22 symbols isn't minimal.
>> Regardless, I ran your code, but no orders are created and lots of
>> warnings are generated by IKTrading function(s).
>>
>> I also get a different error when calling getOrders():
>> "Error in orderbook[[portfolio]][[symbol]] : no such index at level 2".
>> ...which is reasonable, given there are no orders.
>>
>> >
>> > require(quantstrat)
>> > require(IKTrading)
>> >
>> > # Set the currency and the timezone
>> > currency('USD')
>> > Sys.setenv(TZ = "UTC")
>> >
>> > # Define symbols of interest
>> > symbols <- c("AMP.AX", "BHP.AX", "ANZ.AX",
>> >  "CBA.AX", "BXB.AX", "CSL.AX", "IAG.AX",
>> >  "MQG.AX", "NAB.AX", "ORG.AX", "QBE.AX",
>> >  "RIO.AX", "SCG.AX", "SUN.AX", "TLS.AX",
>> >  "WBC.AX", "WES.AX", "WOW.AX", "WPL.AX",
>> >  "TCL.AX", "WFD.AX", "AMC.AX")
>> >
>> > #Get Symbols
>> > getSymbols(Symbols=symbols, from="2010-01-01", to="2016-04-04")
>> >
>> > # Define the instrument type
>> > stock(symbols, currency = "USD", multiplier = 1)
>> >
>> > #Boilerplate
>> > from = "2010-01-01"
>> > to = "2016-04-04"
>> >
>> > #trade sizing and initial equity settings
>> > tradeSize <- 2500
>> > initEq <- 10
>> >
>> > strategy.st <- portfolio.st <- account.st <- "GetOrderBook"
>> > rm.strat(portfolio.st)
>> > rm.strat(strategy.st)
>> > initAcct(account.st, portfolio.st, currency='USD', initEq=initEq)
>> > initPortf(portfolio.st, symbols, currency='USD')
>> > initOrders(portfolio.st)
>> > strategy(strategy.st, store=TRUE)
>> >
>> > #Add Indicators
>> > add.indicator(strategy.st, name="SMA",
>> >   arguments=list(x=quote(Cl(mktdata)), n=20),
>> >   label="sma")
>> >
>> > #Add Entry and Exit Signals
>> > add.signal(strategy.st, name="sigComparison",
>> >arguments=list(columns=c("Close", "SMA.20.sma"),
>> >   relationship="gt"),
>> >label="longentry")
>> >
>> > #enter si

Re: [R-SIG-Finance] GetOrders with Quantstrat

2016-04-05 Thread Joshua Ulrich
On Tue, Apr 5, 2016 at 4:26 AM, Ryan Crawford <suchislif...@gmail.com> wrote:
> Hello
>
> I have been trying to view "open" orders from the orderbook in Quantstrat
> and keep running into the same error.
>
> It seems a reasonably simple process however the error I get is:
>
> oB <- getOrders(portfolio.st, symbols, status="open")
>
> Error in orderbook[[portfolio]][[symbol]] :
>   recursive indexing failed at level 2
>
> I've searched extensively and I can't seem to pinpoint the issue.
>
> Below is a reproducible example that generates the error.
>
> Thank you in advance for any help.
>
While reproducible, a strategy with 22 symbols isn't minimal.
Regardless, I ran your code, but no orders are created and lots of
warnings are generated by IKTrading function(s).

I also get a different error when calling getOrders():
"Error in orderbook[[portfolio]][[symbol]] : no such index at level 2".
...which is reasonable, given there are no orders.

>
> require(quantstrat)
> require(IKTrading)
>
> # Set the currency and the timezone
> currency('USD')
> Sys.setenv(TZ = "UTC")
>
> # Define symbols of interest
> symbols <- c("AMP.AX", "BHP.AX", "ANZ.AX",
>  "CBA.AX", "BXB.AX", "CSL.AX", "IAG.AX",
>  "MQG.AX", "NAB.AX", "ORG.AX", "QBE.AX",
>  "RIO.AX", "SCG.AX", "SUN.AX", "TLS.AX",
>  "WBC.AX", "WES.AX", "WOW.AX", "WPL.AX",
>  "TCL.AX", "WFD.AX", "AMC.AX")
>
> #Get Symbols
> getSymbols(Symbols=symbols, from="2010-01-01", to="2016-04-04")
>
> # Define the instrument type
> stock(symbols, currency = "USD", multiplier = 1)
>
> #Boilerplate
> from = "2010-01-01"
> to = "2016-04-04"
>
> #trade sizing and initial equity settings
> tradeSize <- 2500
> initEq <- 10
>
> strategy.st <- portfolio.st <- account.st <- "GetOrderBook"
> rm.strat(portfolio.st)
> rm.strat(strategy.st)
> initAcct(account.st, portfolio.st, currency='USD', initEq=initEq)
> initPortf(portfolio.st, symbols, currency='USD')
> initOrders(portfolio.st)
> strategy(strategy.st, store=TRUE)
>
> #Add Indicators
> add.indicator(strategy.st, name="SMA",
>   arguments=list(x=quote(Cl(mktdata)), n=20),
>   label="sma")
>
> #Add Entry and Exit Signals
> add.signal(strategy.st, name="sigComparison",
>arguments=list(columns=c("Close", "SMA.20.sma"),
>   relationship="gt"),
>label="longentry")
>
> #enter signal rule
> add.rule(strategy.st, name="ruleSignal",
>  arguments=list(sigcol="longentry",
> sigval=TRUE,
> ordertype="limit",
> orderside="long",
> replace=TRUE,
> prefer="Close",
> tmult = TRUE,
> threshold = 0.05,
> time.in.force=172800,
> orderqty=tradeSize,
> osFUN=osMaxDollar,
> tradeSize=tradeSize,
> maxSize=tradeSize),
>  type="enter",
>  path.dep=TRUE,
>  label="enterlong")
>
> #stop loss.
> add.rule(strategy.st, name="ruleSignal",
>  arguments=list(sigcol="longentry",
> sigval=TRUE,
> ordertype="stoptrailing",
> orderside="long",
> replace=FALSE,
> orderqty="all",
> threshold=0.05,
> tmult=TRUE,
> orderset="ocolong"),
>  type="chain",
>  parent="enterlong",
>  label="stopLossLong",
>  path.dep=TRUE,
>  enable=TRUE)
>
> #apply strategy
> out2 <- applyStrategy(strategy=strategy.st,portfolios=portfolio.st )
>
> #get open orders
> oB <- getOrders(portfolio.st, symbols, status="open")
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] rbind and duplicates in monthly futures

2016-04-04 Thread Joshua Ulrich
On Mon, Apr 4, 2016 at 7:24 AM, Peter Neumaier <peter.neuma...@gmail.com> wrote:
> Hi all, I am trying to rbind monthly futures to a continuous time series to
> be run through an algo strategy. The problem here is that data is
> overlapping, i.e. my Feb contract trades for 6 weeks and when I rbind with
> my March data I get an overlap for last two weeks of Jan.
>
> How can I create a time series that is continuous, not overlapping and
> useable in quantstrat (i.e. XTS format)? I am not posting any code as it
> would be really one single rbind statement.
>
Even though the code may be simple, you still would be more likely to
receive help if you provide a minimal reproducible example of the
issue.  In this case, the data are not simple, and most people will
not take the time to construct sample data in order to attempt to
reproduce the issue you describe.

> Thanks
> Peter
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] getOptionChain function in quantmod

2016-04-04 Thread Joshua Ulrich
On Mon, Apr 4, 2016 at 6:09 AM, Benno Longobardolino <wotuz...@gmail.com> wrote:
> Hi UseRs,
>
> I've got a question about the getOptionChain function in the quantmod
> package.
>
> when I run this code I receive the front-month expiry option chain of Apple
> from finance.yahoo.com:
>
> library(quantmod)
> getOptionChain("AAPL")
>
> However, when I look this up on the website of finance.yahoo.com (
> http://finance.yahoo.com/q/op?s=AAPL+Options) then I see an additional
> column => "Implied Volatility".
>
> My question are:
> 1) Why is this column omitted in the output of getOptionChain?

Because I couldn't find any documentation about how it is calculated.

> 2) Is yahoo's calculation of the implied volatility generally reliable?

See above.

> 3) Are there other (easy) ways to calculate this using existing R libraries?

See the CRAN Finance Task View for many options (pun intended):
https://cran.r-project.org/web/views/Finance.html

Two examples: RQuantLib, fOptions.

>
> Thank you,
>
> Andreas
>
> [[alternative HTML version deleted]]
>
> ___
> R-SIG-Finance@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
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] stoplimit market price with OHLC

2016-04-02 Thread Joshua Ulrich
On Tue, Mar 29, 2016 at 9:46 AM, Diego Peroni <diegoper...@vodafone.it> wrote:
> Hi All,
>
> my strategy exit an open position with a simple Signal based on 1 minute
> OHLC bars.
>
> This is my exit rule:
>
> add.rule(qs.strategy, name='ruleSignal',
>  arguments=list(sigcol='upTrend', sigval=TRUE,
> replace=TRUE,
> orderside='short',
> ordertype='market',
> orderqty='all',
> orderset='ocoshort'
>  ),
>  type='exit',
>  label='ExitShort',
>  enabled=TRUE)
>
> My question is: which price quantstrat use to sell market by default?
> - Current Bar Close Price?
> - Next Bar Open Price?
> - Next Bar "worst"/"best" Price?
>
Assuming you haven't specified "prefer", it will be NULL by default,
which means getPrice will be called on mktdata with prefer=NULL.  When
getPrice is called with prefer=NULL, it will search for a column name
containing "price", "trade", or "close" (in that order) and will
return the first it finds.

The transaction will occur on the observation after the order is
entered, since it's not safe to assume that your order will be filled
at the price you observed that triggered the order entry.

> Thanks in advance
>
> Diego
>
> ___
> R-SIG-Finance@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
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Optimizing Quanstrat MACD with apply.paramset returns combine error

2016-03-22 Thread Joshua Ulrich
gt;
> # Exit
> add.rule(strategy.name,name='ruleSignal',
>  arguments = list(sigcol="longExit",
>   sigval=TRUE,
>   orderqty='all',
>   ordertype='market',
>   orderside='long',
>   osFUN='osFixedDollar'),
>  type='exit',
>  label='ExitLONG',
>  storefun=FALSE)
>
> ## Run it
> applyStrategy(strategy.name,
>   portfolios=portfolio.name,
>   parameters=list(nFast = .nFast, nSlow = .nSlow, nSig =
> .nSig, maType = 'EMA'),
>   verbose=TRUE)
>
> updatePortf(Portfolio=portfolio.name,Dates=paste('::',as.Date(Sys.time()),sep=''))
> updateAcct(account.name)
> updateEndEq(account.name)
>
> ## Evaluate
> t(tradeStats(portfolio.name))
> getTxns(portfolio.name, Symbol = 'ETHBTC')
> perTradeStats(portfolio.name, "ETHBTC")
>
> chart.Posn(Portfolio=portfolio.name,Symbol=symbols, type = "line",
> log.scale = T)
> plot(add_Vo())
> plot(add_MACD(fast=.nFast, slow=.nSlow, signal=.nSig,maType="EMA"))  #
> nFast = 60, nSlow = 180, nSig = 40, maType = 'EMA'
>
> ###
>
> The above runs perfectly-fine. However, I want to vary the nFast and
> nSlow parameters to the MACD() function:
>
> ## Parameter distribution testing
> add.distribution(strategy.name,
>  paramset.label = 'optEMA',
>  component.type = 'indicator',
>  component.label = 'nFast',
>  variable = list(nFast = 60:80),
>  label = 'NFAST')
>
> add.distribution(strategy.name,
>  paramset.label = 'optEMA',
>  component.type = 'indicator',
>  component.label = 'nSlow',
>  variable = list(nFast = 180:200),
>  label = 'NSLOW')
>
> library(doMC)
> registerDoMC(cores=detectCores())
>
> results <- apply.paramset(strategy.name, paramset.label = "optEMA",
> portfolio=portfolio.name, account=account.name, nsamples=0)
>
> ###
>
> This gives me the following error, which I'm not sure how to debug:
>
> error calling combine function:
>  result.6, ... result.439, result.440, result.441): attempt to select
> less than one element>
>
> What am I doing wrong? FWIW, I am using Ubuntu 12.04/14.04. Any help
> is much appreciated. Thanks!!
>
> --
> Ray Bao
> T: 925.272.9226
> M: 510.292.3438
> iamraybao.com
>
> ___
> R-SIG-Finance@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
R/Finance 2016 | www.rinfinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] need apply.paramset logging

2016-03-22 Thread Joshua Ulrich
On Tue, Mar 22, 2016 at 10:21 AM, Diego Peroni <diegoper...@vodafone.it> wrote:
>
>
> On 22/03/2016 16:03, Brian G. Peterson wrote:
>>
>> Executing on minute data won't drive the speed of the path-dependent
>> rules loop, the total number of signals which need to be evaluated will,
>> or the inclusion of things like trailing stops.
>
> Trailing Stops is my case :-)
>>
>>
>> You should be able to sort out which parameter combination is failing
>> from the print statements.  you should also be able to look at the audit
>> environment to see which portfolio you're expecting is missing.
>
> During multicore execution I'm enable to see print out.
> I'm sure there is a way to redirect each thread print out to a file but I
> don't know how.

doMC runs in separate processes, not threads.  You could add some code
to print the process ID before each message, or write to a file named
with the process ID.
> Sys.getpid()
[1] 29236
> registerDoMC(2)
> foreach(1:6) %dopar% { Sys.getpid() }
[[1]]
[1] 29345

[[2]]
[1] 29346

[[3]]
[1] 29345

[[4]]
[1] 29346

[[5]]
[1] 29345

[[6]]
[1] 29346

>>
>>
>> Ultimately, this is a problem in your strategy specification...  You've
>> created an infeasible parameter combination.  You likely want to debug
>> what, specifically, is failing, rather than just skipping the failing
>> parameter set.
>>
>> If you're determined to work with the combine funtion...
>
> Sure :)
>>
>>
>> The .combine argument for foreach is described in the documentation for
>> foreach.  See ?foreach.
>>
>> The combine function in apply.paramset is inside the apply.paramset
>> function.  We could probably check for a user-supplied combine, or you
>> could modify the combine function inside apply.paramset yourself.
>
> Thanks a lot, I take a look
>
>
> Regards
>
> Diego
>
>
>
>>
>>
>>
>> On Tue, 2016-03-22 at 15:45 +0100, Diego Peroni wrote:
>>>
>>> Brain thanks for your answers!
>>>
>>> My strategy take a long time to run because it is "minute" based and
>>> runs over 6 years.
>>>
>>> I've just 100 combinations so it is not the best to reduce nsamples to
>>> find errors.
>>>
>>> If I reduce time range (2 o 3 years) it doesn't fail.
>>>
>>> If I run sequentially it take a very long time.
>>>
>>> The best solution remains the last you have indicated: "custom .combine
>>> function that could trap errors".
>>> Does exist some documentation or example to read?
>>>
>>> Regards
>>>
>>> Diego Peroni
>>>
>>>
>>>
>>>
>>> On 22/03/2016 09:46, Brian G. Peterson wrote:
>>>>
>>>> On 03/22/2016 03:37 AM, Diego Peroni wrote:
>>>>>
>>>>> I'm testing paramset combinations with:
>>>>>
>>>>> .
>>>>> library(doMC)
>>>>> registerDoMC(cores=detectCores())
>>>>> paramsetenv = new.env()
>>>>> results = apply.paramset(qs.strategy, paramset.label = "MACDOPT",
>>>>> verbose = TRUE,
>>>>> portfolio=qs.strategy, account=qs.strategy,
>>>>> nsamples=0, audit=paramsetenv)
>>>>>
>>>>> but the procedure returns NULL object with this message:
>>>>>
>>>>> error calling combine function:
>>>>> 
>>>>>
>>>>> Is there a way to log threads errors?
>>>>>
>>>>> Or how can I modify "apply.paramset" function to "catch" single
>>>>> simultation error or void result and discard it?
>>>>
>>>> you're setting
>>>>
>>>> nsamples=0
>>>>
>>>> so you have zero results to combine.
>>>>
>>>> In this case, you told it to run no samples, but I can conceive of a
>>>> strategy using some MCMC sampler that could fail spontaneously in some
>>>> circumstances.
>>>>
A point of clarification: nsamples = 0 is the default for
apply.paramset. While confusing, that means that no sampling is done
and all parameter combinations are evaluated.  Sampling is only done
when nsamples > 0.

>>>> In a more general sense, you could specify a custom .combine function
>>>> that could trap errors if there was some possibility that your
>>>> strategy would fail to return a viable result.
>>>>
>>>> 

  1   2   3   4   >