Tag Archives: package

Q&A Order book R package for ultimate historical backtesting simulation?

Q&A Order book R package for ultimate historical backtesting simulation?

This was from an R blog visitor  

Hi! Im trying to get access to the R package “orderbook” (which is not on CRAN), any idea how to get hold on this?

 

This is an old but look really good. I would refer to these helpful URLs:

http://limitob.r-forge.r-project.org/

https://stat.ethz.ch/pipermail/r-sig-finance/2010q2/006222.html

Older download links where you need to manually install the zip through your RStudio:

http://cran.r-project.org/src/contrib/Archive/orderbook/

 

I also found this which may help:

http://journal.r-project.org/archive/2011-1/RJournal_2011-1_Kane~et~al.pdf

Here is an R package to interface R and IQFeed together for market data and tick feed

Here is an R package to interface R and IQFeed together for market data and tick feed

https://github.com/bwlewis/iqfeed

I will try this out with a potential review.

NOTE: This appears it does not run. There is an Python version ut I gave up as I don’t know it

https://github.com/sobotklp/pyqfeed/blob/master/setup.py

daily <- HDX("XOM",days=3)
Warning message:
In doTryCatch(return(expr), name, parentenv, handler) :
  could not find function "xts"
> fix(daily)
Error in file(filename, "r") : cannot open the connection
In addition: Warning message:
In file(filename, "r") :
  cannot open file 'C:UserscausticAppDataLocalTempRtmp0wKFX8Redit1af0306278cd': No such file or directory
Error in edit(name, file, title, editor) : expression parsing error

To get running, you could follow the instructions in the README but to get working, download the iqfeed. Run the following script:

## If you want to source() a bunch of files, something like
> ## the following may be useful:
> sourceDir <- function(path, trace = TRUE, ...) {
+   for (nm in list.files(path, pattern = "\.[RrSsQq]$")) {
+     if(trace) cat(nm,":")
+     source(file.path(path, nm), ...)
+     if(trace) cat("n")
+   }
+ }
> sourceDir("C:\Users\caustic\Documents\R\bwlewis-iqfeed-27273bc\bwlewis-iqfeed-27273bc\R")

Will Microsoft OpenTech put Redis into #1 status for in memory NOSQL database? For Linux, Window, and Mac OS X?

Wow! I almost crapped my pants when I read these links:

http://www.zdnet.com/blog/microsoft/microsoft-makes-improvements-to-redis-on-windows-in-memory-database/12563
http://stackoverflow.com/questions/6476945/how-do-i-run-redis-on-windows
https://github.com/rgl/redis/downloads  <–best download
http://blogs.msdn.com/b/interoperability/archive/2012/04/26/here-s-to-the-first-release-from-ms-open-tech-redis-on-windows.aspx
https://github.com/MSOpenTech/Redis

The amazing thing is Microsoft Azure is now the #1 division within Microsoft thanks to their new adoption of the open source languages like Python, Java, Ruby, PHP, etc. Now they want to move into NOSQL databases like Redis. This is big.

Anyhow, I tried getting MongoDB running on a multiplatform within a cluster. What a nitemare thanks to the very primitive documentation. It was rendered useless! As you know, I am now able to see my $100K saving as I switch from Matlab to R. It was so easy to do with Redis for Windows. Compared to MongoDB with a clusters was well useless. Junk. Dead on arrival compared to Redis.Well at least compared to my needs.

As with Redis available for Windows, it can be instantly installed as a service which makes it very easy to start. The GitHub.com link will get you there. I was able to connect into the Redit repository so simply with doRedis.R package.

Watch this Youtube at this link to learn more: http://bigcomputing.com/doredis.html

For clustering and parallelization from R’s perspective is so simple. Scary simple. Compare to MongoDB. Ugly as hell.I can say without hesitation, this is the best stack to go with or my needs. No more wasted days with MongoDB and MYSQL. Too bad they don’t understand how to properly document compared to doRedis and the Redis comminity. I can now move forward onto other steps without worrying about broken stuff from the other options I thought I had to tackle!

I can assure you my Premium membership would expext nothing less of me to deliver. Also, as Borat would say. Very nice!

As in the Youtube video, register your subsequent doRedis R jobs in the host Redis but doing within your secondary R environment: redisWorker(host=’192.168.1.10′,queue=’jobs’) where you register to the host id with the queue being run.

