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

Add new dataset and index: ibovespa and B3 datasets from Brazil Stock Exchange #956

Closed
igor17400 opened this issue Mar 9, 2022 · 1 comment · Fixed by #990
Closed

Add new dataset and index: ibovespa and B3 datasets from Brazil Stock Exchange #956

igor17400 opened this issue Mar 9, 2022 · 1 comment · Fixed by #990
Labels
enhancement New feature or request

Comments

@igor17400
Copy link
Contributor

🌟 Feature Description

Brazil's stock exchange is one of the biggest in the world and therefore adding its dataset into qlib can help people do research via qlib infrastructure using different datasets.

Motivation

  1. Application scenario: support brazilian stocks exchange investment strategy research.
  2. Related works (Papers, Github repos etc.): Not applicable
  3. Any other relevant and important information: More details on Brazil's stock exchange can be found on B3

Alternatives

No other alternative have been considered, since the data is required to proceed with an investment strategy research.

Additional Notes

The ideia is to

  • add code into data_collector to get data about the largest index in Brazil's stocks exchange - ibovespa
  • add code into yahoo folder in order to download stocks historic prices.
@igor17400 igor17400 added the enhancement New feature or request label Mar 9, 2022
@igor17400 igor17400 mentioned this issue Mar 17, 2022
4 tasks
@SunsetWolf
Copy link
Collaborator

🌟 Feature Description

Brazil's stock exchange is one of the biggest in the world and therefore adding its dataset into qlib can help people do research via qlib infrastructure using different datasets.

Motivation

  1. Application scenario: support brazilian stocks exchange investment strategy research.
  2. Related works (Papers, Github repos etc.): Not applicable
  3. Any other relevant and important information: More details on Brazil's stock exchange can be found on B3

Alternatives

No other alternative have been considered, since the data is required to proceed with an investment strategy research.

Additional Notes

The ideia is to

  • add code into data_collector to get data about the largest index in Brazil's stocks exchange - ibovespa
  • add code into yahoo folder in order to download stocks historic prices.

Hi, thank you for submitting PR, now, your PR didn't pass the CI test, I think to solve this problem, you can try to merge the main branch of qlib.

you-n-g pushed a commit that referenced this issue Apr 6, 2022
* feat: download ibovespa index historic composition

ibovespa(ibov) is the largest index in Brazil's stocks exchange.
The br_index folder has support for downloading new companies for the current index composition.
And has support, as well, for downloading companies from historic composition of ibov index.

Partially resolves issue #956

* fix: typo error instead of end_date, it was written end_ate

* feat: adds support for downloading stocks historic prices from Brazil's stocks exchange (B3)

Together with commit c2f933 it resolves issue #956

* fix: code formatted with black.

* wip: Creating code logic for brazils stock market data normalization

* docs: brazils stock market data normalization code documentation

* fix: code formatted the with black

* docs: fixed typo

* docs: more info about python version used to generate requirements.txt file

* docs: added BeautifulSoup requirements

* feat: removed debug prints

* feat: added ibov_index_composition variable as a class attribute of IBOVIndex

* feat: added increment to generate the four month period used by the ibov index

* refactor: Added get_instruments() method inside utils.py for better code usability.

Message in the PR request to understand the context of the change

In the course of reviewing this PR we found two issues.

    1. there are multiple places where the get_instruments() method is used,
	and we feel that scripts.index.py is the best place for the
	get_instruments() method to go.
    2. data_collector.utils has some very generic stuff put inside it.

* refactor: improve brazils stocks download speed

The reason to use retry=2 is due to the fact that
Yahoo Finance unfortunately does not keep track of the majority
of Brazilian stocks.

Therefore, the decorator deco_retry with retry argument
set to 5 will keep trying to get the stock data 5 times,
which makes the code to download Brazilians stocks very slow.

In future, this may change, but for now
I suggest to leave retry argument to 1 or 2 in
order to improve download speed.

In order to achieve this code logic an argument called retry_config
was added into YahooCollectorBR1d and YahooCollectorBR1min

* fix: added __main__ at the bottom of the script

* refactor: changed interface inside each index

Using partial as `fire.Fire(partial(get_instruments, market_index="br_index" ))`
will make the interface easier for the user to execute the script.
Then all the collector.py CLI in each folder can remove a redundant arguments.

* refactor: implemented  class interface retry into YahooCollectorBR

* docs: added BR as a possible region into the documentation

* refactor: make retry attribute part of the interface

This way we don't have to use hasattr to access the retry attribute as previously done
qianyun210603 pushed a commit to qianyun210603/qlib that referenced this issue Mar 23, 2023
* feat: download ibovespa index historic composition

ibovespa(ibov) is the largest index in Brazil's stocks exchange.
The br_index folder has support for downloading new companies for the current index composition.
And has support, as well, for downloading companies from historic composition of ibov index.

Partially resolves issue microsoft#956

* fix: typo error instead of end_date, it was written end_ate

* feat: adds support for downloading stocks historic prices from Brazil's stocks exchange (B3)

Together with commit c2f933 it resolves issue microsoft#956

* fix: code formatted with black.

* wip: Creating code logic for brazils stock market data normalization

* docs: brazils stock market data normalization code documentation

* fix: code formatted the with black

* docs: fixed typo

* docs: more info about python version used to generate requirements.txt file

* docs: added BeautifulSoup requirements

* feat: removed debug prints

* feat: added ibov_index_composition variable as a class attribute of IBOVIndex

* feat: added increment to generate the four month period used by the ibov index

* refactor: Added get_instruments() method inside utils.py for better code usability.

Message in the PR request to understand the context of the change

In the course of reviewing this PR we found two issues.

    1. there are multiple places where the get_instruments() method is used,
	and we feel that scripts.index.py is the best place for the
	get_instruments() method to go.
    2. data_collector.utils has some very generic stuff put inside it.

* refactor: improve brazils stocks download speed

The reason to use retry=2 is due to the fact that
Yahoo Finance unfortunately does not keep track of the majority
of Brazilian stocks.

Therefore, the decorator deco_retry with retry argument
set to 5 will keep trying to get the stock data 5 times,
which makes the code to download Brazilians stocks very slow.

In future, this may change, but for now
I suggest to leave retry argument to 1 or 2 in
order to improve download speed.

In order to achieve this code logic an argument called retry_config
was added into YahooCollectorBR1d and YahooCollectorBR1min

* fix: added __main__ at the bottom of the script

* refactor: changed interface inside each index

Using partial as `fire.Fire(partial(get_instruments, market_index="br_index" ))`
will make the interface easier for the user to execute the script.
Then all the collector.py CLI in each folder can remove a redundant arguments.

* refactor: implemented  class interface retry into YahooCollectorBR

* docs: added BR as a possible region into the documentation

* refactor: make retry attribute part of the interface

This way we don't have to use hasattr to access the retry attribute as previously done
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 a pull request may close this issue.

2 participants