Skip to content

Question:How to set the total number of stocks #13

Closed

Description

@shenglinqian

Thanks for this program! It is awesome!
Counld you hlep me figure out how to set the limit of total number of stocks?
For example, the data contains about 2000 stocks, and I want to get a portfolio which has only 100

Activity

  1. robertmartin8 commented on Jan 5, 2019

    @robertmartin8
    Collaborator

    Hi there,

    Currently that isn't explicitly supported: it is assumed that you will provide the exact universe of stocks that you can buy, then the algorithm will treat them all as fair game.

    However, if you run the portfolio optimisation, you will find that the optimiser naturally produces many near-zero weights. In my initial tests, universes of 50 stocks sometimes had less than 10 with nonzero weights. So I think you might find it worthwhile to just try out a vanilla efficient frontier and see then filter the resulting weights to see how many are non-negligible.

    If that doesn't work (i.e you still have too many stocks with non-negligible weights), you may try running the optimisation with a negative gamma parameter, which will encourage 'centralisation'.

    Don't hesitate to reach out if you need any more help!
    Robert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions