i have 1 hour timefram historical data of some cryptocurrencies as csv files each file…
- User
i have 1 hour timefram historical data of some cryptocurrencies as csv files each file contains following informattion(for example for AAVEBNB):
Unix Date Symbol Open High Low Close Volume AAVE Volume BNB tradecount 1.71072E+12 3/17/2024 23:00 AAVEBNB 0.2223 0.2249 0.2211 0.2224 79.349 17.6606516 41 1.71071E+12 3/17/2024 22:00 AAVEBNB 0.2203 0.2228 0.2201 0.2211 216.352 47.9264188 109 1.71071E+12 3/17/2024 21:00 AAVEBNB 0.2184 0.2203 0.2184 0.2203 6.436 1.4140628 10 1.71071E+12 3/17/2024 20:00 AAVEBNB 0.2182 0.2185 0.2172 0.2174 24.83 5.4086803 18 ...
how can i calculate 4 houre timeframe of them based on 1 hour csv files?
- Assistant
- User
give me the python code of full implementation of calculating 4 hour historical data from 1 hour historical data
- Assistant
- User
i want to calculate 4h timeframes for all of my csv files and in each file the 8th and 9th column name depends on the pair name for example For AAVEBNV are Volume AAVE and Volume BNB for the 1INCHBTC are Volume 1INCH and Volume BTC
- Assistant
- User
Traceback (most recent call last): File "C:\Users\Fazel\PycharmProjects\indicators_calculate\venv\lib\site-packages\pandas\core\indexes\base.py", line 3805, in get_loc return self._engine.get_loc(casted_key) File "index.pyx", line 167, in pandas._libs.index.IndexEngine.get_loc File "index.pyx", line 196, in pandas._libs.index.IndexEngine.get_loc File "pandas\_libs\hashtable_class_helper.pxi", line 7081, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas\_libs\hashtable_class_helper.pxi", line 7089, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'Unix'
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "C:\Users\Fazel\PycharmProjects\indicators_calculate\calculate_4h_from_1h.py", line 62, in main() File "C:\Users\Fazel\PycharmProjects\indicators_calculate\calculate_4h_from_1h.py", line 59, in main process_files(directory_path, out_directory_path) File "C:\Users\Fazel\PycharmProjects\indicators_calculate\calculate_4h_from_1h.py", line 46, in process_files df = load_data(csv_path) File "C:\Users\Fazel\PycharmProjects\indicators_calculate\calculate_4h_from_1h.py", line 8, in load_data df['Date'] = pd.to_datetime(df['Unix'], unit='ms') File "C:\Users\Fazel\PycharmProjects\indicators_calculate\venv\lib\site-packages\pandas\core\frame.py", line 4090, in indexer = self.columns.get_loc(key) File "C:\Users\Fazel\PycharmProjects\indicators_calculate\venv\lib\site-packages\pandas\core\indexes\base.py", line 3812, in get_loc raise KeyError(key) from err KeyError: 'Unix'
- Assistant