QuantConnect / QuantConnect/Lean.DataSource.BrainSentiment

Duplicate Information For a Given Date

Open
#22 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
2
Forks
10
PR merge metrics
No merged PRs in 30d

Description

We found two entries for some dates in 2021 for HWM:

Image

pandas as pd
qb = QuantBook()

history_days = 4*365

# Requesting Data
selected_symbol = qb.add_equity("HWM", Resolution.DAILY).symbol
brain30symbol = qb.add_data(BrainSentimentIndicator30Day, selected_symbol).symbol
brain7symbol = qb.add_data(BrainSentimentIndicator7Day, selected_symbol).symbol

# Historical data
history_symbol : pd.DataFrame= qb.history(selected_symbol, history_days, resolution=Resolution.DAILY).loc[selected_symbol]
print(f"history_symbol has dubplicates: {history_symbol.index.has_duplicates}")
brain_30_history : pd.DataFrame = qb.history(BrainSentimentIndicator30Day, brain30symbol, history_days, Resolution.DAILY).loc[brain30symbol]
print(f"brain_30_history has dubplicates: {brain_30_history.index.has_duplicates}")
brain_7_history : pd.DataFrame = qb.history(BrainSentimentIndicator7Day, brain7symbol, history_days, Resolution.DAILY).loc[brain7symbol]
print(f"brain_7_history has dubplicates: {brain_7_history.index.has_duplicates}")
print(len(history_symbol), len(brain_30_history), len(brain_7_history))

This is a data issue since the raw file has this problem:

20210322,83,39,0.321800,-0.541100,-0.767900
20210322,65,22,0.122400,0.185500,-0.920800
20210323,82,39,0.321800,-0.566900,-0.760800
20210323,67,23,0.106000,0.264300,-0.828900
20210324,92,42,0.269700,-0.257600,-0.595400
20210324,67,23,0.131400,0.260900,-0.822600

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the QuantBook history calls in the issue and inspect the BrainSentimentIndicator30Day and BrainSentimentIndicator7Day raw data around the listed 2021 dates. Determine where the duplicate date records originate, then validate the correction by rerunning the example and confirming the returned indexes no longer contain duplicates.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.