Retrieving Weather

I spent part of my Saturday looking at why the Futures Pricing wasn’t working. I had a complicated SQL query that took forever that tried to pull the latest date and its weather forecast. It took over 60 secs to run (for each security) and worse, it didn’t work.

A new query was instantaneous and populates with the last forecast made after the date (what one would expect is the actual weather). I’m assuming and still need to confirm that. I also wrote in code to not abuse Weather Underground – no more than 10 per minute with a maximum of 500 active cities per day – otherwise I should actually pay them something.

UPDATE: the rainfall (or wind/temp) is based on the previous day’s forecast, not the actual. I still need to fix that, otherwise it only encourages those who guess what the future forecast will be, rather than what the actual weather becomes.