Add fund data as an example#292
Merged
you-n-g merged 13 commits intomicrosoft:mainfrom Mar 19, 2021
wangershi:addFund
Merged
Conversation
Collaborator
|
@wangershi Thanks for your PR. |
Contributor
Author
Done, thanks @you-n-g . |
zhupr
reviewed
Mar 17, 2021
| raise ValueError(f"cannot support {interval}") | ||
| return _result | ||
|
|
||
| def collector_data(self): |
Collaborator
There was a problem hiding this comment.
If the subclass does not make any changes, this function can be omitted
| return df | ||
|
|
||
|
|
||
| class FundNormalize1d(FundNormalize, ABC): |
Collaborator
There was a problem hiding this comment.
It’s more appropriate to write this class like this:
class FundNormalize1d(FundNormalize):
pass
scripts/data_collector/utils.py
Outdated
| return calendar | ||
|
|
||
|
|
||
| def return_date_list(source_dir, date_field_name: str, file_path: Path): |
Collaborator
There was a problem hiding this comment.
def return_date_list(date_field_name: str, file_path: Path):
date_list = pd.read_csv(file_path, sep=",", index_col=0)[date_field_name].to_list()
return sorted(map(lambda x: pd.Timestamp(x), date_list))
scripts/data_collector/utils.py
Outdated
|
|
||
| logger.info(f"count how many funds trade in this day......") | ||
| _dict_count_trade = dict() # dict{date:count} | ||
| _fun = partial(return_date_list, source_dir, date_field_name) |
Collaborator
There was a problem hiding this comment.
_fun = partial(return_date_list, date_field_name)
| _dict_count_trade = dict() # dict{date:count} | ||
| _fun = partial(return_date_list, source_dir, date_field_name) | ||
| with tqdm(total=_number_all_funds) as p_bar: | ||
| with ProcessPoolExecutor(max_workers=max_workers) as executor: |
Collaborator
There was a problem hiding this comment.
The following code can read the file less:
all_oldest_list = []
with tqdm(total=_number_all_funds) as p_bar:
with ProcessPoolExecutor(max_workers=max_workers) as executor:
for date_list in executor.map(_fun, file_list):
if date_list:
all_oldest_list.append(date_list[0])
for date in date_list:
if date not in _dict_count_trade.keys():
_dict_count_trade[date] = 0
_dict_count_trade[date] += 1
p_bar.update()
logger.info(f"count how many funds have founded in this day......")
_dict_count_founding = {date: _number_all_funds for date in _dict_count_trade.keys()} # dict{date:count}
with tqdm(total=_number_all_funds) as p_bar:
for oldest_date in all_oldest_list:
for date in _dict_count_founding.keys():
if date < oldest_date:
_dict_count_founding[date] -= 1
Contributor
Author
|
Done, thanks @zhupr . |
you-n-g
pushed a commit
to you-n-g/qlib
that referenced
this pull request
Aug 16, 2025
* fix some bugs in feedback.py and refine the prompt * fix a ci error
gaogen123
pushed a commit
to gaogen123/qlib
that referenced
this pull request
Sep 13, 2025
Add fund data as an example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add fund data as an example
Motivation and Context
There are only stock data as the example, we can also use qlib for fund.
How Has This Been Tested?
A new feature, I test it offline.
Screenshots of Test Results (if appropriate):
Types of changes