Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[R-Forge #5782] Japanese stock market support #14

Closed
joshuaulrich opened this issue Jan 31, 2015 · 0 comments
Closed

[R-Forge #5782] Japanese stock market support #14

joshuaulrich opened this issue Jan 31, 2015 · 0 comments

Comments

@joshuaulrich
Copy link
Owner

Submitted by: Wouter Thielen
Assigned to: Joshua Ulrich
R-Forge link

There is a different R package called RFinanceYJ:
https://code.google.com/p/rfinanceyj/

It does not work. There are some issues. I checked its source code, and have thought about improving it, and adding it to your more global quantmod package.

For reference, my current stock information download code, which is in PHP, is on github:
https://github.com/wthielen/YJStocks/blob/master/download-stocks

I'd like to see a getSymbols.YahooJ function in quantmod. Let me know if I can help.

Followups:

Date: 2014-12-13 10:30
Sender: Wouter Thielen
OK cool! Looking forward to that release then. Thanks for adding my code!

Date: 2014-12-13 01:05
Sender: Joshua Ulrich
I made a few minor adjustments and committed your changes in r624. I'm not going to include this in the package I send to CRAN in a couple days, because of a couple items:

  1. I'd like to try and make it faster, and
  2. it should only adjust for splits/dividends if adjust=TRUE.

I expect to make another CRAN submission in 2-3 months, once I'm able to fully fix the getOptionChain.yahoo function. I will include these changes at that time.

With the addition of your code, I'm closing this request. Thanks for your contribution!

Date: 2014-12-12 15:12
Sender: Wouter Thielen
Please see the YahooJ.zip attachment. I have included:

  • a .diff file that you can patch into your source tree
  • the complete getSymbols.R and getSymbols.yahooj.Rd files

If you examine the .diff file, you'll also see that there is an addition of XML to pkg/DESCRIPTION's 'Suggests:' line, so please do not forget this one.

Some ticker symbols you can use to test:

  • Nikkei 225: 998407.O
  • Sony: 6758.T
  • McDonalds Japan: 2702.T
  • Nintendo: 7974.T
  • To test stock splits: Biccamera: 3048.T (had a stock split in Feb 2014)

I haven't tested with currency symbols (USDJPY=X) and other funny stuff (^GSPC, ^IXIC) yet. I believe most people would use the US Yahoo for that anyway.

Date: 2014-12-11 14:28
Sender: Wouter Thielen
Just updated the Rd file, and noticed that I need to change some stuff a bit. Yahoo Japan tickers start with a number, and I actually store them in the environment by pasting 'YJ' in front of it. However, getSymbolLookup and setSymbolLookup don't work well with these, so I have to update the code a bit, and actually have people add 'YJ' in front of their Japanese tickers, so that getSymbols can do a proper lookup.

This will be explained in the Rd file as well.

If you have a better idea, please let me know.

Date: 2014-12-10 15:07
Sender: Joshua Ulrich
Thanks for the update. That timing works great. I aiming to push quantmod to CRAN early next week, and it would be nice to include this. I'd also appreciate any testing you could do on the revision you just checked out.

Date: 2014-12-10 15:05
Sender: Wouter Thielen
Update: I actually did a svn checkout, and the visible global definition stuff disappeared indeed on the others. I'll check out the MySQL one, edit the Rd file, and send you a svn diff/patch tomorrow or something (past midnight here now). Does that work for you?

Date: 2014-12-10 15:01
Sender: Joshua Ulrich
Don't worry about the newlines. They appear in the emails I receive.

There should not longer be any 'no visible global definition for ' notes in the latest revision. Look at getSymbols.MySQL for an example of how to require(XML) and avoid the notes. XML will need to be added to the Suggests list, so running with R_CHECK_FORCE_SUGGESTS=0 might not be the best idea... but I will do that, so don't worry about it if it's a large hassle for you.

Copying and editing man/getSymbols.yahoo.Rd should be fine. You can simply attach the files to this ticket.

Thanks!

Date: 2014-12-10 14:55
Sender: Wouter Thielen
Cripes! Does this site not do a nl2br()?! Hope you can read the comment without newlines...

Date: 2014-12-10 14:54
Sender: Wouter Thielen

  • checking R files for non-ASCII characters ... OK

Fixed this one at least.
I see notes though, about 'no visible global definition for htmlParse' for example. I see these notes in other getSymbols.* functions as well such as functions definitions for dbSendQuery etc.

Couple of questions:

  • I ran the CMD check with R_CHECK_FORCE_SUGGESTS set to 0. Is this acceptable?
  • Is there any place I should add a require(XML) for the HTML/XML parsing functions?
  • Is it okay to copy the getSymbols.yahoo.Rd file and edit it as appropriately for the yahooj one?
  • How do I send the updates to you?

Date: 2014-12-10 08:51
Sender: Wouter Thielen
Cool. Just looked up on .Rd files and the CMD check, and will do these this week, and fix any issues that may arise.

Date: 2014-12-07 22:53
Sender: Joshua Ulrich
I think this could be included in quantmod, but it will need a .Rd file and I'm not sure that the Japanese characters in the function on your GitHub account will pass R CMD check. Can you create a .Rd file and see if your function passes check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant