veswill3 / InvestmentSimulator

toying with some ideas in matlab
0 stars 0 forks source link

Issue loading stock data #9

Open heiden12 opened 11 years ago

heiden12 commented 11 years ago

Not all tickers follow the url pattern we are using:('http://www.netfonds.se/quotes/tradedump.php?paper='...,ticker,'.O&csv_format=csv'));

The issue is the ".O" section. It looks like nasdaq stocks use ".O" and stocks in the NYSE are using ".N"

Need a way to fix this.

veswill3 commented 11 years ago

It looks like the options are O for Nasdaq, N for Nyse and A for Amex I guess we should just do all 3 and have a try catch around to bail if it does not work.

heiden12 commented 11 years ago

I thought of two ways to do this:

Method 1: Create a table that contains the tickers and their exchange and use this table to determine which letter to use in the url.

Method 2: Use the Matlab built in function stringlib::contains* to check if the webpage contains "Denna aktie finns inte" (this is the text the site displays when you choose an invalid ticker). Combine this function with an if statement to be able to handle each case ( Nasdaq, Amex, NYSE).

Method one will be faster because it will only be going out to the web once for each stock and Method two could have to go out to the web up to three times for each stock. However, Method one will require us to manually maintain a separate table.

*http://www.mathworks.com/help/symbolic/mupad_ref/stringlib-contains.html

veswill3 commented 11 years ago

I think we should save the info about which exchange the ticker is on. We can just make something quick to output the info and then save it. Should be pretty easy

heiden12 commented 11 years ago

So, are you thinking something like Method 2 where it goes out to the website but then when it finds the right url it would save that info so it will not have to go out to the web for each ticker after the initial check?

veswill3 commented 11 years ago

yeah, or we can just write up a script to figure that out specifically first