[R-SIG-FINANCE] Low Priority - market component list and general coding help

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[R-SIG-FINANCE] Low Priority - market component list and general coding help

Martin Jenkins-3
Hi,

I've searched around and not found anything to help on this, even though it's not the first time it's been asked, so was wondering if anyone had any new ideas.

I really like the device output of the chartSeries function and so have used it to output a bitmap of the stock chart.  What I'm using it for is to get an entire market index component list, however to get that I've had to create my own flat file called masterlist.csv in the below code.  Ideally I'd like to have a function do the same job so I don't have to create the file manually.  This way I can quickly and easily get graphs for an entire stock market.

Rather frustratingly Yahoo! have stopped allowing the component list for an index to be downloaded.

Also as you can see my coding skills are restricted by my procedural background, so whilst the below works fine, I'm sure it can be written more efficiently.

One last thing, I'm using the auto.assign = FALSE so that I can use a variable in chartseries, this leaves me with the name of my variable, in this case 'x', on the bitmap, which isn't ideal, meaning I have to refer to the filename for the epic.

Many thanks,
Martin

library(quantmod)

masterfile <- "C:/Users/Admin/Documents/Programming/R/current/FTSE100/masterlist.csv"
path <- "C:/Users/Admin/Documents/Programming/R/ftse100bmps/"
epicstable <- read.table(masterfile, header=FALSE, sep=",")

i <- 1
while(is.na(epicstable$V1[i]) == "FALSE")
{
  epic_char <- as.character(epicstable$V1[i])
  x <- try(getSymbols(epic_char, auto.assign=FALSE))
  
  if (length(x)==1)
  {
    x <- try(getSymbols(epic_char, src = "google", auto.assign=FALSE))
  }
  
  if (length(x) > 1)
  {
    outputfile <- paste(path, epicstable$V1[i], '.bmp')
    chartSeries(x,subset='2011-01::2012',TA="addVo();addMACD()")
    bmp(file=outputfile, bg = "transparent", width = 1024, height = 768)
    dev.off()
  }
  i = i + 1
}
        [[alternative HTML version deleted]]


_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: [R-SIG-FINANCE] Low Priority - market component list and general coding help

Martin Jenkins-3



There's an error in my code, please see the amendment:

library(quantmod)

masterfile <- "C:/Users/Admin/Documents/Programming/R/current/FTSE100/masterlist.csv"
path <- "C:/Users/Admin/Documents/Programming/R/ftse100bmps/"
epicstable <- read.table(masterfile, header=FALSE, sep=",")

i <- 1
while(is.na(epicstable$V1[i]) == "FALSE")
{
  epic_char <- as.character(epicstable$V1[i])
  x <- try(getSymbols(epic_char, auto.assign=FALSE))
  
  if (length(x)==1)
  {
    x <- try(getSymbols(epic_char, src = "google", auto.assign=FALSE))
  }
  
  if (length(x) > 1)
  {
    outputfile <- paste(path, epicstable$V1[i], '.bmp')
    bmp(file=outputfile, bg = "transparent", width = 1024, height = 768)
    chartSeries(x,subset='2011-01::2012',TA="addVo();addMACD()")
    dev.off()
  }
  i = i + 1
}


________________________________

To: "[hidden email]" <[hidden email]>
Sent: Friday, 26 October 2012, 20:01
Subject: [R-SIG-Finance] [R-SIG-FINANCE] Low Priority - market component list and general coding help

Hi,

I've searched around and not found anything to help on this, even though it's not the first time it's been asked, so was wondering if anyone had any new ideas.

I really like the device output of the chartSeries function and so have used it to output a bitmap of the stock chart.  What I'm using it for is to get an entire market index component list, however to get that I've had to create my own flat file called masterlist.csv in the below code.  Ideally I'd like to have a function do the same job so I don't have to create the file manually.  This way I can quickly and easily get graphs for an entire stock market.

[[elided Yahoo spam]]
 index to be downloaded.

Also as you can see my coding skills are restricted by my procedural background, so whilst the below works fine, I'm sure it can be written more efficiently.

