Created
August 7, 2016 02:21
-
-
Save lloydroc/6048394a47f5360e99832c8f79a2474a to your computer and use it in GitHub Desktop.
Parses all non-ETF tickers from the NASDAQ FTP server, has other exchanges like ETFs as well
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Nasdaq Traded|Symbol|Security Name|Listing Exchange|Market Category|ETF|Round Lot Size|Test Issue|Financial Status|CQS Symbol|NASDAQ Symbol|NextShares | |
// 1 - Nasdaq Traded | |
// 2 - Symbol | |
// 3 - Security Name | |
// 4 - Listing Exchange | |
// 5 - Market Category | |
// 6 - ETF | |
// 7 - Round Lot Size | |
// 8 - Test Issue | |
// 9 - Financial Status | |
// 10 - CQS Symbol | |
// 11 - NASDAQ Symbol | |
// 12 - NextShares | |
object TickerParser extends App { | |
val lineIter = scala.io.Source.fromFile("nasdaqtraded.txt").getLines | |
val tickers = lineIter.collect{_.split("\\|") match { case Array(a,b,c,d,e,f,g,h,i,j,k,l) => (a,b,c,d,e,f,g,h,i,j,k,l)}}.toList | |
// Stocks have ETF == "N" | |
val stocks = tickers.filter(_._6=="N").toList | |
println(s"Total tickers ${tickers.size}, Stocks = ${stocks.size}") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See https://gist.github.com/lloydroc/6f01ee8afa2eab8f4eb92263bbf4ccc4 on how to download the nasdaqtraded.txt file.