AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

FUNCTION: Gettickerbyfile()--Get full list of Nasdaq stocks

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
philz



Joined: 05 Jun 2007
Posts: 87
Location: USA

PostPosted: Sun Dec 16, 2007 2:04 pm    Post subject: FUNCTION: Gettickerbyfile()--Get full list of Nasdaq stocks Reply with quote

I wrote two different methods for doing this. One using Urldownloadtovar, the other using urldownloadtofile. I think the latter is faster. Both end up with the same thing. A complete comma delimited list of stocks in the nasdaq. This may go well with nerdyguy's script

Code:
gettickerbyfile()
{
   URLDownloadToFile, http://www.nasdaqtrader.com/dynamic/SymDir/nasdaq.txt, raw.list
   Loop, Read, raw.list
   {
      if(A_index=1)
         continue
      else if(a_index=2)
         liststring := substr(a_loopreadline,1,instr(A_loopreadline,"|")-1)
      else liststring := liststring ", " substr(a_loopreadline,1,instr(A_loopreadline,"|")-1)
   }
   Loop,  2
      liststring := substr(liststring,1,instr(liststring,",",FALSE,0)-1)
   FileDelete,  raw.list
   return,  %liststring%
}

gettickerbyvar()
{
   info := urldownloadtovar("http://www.nasdaqtrader.com/dynamic/SymDir/nasdaq.txt")
   Loop,  Parse, info, `n
   {
      ;SplashTextOn,  500, 40, Line %A_index%, %a_loopfield%
      if(A_index=1)
         continue
      else if(a_index=2)
         liststring := substr(a_loopfield,1,instr(a_loopfield,"|")-1)
      else liststring := liststring ", " substr(a_loopfield,1,instr(a_loopfield,"|")-1)
   }
   Loop,  2
      liststring := substr(liststring,1,instr(liststring,",",FALSE,0)-1)
   return,  %liststring%
}
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group