One last thing, I'm using the auto.assign = FALSE so that I can use a variable in chartseries, this leaves me with the name of my variable, in this case 'x', on the bitmap, which isn't ideal, meaning I have to refer to the filename for the epic.

Many thanks,
Martin

library(quantmod)

masterfile <- "C:/Users/Admin/Documents/Programming/R/current/FTSE100/masterlist.csv"
path <- "C:/Users/Admin/Documents/Programming/R/ftse100bmps/"
epicstable <- read.table(masterfile, header=FALSE, sep=",")

i <- 1
while(is.na(epicstable$V1[i]) == "FALSE")
{
  epic_char <- as.character(epicstable$V1[i])
  x <- try(getSymbols(epic_char, auto.assign=FALSE))
  
  if (length(x)==1)
  {
    x <- try(getSymbols(epic_char, src = "google", auto.assign=FALSE))
  }
  
  if (length(x) > 1)
  {
    outputfile <- paste(path, epicstable$V1[i], '.bmp')
    chartSeries(x,subset='2011-01::2012',TA="addVo();addMACD()")
    bmp(file=outputfile, bg = "transparent", width = 1024, height = 768)
    dev.off()
  }
  i = i + 1
}
    [[alternative HTML version deleted]]


_______________________________________________
[hidden email] 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]]


_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: [R-SIG-FINANCE] Low Priority - market component list and general coding help

gsee
In reply to this post by Martin Jenkins-3
Hi Martin,

comments in-line.

On Fri, Oct 26, 2012 at 2:01 PM, Martin Jenkins <[hidden email]> wrote:
> Hi,
>
> I've searched around and not found anything to help on this, even though it's not the first time it's been asked, so was wondering if anyone had any new ideas.
>
> I really like the device output of the chartSeries function and so have used it to output a bitmap of the stock chart.  What I'm using it for is to get an entire market index component list, however to get that I've had to create my own flat file called masterlist.csv in the below code.  Ideally I'd like to have a function do the same job so I don't have to create the file manually.  This way I can quickly and easily get graphs for an entire stock market.
>
> Rather frustratingly Yahoo! have stopped allowing the component list for an index to be downloaded.

If you just want a list of most stocks, use TTR::stockSymbols()

    R> head(stockSymbols()$Symbol)
    Fetching AMEX symbols...
    Fetching NASDAQ symbols...
    Fetching NYSE symbols...
    [1] "AA-P" "AAU"  "ACU"  "ACY"  "ADGE" "ADK"

