[R] R and Forex

R. Michael Weylandt michael.weylandt at gmail.com
Thu Oct 13 00:53:15 CEST 2011


Just a comment on the lack of a direct R API for non-IBrokers
brokerages: of course its possible to put something together using
rJava or a direct C interface, but it's not the smoothest thing if
you've never delved into the R internals and it's not quite the
fastest thing in the world if you are doing particularly
time-sensitive work. At lower frequencies, this becomes less of an
issue and simple work-arounds like using a csv file as an intermediate
can make everything much easier.

On the other end of the trade process, once you start getting into
more HF domains, there's also the inverse problem of real-time
processing: I'm not particularly interested in the question so I
haven't thought much about it, but I don't see a particularly R-ish
way to deal with a live data feed, though it's been dealt with in the
R-SIG-Finance archives a couple of times.

Michael

On Wed, Oct 12, 2011 at 5:56 PM, Yves S. Garret
<yoursurrogategod at gmail.com> wrote:
> Also, when you say to do the trading aspect is more difficult, what do you
> mean exactly?  Are there performance issues with the code tasked to do the
> trades?  Lack of API?  Or is it just a pain to put something coherent
> together that will do the trades?
>
> On Wed, Oct 12, 2011 at 3:07 PM, R. Michael Weylandt
> <michael.weylandt at gmail.com> wrote:
>>
>> As was pointed out to you before, this is really more of an
>> R-SIG-Finance question, but I wouldn't expect too much explanation
>> there either, just people pointing you to the standard R finance tools
>> (quantmod, zoo/xts, TTR, RBloomberg, and the Rmetrics suite; there's
>> also some fantastic tools in development but if you just picked up
>> your first book on R, you probably aren't ready for those yet).
>>
>> You question isn't particularly well-defined either:
>>
>> Do you just want to study currency price series in R? This is simple:
>> just get the data (perhaps from oanda using quantmod::getSymbols or
>> simply by reading in through any of the regular functions) and study
>> it however you like.
>>
>> The actual act of trading, however, is harder to do solely within R:
>> there is a very popular IBrokers API but I haven't used it much. It
>> sounds like you are probably a lone trader so if you don't have a
>> pre-existing relationship with IBrokers you'll probably want to enter
>> trades through whichever broker you currently use. That -- the
>> IBrokers package -- is the complete only solution on that end I'm
>> aware of, though I'm sure many folks have their own work-arounds.
>>
>> And as far as experiences go: well, I suppose folks wouldn't be doing
>> it if they thought there was no money to be made, now would they?
>>
>> If you want more to read: check the CRAN task views, as suggested before.
>>
>> Michael
>>
>> PS -- A serious note: FX is much closer to a zero-sum game than
>> long-equity, I would be remiss if I didn't warn you to tread
>> carefully.
>>
>> On Wed, Oct 12, 2011 at 1:50 PM, Yves S. Garret
>> <yoursurrogategod at gmail.com> wrote:
>> > Yes, that's what I meant.  Curious what the experiences were of some
>> > people
>> > and some tips.
>> >
>> > On Wed, Oct 12, 2011 at 12:31 PM, R. Michael Weylandt
>> > <michael.weylandt at gmail.com> wrote:
>> >>
>> >> "This" being what exactly?
>> >>
>> >> Traded in FX using R? Yes, its done everyday, even as I type....
>> >>
>> >> Michael
>> >>
>> >> On Wed, Oct 12, 2011 at 8:10 AM, Yves S. Garret
>> >> <yoursurrogategod at gmail.com> wrote:
>> >> > No, that's not what I meant.  I was curious if anyone has ever done
>> >> > this
>> >> > before and how well it worked.  Any tips for a novice?
>> >> >
>> >> > On Wed, Oct 12, 2011 at 12:19 AM, Liviu Andronic
>> >> > <landronimirc at gmail.com>wrote:
>> >> >
>> >> >> On Wed, Oct 12, 2011 at 3:29 AM, Yves S. Garret
>> >> >> <yoursurrogategod at gmail.com> wrote:
>> >> >> > Hi all,
>> >> >> >
>> >> >> >   I recently started learning about Forex and found this O'Reilly
>> >> >> > book in
>> >> >> > Barnes & Nobles about R.  I bought it out of pure curiosity.  I
>> >> >> > like
>> >> >> > what
>> >> >> I
>> >> >> > see.  However, I have a question.  Has anyone tried to bring these
>> >> >> > two
>> >> >> ideas
>> >> >> > together in a financial and trading sense?  Are there any
>> >> >> > libraries
>> >> >> > or
>> >> >> > modules in R that can aid in this venture?
>> >> >> >
>> >> >>
>> >> >> > fortune('equity')
>> >> >>
>> >> >> I have never heard anyone (knowledgable or otherwise) claim that, in
>> >> >> the
>> >> >> absence of transition costs, SAS is better than R for equity
>> >> >> modeling.
>> >> >> If
>> >> >> you
>> >> >> come across any such claim, I would be happy to refute it.
>> >> >>   -- David Kane
>> >> >>      R-SIG-Finance (December 2004)
>> >> >>
>> >> >>
>> >> >> You may want to address this question to r-sig-finance, and check
>> >> >> out
>> >> >> the Finance Task View [1]. Regards
>> >> >> Liviu
>> >> >>
>> >> >> [1] http://cran.at.r-project.org/web/views/Finance.html
>> >> >>
>> >> >>
>> >> >> > --Yves
>> >> >> >
>> >> >> >        [[alternative HTML version deleted]]
>> >> >> >
>> >> >> > ______________________________________________
>> >> >> > R-help at r-project.org mailing list
>> >> >> > https://stat.ethz.ch/mailman/listinfo/r-help
>> >> >> > PLEASE do read the posting guide
>> >> >> http://www.R-project.org/posting-guide.html
>> >> >> > and provide commented, minimal, self-contained, reproducible code.
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Do you know how to read?
>> >> >> http://www.alienetworks.com/srtest.cfm
>> >> >>
>> >> >> http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
>> >> >> Do you know how to write?
>> >> >> http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail
>> >> >>
>> >> >
>> >> >        [[alternative HTML version deleted]]
>> >> >
>> >> > ______________________________________________
>> >> > R-help at r-project.org mailing list
>> >> > https://stat.ethz.ch/mailman/listinfo/r-help
>> >> > PLEASE do read the posting guide
>> >> > http://www.R-project.org/posting-guide.html
>> >> > and provide commented, minimal, self-contained, reproducible code.
>> >> >
>> >
>> >
>
>



More information about the R-help mailing list