[R-SIG-Finance] CUSIP Numbers

Anshul Pandey anshul.bits at gmail.com
Thu Jan 22 04:11:04 CET 2015


Thank you all for the reply.
This is very helpful.

I am going through the Bloomberg Open Symbology. Looks like CUSIP and SEDOL
are becoming popular (the last 3 hedge funds I talked to mentioned one of
these two), so it would be nice to see what Bloomberg has to offer.

James, you raised a very valid concern. I will keep that in mind while
setting up my production system.

Best Regards
Anshul

On Thu, Jan 22, 2015 at 3:55 AM, G See <gsee000 at gmail.com> wrote:

> Since this is an R mailing list, I'll try to bring this thread back on
> topic.  Unless you are willing to pay, the only free source that I am
> aware of to get CUSIPs via R is TradeKing.
> https://developers.tradeking.com/documentation/market-ext-quotes-get-post
>
> You must have an account, but you can create an account for free and
> you don't have to fund it in order to do this.
>
>
> library(ROAuth) #importFrom(ROAuth, OAuthFactory)
> library(RJSONIO) #importFrom(RJSONIO, fromJSON)
>
> #' ## This part could go in your .Rprofile
> #' # Set your application keys #
> https://developers.tradeking.com/applications
> #' cKey <- '################'
> #' cSecret <- '#################'
> #' oKey <- '################'
> #' oSecret <- '################'
>
> # Set the API endpoint
> tkURL <- "https://api.tradeking.com/v1/market/ext/quotes.json"
>
> # Create the OAuth connection - this is straight from the ROAuth
> documentation on CRAN
> credentials <- OAuthFactory$new(consumerKey=cKey,
>                                 consumerSecret=cSecret,
>                                 oauthKey = oKey,
>                                 oauthSecret = oSecret,
>                                 needsVerifier=FALSE,
>                                 signMethod='HMAC')
> # Update the connection so the handshake is TRUE
> credentials$handshakeComplete <- TRUE
>
> Symbols <- tolower(c("AAPL", "MSFT")) ## Whatever symbols you want
> symbols <- paste(Symbols, collapse=",")
>
> #what <- "datetime,bidsz,bid,ask,asksz,last,chg,pchg,opn,hi,lo,vl"
> what <- "cusip"
> what <- gsub(" ", "", tolower(paste(unlist(strsplit(what, ",")),
>                                       collapse=",")))
> tkURL <- "https://api.tradeking.com/v1/market/ext/quotes.json"
> query <- list(symbols=symbols, fids=what)
> response <- credentials$OAuthRequest(tkURL, query)
> res <- fromJSON(response)
> qt <- res$response$quotes$quote
> qt
>
> #[[1]]
> #     cusip       exch     symbol
> #"59491810"     "NASD"     "MSFT"
> #
> #[[2]]
> #     cusip       exch     symbol
> #"03783310"     "NASD"     "AAPL"
>
> HTH,
> Garrett
>



-- 
Anshul Vikram Pandey
+1-929-231-6784
home: www.anshulvp.com
thoughts: www.anshulvp.com/blog
contact: anshul.bits at gmail.com, hello at anshulvp.com

	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list