If the holdings of ETFs will suffice, you can use getHoldings from my
qmao package on R-Forge
(https://r-forge.r-project.org/R/?group_id=1113)

    R> #install.packages("qmao", repos='http://r-forge.r-project.org')
    R> library(qmao)
    R> rownames(getHoldings("SPY", auto.assign=FALSE))

If you want components of specific indexes, you might look through the
code from systematic investor
https://github.com/systematicinvestor/SIT/blob/master/R/data.r

I haven't used any of that code, but the file I linked to above
appears to get the Symbols of stocks for different indexes.

> Also as you can see my coding skills are restricted by my procedural background, so whilst the below works fine, I'm sure it can be written more efficiently.
>
> One last thing, I'm using the auto.assign = FALSE so that I can use a variable in chartseries, this leaves me with the name of my variable, in this case 'x', on the bitmap, which isn't ideal, meaning I have to refer to the filename for the epic.
>

You can simply provide a "name" argument to chartSeries()

    R> s <- "AAPL"
    R> chartSeries(getSymbols(s, src='google', auto.assign=FALSE), name=s)

Just curious, why use src='google' ?  I've found yahoo's data to be
slightly more reliable.

HTH,
Garrett

> Many thanks,
> Martin
>
> library(quantmod)
>
> masterfile <- "C:/Users/Admin/Documents/Programming/R/current/FTSE100/masterlist.csv"
> path <- "C:/Users/Admin/Documents/Programming/R/ftse100bmps/"
> epicstable <- read.table(masterfile, header=FALSE, sep=",")
>
> i <- 1
> while(is.na(epicstable$V1[i]) == "FALSE")
> {
>   epic_char <- as.character(epicstable$V1[i])
>   x <- try(getSymbols(epic_char, auto.assign=FALSE))
>
>   if (length(x)==1)
>   {
>     x <- try(getSymbols(epic_char, src = "google", auto.assign=FALSE))
>   }
>
>   if (length(x) > 1)
>   {
>     outputfile <- paste(path, epicstable$V1[i], '.bmp')
>     chartSeries(x,subset='2011-01::2012',TA="addVo();addMACD()")
>     bmp(file=outputfile, bg = "transparent", width = 1024, height = 768)
>     dev.off()
>   }
>   i = i + 1
> }
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> [hidden email] 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.

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: [R-SIG-FINANCE] Low Priority - market component list and general coding help

Jeffrey Ryan
In reply to this post by Martin Jenkins-3
Somewhat contrary to common sense, index components are usually
legally controlled by its respective owner/creator.  The result is
that it becomes illegal to make the list 'available'.

Obviously this varies, and I am not a lawyer, but that is the likely
reason behind the inability to download.  There are likely ways around
this of course...

With respect to chartSeries, I am working on getting chart_Series and
it's related add_ functionality 'complete', that is so one can
transition from chartSeries to the new version (which during the
transition will be called chart_Series, note the underscore)

Since you are only using addVo and addMACD here, you can do
chart_Series and add_Vo, add_MACD and will get much prettier graphics.
 They will also be able to be embedded in standard layout() and
pars(mfcol= type layouts. i.e. the full graphic with panels etc
becomes one graphic object (like plot()).  Again, prettier and more
useful.

W.r.t the name of the chart, try name=

HTH
Jeff

On Fri, Oct 26, 2012 at 2:01 PM, Martin Jenkins <[hidden email]> wrote:

> Hi,
>
> I've searched around and not found anything to help on this, even though it's not the first time it's been asked, so was wondering if anyone had any new ideas.
>
> I really like the device output of the chartSeries function and so have used it to output a bitmap of the stock chart.  What I'm using it for is to get an entire market index component list, however to get that I've had to create my own flat file called masterlist.csv in the below code.  Ideally I'd like to have a function do the same job so I don't have to create the file manually.  This way I can quickly and easily get graphs for an entire stock market.
>
> Rather frustratingly Yahoo! have stopped allowing the component list for an index to be downloaded.
>
> Also as you can see my coding skills are restricted by my procedural background, so whilst the below works fine, I'm sure it can be written more efficiently.
>
> One last thing, I'm using the auto.assign = FALSE so that I can use a variable in chartseries, this leaves me with the name of my variable, in this case 'x', on the bitmap, which isn't ideal, meaning I have to refer to the filename for the epic.
>
> Many thanks,
> Martin
>
> library(quantmod)
>
> masterfile <- "C:/Users/Admin/Documents/Programming/R/current/FTSE100/masterlist.csv"
> path <- "C:/Users/Admin/Documents/Programming/R/ftse100bmps/"
> epicstable <- read.table(masterfile, header=FALSE, sep=",")
>
> i <- 1
> while(is.na(epicstable$V1[i]) == "FALSE")
> {
>   epic_char <- as.character(epicstable$V1[i])
>   x <- try(getSymbols(epic_char, auto.assign=FALSE))
>
>   if (length(x)==1)
>   {
>     x <- try(getSymbols(epic_char, src = "google", auto.assign=FALSE))
>   }
>
>   if (length(x) > 1)
>   {
>     outputfile <- paste(path, epicstable$V1[i], '.bmp')
>     chartSeries(x,subset='2011-01::2012',TA="addVo();addMACD()")
>     bmp(file=outputfile, bg = "transparent", width = 1024, height = 768)
>     dev.off()
>   }
>   i = i + 1
> }
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> [hidden email] 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.



--
Jeffrey Ryan
[hidden email]

www.lemnica.com

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: [R-SIG-FINANCE] Low Priority - market component list and general coding help

Martin Jenkins-3
In reply to this post by gsee
Thanks for the reply.  The src == google is purely in case yahoo fails, I'm using length of 1 to be an error.  I should have commented the code, apologies.

Is it possible to get FTSE (UK market data)?  I'm thinking I can bring back all the symbols, look at the market cap, sort ascending and use that to carve up the index into ftse 100, ftse250 etc etc.


________________________________
 From: G See <[hidden email]>

Cc: "[hidden email]" <[hidden email]>
Sent: Friday, 26 October 2012, 20:32
Subject: Re: [R-SIG-Finance] [R-SIG-FINANCE] Low Priority - market component list and general coding help

Hi Martin,

comments in-line.


> Hi,
>
> I've searched around and not found anything to help on this, even though it's not the first time it's been asked, so was wondering if anyone had any new ideas.
>
> I really like the device output of the chartSeries function and so have used it to output a bitmap of the stock chart.  What I'm using it for is to get an entire market index component list, however to get that I've had to create my own flat file called masterlist.csv in the below code.  Ideally I'd like to have a function do the same job so I don't have to create the file manually.  This way I can quickly and easily get graphs for an entire stock market.
>
[[elided Yahoo spam]]
an index to be downloaded.

If you just want a list of most stocks, use TTR::stockSymbols()

    R> head(stockSymbols()$Symbol)
    Fetching AMEX symbols...
    Fetching NASDAQ symbols...
    Fetching NYSE symbols...
    [1] "AA-P" "AAU"  "ACU"  "ACY"  "ADGE" "ADK"

If the holdings of ETFs will suffice, you can use getHoldings from my
qmao package on R-Forge
(https://r-forge.r-project.org/R/?group_id=1113)

    R> #install.packages("qmao", repos='http://r-forge.r-project.org')
    R> library(qmao)
    R> rownames(getHoldings("SPY", auto.assign=FALSE))

If you want components of specific indexes, you might look through the
code from systematic investor
https://github.com/systematicinvestor/SIT/blob/master/R/data.r

I haven't used any of that code, but the file I linked to above
appears to get the Symbols of stocks for different indexes.

> Also as you can see my coding skills are restricted by my procedural background, so whilst the below works fine, I'm sure it can be written more efficiently.
>
> One last thing, I'm using the auto.assign = FALSE so that I can use a variable in chartseries, this leaves me with the name of my variable, in this case 'x', on the bitmap, which isn't ideal, meaning I have to refer to the filename for the epic.
>

You can simply provide a "name" argument to chartSeries()

    R> s <- "AAPL"
    R> chartSeries(getSymbols(s, src='google', auto.assign=FALSE), name=s)

Just curious, why use src='google' ?  I've found yahoo's data to be
slightly more reliable.

HTH,
Garrett

> Many thanks,
> Martin
>
> library(quantmod)
>
> masterfile <- "C:/Users/Admin/Documents/Programming/R/current/FTSE100/masterlist.csv"
> path <- "C:/Users/Admin/Documents/Programming/R/ftse100bmps/"
> epicstable <- read.table(masterfile, header=FALSE, sep=",")
>
> i <- 1
> while(is.na(epicstable$V1[i]) == "FALSE")
> {
>   epic_char <- as.character(epicstable$V1[i])
>   x <- try(getSymbols(epic_char, auto.assign=FALSE))
>
>   if (length(x)==1)
>   {
>     x <- try(getSymbols(epic_char, src = "google", auto.assign=FALSE))
>   }
>
>   if (length(x) > 1)
>   {
>     outputfile <- paste(path, epicstable$V1[i], '.bmp')
>     chartSeries(x,subset='2011-01::2012',TA="addVo();addMACD()")
>     bmp(file=outputfile, bg = "transparent", width = 1024, height = 768)
>     dev.off()
>   }
>   i = i + 1
> }
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> [hidden email] 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]]


_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: [R-SIG-FINANCE] Low Priority - market component list and general coding help

Martin Jenkins-3
In reply to this post by Jeffrey Ryan
Thanks.  That explanation makes sense, although it's still annoying.  I used to have everything in a relatively easy piece of code which could bring back whichever market I wanted all in one go with little manual effort.

The name code works, ta.

    chartSeries(x,subset='2011-01::2012',TA="addVo();addMACD()", name = epic_char)


I've just updated my install to 3-13, but it's still keeping 3-9... am I being really dim?


________________________________
 From: Jeff Ryan <[hidden email]>

Cc: "[hidden email]" <[hidden email]>
Sent: Friday, 26 October 2012, 20:33
Subject: Re: [R-SIG-Finance] [R-SIG-FINANCE] Low Priority - market component list and general coding help

Somewhat contrary to common sense, index components are usually
legally controlled by its respective owner/creator.  The result is
that it becomes illegal to make the list 'available'.

Obviously this varies, and I am not a lawyer, but that is the likely
reason behind the inability to download.  There are likely ways around
this of course...

With respect to chartSeries, I am working on getting chart_Series and
it's related add_ functionality 'complete', that is so one can
transition from chartSeries to the new version (which during the
transition will be called chart_Series, note the underscore)

Since you are only using addVo and addMACD here, you can do
chart_Series and add_Vo, add_MACD and will get much prettier graphics.
They will also be able to be embedded in standard layout() and
pars(mfcol= type layouts. i.e. the full graphic with panels etc
becomes one graphic object (like plot()).  Again, prettier and more
useful.

W.r.t the name of the chart, try name=

HTH
Jeff


> Hi,
>
> I've searched around and not found anything to help on this, even though it's not the first time it's been asked, so was wondering if anyone had any new ideas.
>
> I really like the device output of the chartSeries function and so have used it to output a bitmap of the stock chart.  What I'm using it for is to get an entire market index component list, however to get that I've had to create my own flat file called masterlist.csv in the below code.  Ideally I'd like to have a function do the same job so I don't have to create the file manually.  This way I can quickly and easily get graphs for an entire stock market.
>
[[elided Yahoo spam]]
an index to be downloaded.

>
> Also as you can see my coding skills are restricted by my procedural background, so whilst the below works fine, I'm sure it can be written more efficiently.
>
> One last thing, I'm using the auto.assign = FALSE so that I can use a variable in chartseries, this leaves me with the name of my variable, in this case 'x', on the bitmap, which isn't ideal, meaning I have to refer to the filename for the epic.
>
> Many thanks,
> Martin
>
> library(quantmod)
>
> masterfile <- "C:/Users/Admin/Documents/Programming/R/current/FTSE100/masterlist.csv"
> path <- "C:/Users/Admin/Documents/Programming/R/ftse100bmps/"
> epicstable <- read.table(masterfile, header=FALSE, sep=",")
>
> i <- 1
> while(is.na(epicstable$V1[i]) == "FALSE")
> {
>   epic_char <- as.character(epicstable$V1[i])
>   x <- try(getSymbols(epic_char, auto.assign=FALSE))
>
>   if (length(x)==1)
>   {
>     x <- try(getSymbols(epic_char, src = "google", auto.assign=FALSE))
>   }
>
>   if (length(x) > 1)
>   {
>     outputfile <- paste(path, epicstable$V1[i], '.bmp')
>     chartSeries(x,subset='2011-01::2012',TA="addVo();addMACD()")
>     bmp(file=outputfile, bg = "transparent", width = 1024, height = 768)
>     dev.off()
>   }
>   i = i + 1
> }
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> [hidden email] 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.


--
Jeffrey Ryan
[hidden email]

www.lemnica.com
        [[alternative HTML version deleted]]


_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: [R-SIG-FINANCE] Low Priority - market component list and general coding help

Martin Jenkins-3
Ryan, I've got the code running using the new quantmod, although it's outputting blank bitmaps.  As soon as I remove the underscores and run the old code it runs fine.  Am I missing something?



________________________________

To: "[hidden email]" <[hidden email]>
Sent: Friday, 26 October 2012, 21:31
Subject: Re: [R-SIG-Finance] [R-SIG-FINANCE] Low Priority - market component list and general coding help

Thanks.  That explanation makes sense, although it's still annoying.  I used to have everything in a relatively easy piece of code which could bring back whichever market I wanted all in one go with little manual effort.

The name code works, ta.

    chartSeries(x,subset='2011-01::2012',TA="addVo();addMACD()", name = epic_char)


I've just updated my install to 3-13, but it's still keeping 3-9... am I being really dim?


________________________________
From: Jeff Ryan <[hidden email]>

Cc: "[hidden email]" <[hidden email]>
Sent: Friday, 26 October 2012, 20:33
Subject: Re: [R-SIG-Finance] [R-SIG-FINANCE] Low Priority - market component list and general coding help

Somewhat contrary to common sense, index components are usually
legally controlled by its respective owner/creator.  The result is
that it becomes illegal to make the list 'available'.

Obviously this varies, and I am not a lawyer, but that is the likely
reason behind the inability to download.  There are likely ways around
this of course...

With respect to chartSeries, I am working on getting chart_Series and
it's related add_ functionality 'complete', that is so one can
transition from chartSeries to the new version (which during the
transition will be called chart_Series, note the underscore)

Since you are only using addVo and addMACD here, you can do
chart_Series and add_Vo, add_MACD and will get much prettier graphics.
They will also be able to be embedded in standard layout() and
pars(mfcol= type layouts. i.e. the full graphic with panels etc
becomes one graphic object (like plot()).  Again, prettier and more
useful.

W.r.t the name of the chart, try name=

HTH
Jeff


> Hi,
>
> I've searched around and not found anything to help on this, even though it's not the first time it's been asked, so was wondering if anyone had any new ideas.
>
> I really like the device output of the chartSeries function and so have used it to output a bitmap of the stock chart.  What I'm using it for is to get an entire market index component list, however to get that I've had to create my own flat file called masterlist.csv in the below code.  Ideally I'd like to have a function do the same job so I don't have to create the file manually.  This way I can quickly and easily get graphs for an entire stock market.
>
[[elided Yahoo spam]]
an index to be downloaded.

>
> Also as you can see my coding skills are restricted by my procedural background, so whilst the below works fine, I'm sure it can be written more efficiently.
>
> One last thing, I'm using the auto.assign = FALSE so that I can use a variable in chartseries, this leaves me with the name of my variable, in this case 'x', on the bitmap, which isn't ideal, meaning I have to refer to the filename for the epic.
>
> Many thanks,
> Martin
>
> library(quantmod)
>
> masterfile <- "C:/Users/Admin/Documents/Programming/R/current/FTSE100/masterlist.csv"
> path <- "C:/Users/Admin/Documents/Programming/R/ftse100bmps/"
> epicstable <- read.table(masterfile, header=FALSE, sep=",")
>
> i <- 1
> while(is.na(epicstable$V1[i]) == "FALSE")
> {
>   epic_char <- as.character(epicstable$V1[i])
>   x <- try(getSymbols(epic_char, auto.assign=FALSE))
>
>   if (length(x)==1)
>   {
>     x <- try(getSymbols(epic_char, src = "google", auto.assign=FALSE))
>   }
>
>   if (length(x) > 1)
>   {
>     outputfile <- paste(path, epicstable$V1[i], '.bmp')
>     chartSeries(x,subset='2011-01::2012',TA="addVo();addMACD()")
>     bmp(file=outputfile, bg = "transparent", width = 1024, height = 768)
>     dev.off()
>   }
>   i = i + 1
> }
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> [hidden email] 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.


--
Jeffrey Ryan
[hidden email]

www.lemnica.com
    [[alternative HTML version deleted]]


_______________________________________________
[hidden email] 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]]


_______________________________________________
[hidden email] 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.
Db
Reply | Threaded
Open this post in threaded view
|

Re: [R-SIG-FINANCE] Low Priority - market component list and general coding help

Db
In reply to this post by Martin Jenkins-3
Here is some code to get all listed stocks on the Hongkong StockExchange Mainboard
with stock codes ready to be fed into quantmod :

http://pastebin.com/mt1gfyvy

Db