[youtube_sc url=”http://www.youtube.com/watch?v=RtbAk-n-tqM” title=”NOSQL%20Redis%20on%20Windows%20and%20Linux%20clusterto%20parallelize%20with%20R%20and%20doRedis%20package”]

 

 

 

Open R package query? Is Open Gamma a FREE R package for Risk Management and Front Office applications?

Open R package query? Is Open Gamma a FREE R package for Risk Management and Front Office applications? 
Is Open Gamma a FREE R package for Risk Management and Front Office applications? 
Is this it?
http://developers.opengamma.com/downloads/platform-1.0.0On 2012-07-23 04:32, Ratanlal Mahanta wrote:

Hi Bryan, Hope you are doing Well. I have a query How to install “Open Gamma” Package In R.am I looking a link to download the “Open Gamma” Package in R. Looking forward from You. Regards

Anyone know R, RStudio, RBG package, or RBloomberg package to help out

 

Anyone know R, RStudio, RBG package, or RBloomberg package to help out

Get in touch me if you can help this guys out.

I live in NYC area. I recently got interested in trying out R for some of quant-financial projects.  I have used Matlab before.   I don’t think I can make it to the physical meetup, but I definitely to join the virtual one.

 

One of the things for newbies in R like me is where to get user-specific help.  In my case, I am stumped by not being able to get RBbg working in RStudio, despite having installed the latest R and RBbg package on my Windows 7 machine.   I tried posting on stackoverflow.com, but unsurprisingly it is not of interest to other people since it seems to be a specific problem for my setup.  I am happy to pay some money for someone to debug this for me.   I contacted Revolution Analytics, but the firm focused on big consulting type of projects.    I wonder  if you know of resources that may address my needs.  Perhaps this will be a possible topic for the webinar.

 

 

Here is a Youtube video on how to use R to access MYSQL through RMySQL R package

Here is a Youtube video on how to use R to access MYSQL through RMySQL R package

This might be one of those extra unneeded videos you can find on Youtube but surprise, there were none. After running my survey of which database (commercial, open source RDMS or NOSQL) R users run, it struck me that nearly half use MYSQL followed by PostgreSQL.

I always had concerns of MYSQL with scaling and redundancy for my large data I anticipate my models and simulations will need. I demoed everything from Cassandra, Hadoop, Redis, MongolDB, etc. I found many were good but I found Redis to be the best one that fit my needs. As a result, I though  I was set until…

I came across an open source trading platform done in C++ called Trading Shim. This was a rare find as it met all my needs including Interactive Brokers but used MYSQL out of box. The database schema was big as well. I tried debugging and configuring which is still not complete but I am getting closer.

After seeing the results of my survey, I through why not stick with MYSQL for now as it can be fast enough. Hey, Yahoo Finance uses it for their backend so it cannot be that bad right. I just understand you would go through some heavy configuring to do something like sharding. This would not be as easy as in something like Redis. Anyhow, also MYSQL has proven to be the most popular database as well so it might be wise to get more comfortable with something that is widely used.

As for this Trading Shim, it makes my life so much easier without needing to recode anything so I just need to have my R algorithms access the MYSQL data. This was a much more sensible option at least this point to minimize the coding and debugging cycles.

So …enough typing, I have this video posted to show how easy it to have R access MYSQL. As said, this appears to only work in a Linux environment due to the RMySQL requires RCpp which only works with GCC, not Visual Studio for Windows. Sorry, I don’t make the rules. You could install MINGW for Windows and GCC but why would you want to go through the pain of that?

[youtube_sc url=”http://www.youtube.com/watch?v=LvCFaTln_3g” playlist=”how to have R access MYSQL through RMySQL R package”]

Old High Frequency Tick Data R Package exists with spreads, trade direction, statistics, volatility for forex and equity

Old High Frequency Tick Data R Package exists with spreads, trade direction, statistics, volatility for forex and equity
This high frequency R package looks fantastic. It includes a lot of analysis on high frequency data where the number of observations could easily be 100K or way more. It contains so many juicy benefits including:
1.    A very decent PDF sample is included. This can be quite rare as there are some real world examples including a few equity analysis and even foreign exchange trading pair.
2.    A good section is described on duration which is part of high frequency data.
3.    Many traders will always find spread results but again to see an R function do this is rare. On the provided equity example like Microsoft, this shows the spread between the bid and ask quotes. It is quite convenient. There is also an example provided with a foreign exchange pair as well between  bid and ask quotes in multiples of ticks with a specified tick size. I never saw anything like this in Matlab.
4.    There is a handy function which triggers a trading direction. Here you can analyze the dataset to know when to buy or sell based on this function.   You can also specify the time lag as well.
5.    There is a set of handy functions for standard statistic measurements like mean, standard deviation, etc. As well, you get associated plots like histograms as well as functions for calendar patterns.
6.    There is a realized volatility function which is based on Anderson versus other volatility models like GARCH models, stochastic volatility models, or the volatility implied by options or other
Derivative prices. Also, there is another set of benefits quoted from the supplied PDF:

They prove that as the sampling frequency of returns approaches infinity,
realized volatility measures are asymptotically free of measurement error. For daily
volatility, they use 5-minute returns to construct daily realized volatilities. The 5-
minute horizon is short enough to have the underlying asymptotic work well, but long
enough to mitigate the autocorrelation distortion caused by market microstructure
frictions.

The Challenge

All this sounds fine but you will find that this package is pretty old from 2003. This R package looks like it has been abandoned and needs a refresh so let me know what you think of this package’s potential. I want to note the conversion using the TAQ Load seems broken so capturing and converting data is not so easy.

Get your hands on it over at:

Compatible R in S+:
http://faculty.washington.edu/ezivot/research/HFAnalysis.ssc
PDF: http://faculty.washington.edu/ezivot/research/hfanalysis.pdf
Get the data here: http://faculty.washington.edu/ezivot/ezresearch.htm

Youtube video on using RCaller R package to call R from within Java application

Youtube video on using RCaller R package to call R from within Java application

This seems to work o from within a Linux virtual machine:

http://www.mhsatman.com/rcaller.php

http://stdioe.blogspot.ca/2011/07/rcaller-20-calling-r-from-java.html

Ensure to use RCaller 2..7 JAR for the above example to work.

http://stdioe.blogspot.ca/2011/07/rcaller-20-calling-r-from-java.html

[youtube_sc url=”http://www.youtube.com/watch?v=fHt0cq-6BvM” playlist=”r java”]