Extract features from the data dictionary. The data dictionary contains values for multiple TAs such as cci, rsi, stocks etc. But here, we will only use the price returns, volume returns, and eom values.
(self, features_dictionary)
| 88 | return technical_indicators_dictionary |
| 89 | |
| 90 | def get_features(self, features_dictionary): |
| 91 | """ |
| 92 | Extract features from the data dictionary. The data dictionary contains values for multiple TAs such as cci, rsi, stocks etc. But here, we will only use the price returns, volume returns, and eom values. |
| 93 | """ |
| 94 | |
| 95 | keys_to_use = ["volume_returns", "daily_log_return", "eom"] |
| 96 | all_keys = list(sorted(features_dictionary.keys())) |
| 97 | feature_list = [] |
| 98 | for key in all_keys: |
| 99 | |
| 100 | # Check if key is present |
| 101 | key_in_keys_to_use = [k in key for k in keys_to_use] |
| 102 | if key_in_keys_to_use.count(True) > 0: |
| 103 | # Add values for the key |
| 104 | feature_list.extend(features_dictionary[key]) |
| 105 | else: |
| 106 | # TAs such as CCI, RSI, STOCHS are being ignored. You can add another condition above to use them |
| 107 | _ = None |
| 108 | |
| 109 | return feature_list |
no outgoing calls
no test coverage detected