How do I select SP500 constituents

I want to implement a multi-security basket statistical arbitrage script. How do I import securities that belong to SP500 index?

Answers

  • Further to above question, is it possible to use python libraries such as statsmodels and sklearn in the scripts? I am usually on Quantopian and want to move here because of performance issues on their platform.

  • ptunneyptunney Posts: 246

    To run SP500 symbols only, use the following code in is_symbol_qualified...

    def is_symbol_qualified(cls, symbol, md, service, account):
            sp500=service.symbol_list.in_list(service.symbol_list.get_handle('9a802d98-a2d7-4326-af64-cea18f8b5d61'),symbol)   # list.in_list ( sp500 list for today, current symbol)
            return symbol== 'SPY' or sp500

    Libraries supported...
    https://app.cloudquant.com/#/glossary/351

    Ref Sklearn, take a look at the webinar Trevor Trinkino did with FXCM.

Sign In or Register to comment.