For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

YahooFinanceData Issue - TypeError: 'module' object is not callable



  • Not sure if anyone else is facing this issue, but I can't seem to use YahooFinanceData properly - google search on the error suggests I'm importing the class improperly.

    d = bt.feeds.YahooFinanceData(dataname='MSFT', fromdate=datetime(2011, 1, 1), todate=datetime(2012, 12, 31))

    Anything wrong with this? I copied it from one of the examples so was surprised it was not working



  • You are probably not importing the datetime class from datetime module correctly . Either import it using:

    from datetime import datetime
    

    or use:

    import datetime
    

    and then

    datetime.datetime(...)
    


});