[localhost:~]$ cat * > /dev/ragfield

Wednesday, May 26, 2010

Power Smart Pricing

Ameren Illinois Utilities Power Smart Pricing data is available in tabular form on the web. This function will scrape that data and return the rate in US dollars for a given date/time. My friend John wanted to use this data for something I didn't quite understand...

Date[]
{2010, 5, 26, 16, 3, 34.163065`8.286131807151374}
PowerSmartPrice[{y_, m_, d_, h_, mm_, s_}]:=Module[
    {url, data},
    url = StringJoin["http://www.powersmartpricing.org/chart/?display=table&price_dt=", ToString[m], "/", ToString[d], "/", ToString[y]];
    data = Import[url, "Data"][[2;;]];
    ToExpression[StringDrop[data[[Floor[h] + 1, 2]], - 1]] / 100.
];
PowerSmartPrice[Date[]]
0.065`
PowerSmartPrice[{2010, 5, 25, 16, 0, 0}]
0.066`