Skip to content

Encoding issue when interfacing with Yahoo Finance #5

@jamlamberti

Description

@jamlamberti

Need to do some type of decoding in the cache wrapper or some strange things might start happing.

If I want to look up the historical data for S&P 500, I search for ^GSPC. This returns

[{
    "Volume": "3934010000",
    "Symbol": "%5eGSPC",
    "Adj_Close": "2062.139893",
    "High": "2064.080078",
    "Low": "2030.609985",
    "Date": "2015-01-08",
    "Close": "2062.139893",
    "Open": "2030.609985"
}, {
    "Volume": "3805480000",
    "Symbol": "%5eGSPC",
    "Adj_Close": "2025.900024",
    "High": "2029.609985",
    "Low": "2005.550049",
    "Date": "2015-01-07",
    "Close": "2025.900024",
    "Open": "2005.550049"
}]

The Symbol entry does not match the original query if we do not decode. This seems to fix it:

import urllib
print urllib.unquote('%5eGSPC')

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions