Add API for registering a function to get SPY
I thought @ssanderson was heading this up, but I can take a stab at it. Any thoughts on how we should go about it? I'm thinking just a global settings dict in utils with get_symbol_rets as the default function is simplest but I'm sure there is a more graceful method.
@humdings I think get_symbol_rets should continue to be the top-level entrypoint for the rest of PyFolio, but its implementation should look like:
def get_symbol_rets(...l):
# Get the currently registered symbol retrieval function.
return settings['returns'](...)
and then we need a registration function that looks like:
def register_returns_func(f):
settings['returns'] = f
The registration function should document the expected signature of the function being registered.
We should follow similar patterns for any other data that PyFolio pulls from the Internet. It may be worth encapsulating the config in an object more complex than a dict, but we can always go back and change it later if need be, since the particular storage mechanism won't be public API.
Initial PR for this is here https://github.com/quantopian/pyfolio/pull/92/
I'm wondering if it should be moved to a different location pyfolio.settings.py?
PR merged. Thanks @humdings!