Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to define a list of shares (20 us shares for example) for predicting? Rather than the entire nasdaq100 or sp500? #794

Closed
orchardc opened this issue Jan 3, 2022 · 7 comments
Labels
question Further information is requested

Comments

@orchardc
Copy link

orchardc commented Jan 3, 2022

How to define a list of shares (20 us shares for example) for predicting? Rather than the entire nasdaq100 or sp500?

Is there a sample?

Many thanks!

@orchardc orchardc added the question Further information is requested label Jan 3, 2022
@you-n-g
Copy link
Collaborator

you-n-g commented Jan 3, 2022

There are two approaches I come up with now.

  1. You can follow the example here ~/.qlib/qlib_data/cn_data/instruments to define your own universe. And create a dataset based on this universe.
  2. If you want to train the model on a larger universe and test data on a smaller universe, you can filter your data when model inference. You can define some processors which only apply to inference data https://github.com/microsoft/qlib/blob/main/qlib/data/dataset/handler.py#L442

@orchardc
Copy link
Author

orchardc commented Jan 3, 2022

Thank you-n-g, for your #1 suggestion.

For quick testing:
I create a file called: nasdaq2.txt that includes 2 records copied from the sample file, then put in the instruments folder.
image

Then change the market = "NASDAQ2" in the .ipynb file.
image

Is that everything or do I need to change something else? The purpose is only to use these 2 stocks for training and testing.

In the prediction result, I got:
image
image

@orchardc
Copy link
Author

orchardc commented Jan 5, 2022

Any idea? @you-n-g

@you-n-g
Copy link
Collaborator

you-n-g commented Jan 5, 2022

@orchardc
It looks like your model learned nothing (the initial model gets the lowest loss and predicts the same value for all samples).

@you-n-g
Copy link
Collaborator

you-n-g commented Jan 5, 2022

I think more data will be helpful

@orchardc
Copy link
Author

orchardc commented Jan 5, 2022

Thanks @you-n-g , I think you are right! With more stocks, I start seeing some data...although I'd like the model to only use selective stocks for training/testing.

@orchardc
Copy link
Author

orchardc commented Jan 5, 2022

The NASDAQ prediction result isn't good, but I guess the sample workflow was designed for CSI300, not for the US market.

image

@orchardc orchardc closed this as completed Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants