billray0259 / stockbot_2020

A previous attempt at profitable algorithmic trading
0 stars 0 forks source link

Filter out or fill missing data in joined DataFrame #1

Closed billray0259 closed 4 years ago

billray0259 commented 4 years ago

Some candles that the TD API responds with are missing. It's unclear if these missing candles indicate a period of time with zero trading volume or if TD doesn't have data for that time.

I have sent an email to api@tdameritrade.com asking for clarification.

I intend to fill the data as if missing candles indicate zero trading volume. Meaning all prices for this candle are equal to the previous candle's close with a volume of zero. Even if there is a non-zero trading volume for these time periods and we just don't have access to these candles, filling the data in this way may still be a sensible approach.

billray0259 commented 4 years ago

The zero_volume_fille() method in the TrainingDataCollector class requires the _joined file and the _finviz file to be present. Using these files it creates a new _filled_histories directory where it saves a complete history of every ticker that exists in both the _finviz file and the _joined file to its own file. A call of TrainingDataCollector.join_candles(filled=True) is required to join all of these files into one big _filled file.