[R-SIG-Finance] Fwd: dataset to xts conversion issue with timeseries data
Ilya Kipnis
ilya.kipnis at gmail.com
Fri May 13 07:09:18 CEST 2016
Aritra,
The underlying data structure of an xts is a matrix. If you have a
character vector inside that matrix, the entire thing will become
characters. In your example, you have stockName and type vectors, which are
character vectors, whereas in the excel example, you don't. Hope that helps.
-Ilya
On Fri, May 13, 2016 at 12:31 AM, Aritra Pan <
aritrapan at vgsom.iitkgp.ernet.in> wrote:
> Sorry, if it is becoming duplicate message. Any suggestion will be highly
> appreciated.
>
> --
> Thanks,
> Aritra
>
> ----- Original Message -----
>
> From: "Aritra Pan" <aritrapan at vgsom.iitkgp.ernet.in>
> To: "R-SIG-Finance" <r-sig-finance-bounces at r-project.org>
> Sent: Thursday, May 12, 2016 11:28:41 AM
> Subject: [R-SIG-Finance] dataset to xts conversion issue with timeseries
> data
>
> Hello Members,
>
> I am hoping if I can get few suggestions on the issue I am facing.
>
> I am taking data from server using Rblpapi package for 40-50 securities.
> The data looks like below:
>
> times askValue askSize stockName Type
> 01/02/2016 9:15 91.8 500 ABCD IS Equity Ask
> 01/02/2016 9:15 92.4 1420 ABCD IS Equity Ask
> 01/02/2016 9:15 92.2 5000 ABCD IS Equity Ask
> 01/02/2016 9:15 91.9 6524 ABCD IS Equity Ask
> 01/02/2016 9:15 91.9 11524 ABCD IS Equity Ask
> 01/02/2016 9:15 92.05 6824 ABCD IS Equity Ask
>
> ABCD IS - any 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
>
> askValue askSize 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.
>
> Date Type Price 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
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance at 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]]
More information about the R-SIG-Finance
mailing list