[R-SIG-Finance] Converting Data From DB (MSSQL) for use in quantmod
Cedrick Johnson
cedrick.johnson at chicagotrading.com
Tue Nov 25 16:46:10 CET 2008
That worked. Forgive my newbieness. I know what I need to spend time
reading up on now.
Thanks all!
-c
-----Original Message-----
From: Josh Ulrich [mailto:josh.m.ulrich at gmail.com]
Sent: Monday, November 24, 2008 10:23 PM
To: Cedrick Johnson
Cc: r-sig-finance at stat.math.ethz.ch
Subject: Re: [R-SIG-Finance] Converting Data From DB (MSSQL) for use in
quantmod
Hi Cedrick,
I think it's as simple as:
USSP2X <- xts(USSP2[,-1], order.by=USSP2$Date)
Best,
Josh
--
http://quantemplation.blogspot.com
On Mon, Nov 24, 2008 at 7:45 PM, Cedrick Johnson
<cedrick.johnson at chicagotrading.com> wrote:
> Howdy-
>
> Another silly beginner Q from me:
>
> I have a data table with a bunch of daily closing yields. I'm not so
> much interested in o-h-l for these symbols, so I set everything
> (o-h-l-c) to the daily closing yield I get at the end of the day.
>
>
> Date Open High Low Close
> 1 2008-01-02 3.70 3.70 3.70 3.70
> 2 2008-01-03 3.68 3.68 3.68 3.68
> 3 2008-01-04 3.52 3.52 3.52 3.52
> 4 2008-01-07 3.52 3.52 3.52 3.52
>
> This is the initial data set that is returned by my SQL query into R.
>
> Now, I attempted to get this into XTS:
> USSP2X <- xts(USSP2, order.by=USSP2$Date)
>
> Ok, fine and dandy, EXCEPT:
>
> Date Open High Low Close
> 2008-01-02 2008-01-02 3.70 3.70 3.70 3.70
> 2008-01-03 2008-01-03 3.68 3.68 3.68 3.68
> 2008-01-04 2008-01-04 3.52 3.52 3.52 3.52
>
> Which obviously won't work with quantmod that I'd like to run on this
> set of fixed income data.
>
> I tried MySQL, having some issues with that, else I would just use the
> mysql wrapper provided by quantmod to load the data I need. (I'm still
> attempting to get mysql to work, it's *not* a quantmod issue)
>
> What steps am I missing to convert data that I am retrieving from a DB
>
> xts for use in quantmod?
>
> If anyone knows of any documentation that I skipped over that would
help
> me solve this, please let me know.
>
> Thanks,
> Cedrick
>
>
>
>
>
> This message is intended only for the personal and confidential use of
the recipients named above. If the reader of this email is not the
intended recipient, you have received this email in error and any
review, dissemination, distribution or copying is strictly prohibited.
If you have received this email in error, please notify the sender
immediately by return email and permanently delete the copy you
received.
>
> This message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments. CTC Holdings nor any affiliates ("CTC")
are responsible for any recommendation, solicitation, offer or agreement
or any information about any transaction, customer account or account
activity that may be attached to or contained in this communication. CTC
accepts no liability for any content contained in the email, or any
errors or omissions arising as a result of e-mail transmission. Any
opinions contained in this email constitute the sender's best judgment
at this time and are subject to change without notice.
>
>
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>
This message is intended only for the personal and confidential use of the recipients named above. If the reader of this email is not the intended recipient, you have received this email in error and any review, dissemination, distribution or copying is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and permanently delete the copy you received.
This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. CTC Holdings nor any affiliates ("CTC") are responsible for any recommendation, solicitation, offer or agreement or any information about any transaction, customer account or account activity that may be attached to or contained in this communication. CTC accepts no liability for any content contained in the email, or any errors or omissions arising as a result of e-mail transmission. Any opinions contained in this email constitute the sender's best judgment at this time and are subject to change without notice.
More information about the R-SIG-Finance
mailing list