Skip to content

MVP for Indian Stocks in qlib using yahooquery#513

Merged
you-n-g merged 6 commits intomicrosoft:mainfrom
2796gaurav:main
Aug 26, 2021
Merged

MVP for Indian Stocks in qlib using yahooquery#513
you-n-g merged 6 commits intomicrosoft:mainfrom
2796gaurav:main

Conversation

@2796gaurav
Copy link
Contributor

@2796gaurav 2796gaurav commented Jul 14, 2021

Added NSE stock data option using yahooquery.

Description

created new class -> YahooCollectorIN1d, YahooCollectorIN
and function get_in_stock_symbols() to get NSE stock symbols which works for Indian stock market.
It doesnt conflict with existing code and if we really need to support Indian stock data, we would have to change in workflow and interface layer. Currently i have completed for data layer.

you can check to download the data from below commands

Get data:
python scripts/data_collector/yahoo/collector.py download_data --source_dir ~/.qlib/stock_data/source/in_1min --region IN --start 2020-11-01 --end 2020-11-10 --delay 0.1 --interval 1d

Convert to .bin
python scripts/dump_bin.py dump_all --csv_path ~/.qlib/stock_data/source/in_1min --qlib_dir ~/.qlib/qlib_data/my_data --include_fields open,close,high,low,volume,factor

Motivation and Context

No this is a feature request

It will provide more reach and capability for Indian stock data.

How Has This Been Tested?

  • Pass the test by running: pytest qlib/tests/test_all_pipeline.py under upper directory of qlib.
  • If you are adding a new feature, test on your own test scripts.

Screenshots of Test Results (if appropriate):

  1. Pipeline test:
  2. Your own tests:

Types of changes

  • Fix bugs
  • Add new feature
  • Update documentation

@ghost
Copy link

ghost commented Jul 14, 2021

CLA assistant check
All CLA requirements met.

@2796gaurav
Copy link
Contributor Author

Hi It looks like the code was not formated by black previously. When i applied it have reformatted many other functions too.

@zhupr
Copy link
Collaborator

zhupr commented Jul 14, 2021

@2796gaurav Hi,
Thanks for the PR, black add the -l parameter: black qlib -l 120

@zhupr
Copy link
Collaborator

zhupr commented Jul 15, 2021

Need to add YahooNormalizeIN(get the trading calendar for Indian stocks) and YahooNormalizeIN1d, ref: YahooNormalizeUS YahooNormalizeUS1d

@2796gaurav
Copy link
Contributor Author

Hi @zhupr I have added the calender for indian stocks, however i didnt quite understand fully how this would work?

@zhupr
Copy link
Collaborator

zhupr commented Jul 20, 2021

@2796gaurav Hi,
Needed when normalizing stock data(collector and normalize : python scripts/data_collector/yahoo/collector.py normalize_data);
normalize requires aligning each stock to a "standard trading calendar" and then doing some calculations (calculating adjusted price: normalize yahoo data, etc.)

@zhupr
Copy link
Collaborator

zhupr commented Jul 21, 2021

@2796gaurav You can add "region IN" the document: Collector YahooFinance data to qlib

@2796gaurav
Copy link
Contributor Author

Hi @zhupr Updated readme ad mentioned.
For Normalization, added function get_calendar_list("IN_ALL") to get Indian Normalized data
also added code for 1min data

@you-n-g you-n-g closed this Aug 25, 2021
@you-n-g you-n-g reopened this Aug 25, 2021
@you-n-g you-n-g added the enhancement New feature or request label Aug 25, 2021
@2796gaurav
Copy link
Contributor Author

Thanks 👍

@you-n-g
Copy link
Collaborator

you-n-g commented Aug 26, 2021

It looks great!
Thanks so much! @2796gaurav

@you-n-g you-n-g merged commit 19d15dd into microsoft:main Aug 26, 2021
@2796gaurav
Copy link
Contributor Author

Hi @you-n-g
In order to utilize the Indian qlib data from what I think below code is only option to perform, however there is error in region parameter

qlib.init(provider_uri="~/.qlib/qlib_data/qlib_in_1d", region="in")

If there is any alternative? or do we have to resolve this issue?

qianyun210603 pushed a commit to qianyun210603/qlib that referenced this pull request Mar 23, 2023
MVP for Indian Stocks in qlib using yahooquery
you-n-g pushed a commit to you-n-g/qlib that referenced this pull request Aug 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants