robot (SPX) DNA Management Techniques

May 18, 2010
By

(This article was first published on Milk Trader, and kindly contributed to R-bloggers)

Yes, this is related to trading, but no, it is not my thesis on why the Euro is going to parity. Instead, it is sort of a workshop for robot(SPX) developers on how to organize their digital DNA. As you begin to use programming as a money extraction tool on the markets, you'll soon find that organizing your implements becomes more than half the battle. I'm proposing an organization scheme for trading code that uses two free utilities: Tortoise SVN and Dropbox. At the end, I'll throw in a cool trick for using this setup to keep all your R projects organized.


First a quick tutorial on Tortoise SVN. It's a version control program that keeps track of changes to your code. If you're new to version control, do not fret or worry, do not become discouraged. It's not that hard a concept to grasp. The idea is that you designate a central holding area (they call it a 'repo' which is geek shorthand for repository) to keep and store your code. To access this code, you must check it out, like a library. Everything is built around folders, so first you create a folder for your code, then you import it to your repository, then you check it out into your working folder. See, it's not that complicated.

I call my checkout folder a DESK, but that's a personal convention I dreamed up that has no intrinsic value apart from it making sense to me. For example, my checkout folder for intermarket analysis of equity markets is called DESK_interMarket (notice camel-casing). It contains a subfolder called SVN_InterMarket (notice Pascal-casing), which is the checked-out InterMarket folder found in the SVN repository. This holds all the project-specific code for the trading research. The DESK folder also includes an R image file, but more about that in a moment.

I keep both my DESK_interMarket folder and its repository called SVN in my Dropbox account. This allows for it to save and gives me access to code away from my computer.

Now back to the R image file. When you open an R session, try typing the command getwd (). This will tell you the directory R is assuming you want. But remember you want to switch it to the Dropbox file, so go to the Dropbox folder and use the handy 'Copy Address' option from right-clicking on the window where your address is depicted. Or if you can't figure that out, just write it down on a sheet of paper; that's the hard way of doing the same thing. Now, while in R, type:

setwd ("C:\Users\Milktrader\Documents\My Dropbox\DESK_interMarket")

This is the copied style, but R likes to make you work a little, so you need to invert the backslashes to forward slashes, thusly:

setwd ("C:/Users/Milktrader/Documents/My Dropbox/DESK_interMarket")

Now when you type getwd (), you should get the address you specified. Why is this important? Well, next we're going to type the following command:

save.image()

Now whenever you go to your folder labeled DESK_interMarket (or whatever convention you've decided works for you) you'll see an icon of a big blue R. Double-click it and you've started an R session with the prescribed paths already in place.

When managing your robot(SPX) DNA, it's good to sit and think a bit about what is a proper convention for naming folders and organizing them around some meta-concept you have in your head. The SVN is not limited to just code. You can also include cheat-sheet text files and other handy references that every market Dr. When managing your robot(SPX) DNA, it's good to sit and think a bit about what is a proper convention for naming folders and organizing them around some meta-concept you have in your head. The SVN is not limited to just code. You can also include cheat-sheet text files and other handy references that every market Dr. Frankenstein needs in the laboratory.

To leave a comment for the author, please follow the link and comment on his blog: Milk Trader.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: ,

Comments are closed.