noda-sin / ebisu

Bitmex Simple and Powerful Trading Bot
MIT License
83 stars 32 forks source link

KeyError: 'timestamp' #11

Closed sundevilyang closed 4 years ago

sundevilyang commented 4 years ago

Hey after I run python main.py --demo --strategy Doten

it indicated the following error message

2019-11-30 15:33:02,188 - INFO - Bot Mode : Back test
/Users/ywen8/.asdf/installs/python/3.6.5/lib/python3.6/site-packages/swagger_spec_validator/validator20.py:53: SwaggerValidationWarning: Found "$ref: #/definitions/UserPreferences" with siblings that will be overwritten. See https://stackoverflow.com/a/48114924 for more information. (path #/definitions/User/properties/preferences)
  ref_dict['$ref'], '/'.join(path),
Traceback (most recent call last):
  File "/Users/ywen8/.asdf/installs/python/3.6.5/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 2897, in get_loc
    return self._engine.get_loc(key)
  File "pandas/_libs/index.pyx", line 107, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 131, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 1607, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 1614, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'timestamp'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 22, in <module>
    bot.run()
  File "/Users/ywen8/Documents/Projects/PyCharm/ebisu/src/bot.py", line 123, in run
    self.exchange.on_update(self.bin_size, self.strategy)
  File "/Users/ywen8/Documents/Projects/PyCharm/ebisu/src/bitmex_backtest.py", line 143, in on_update
    self.__load_ohlcv(bin_size)
  File "/Users/ywen8/Documents/Projects/PyCharm/ebisu/src/bitmex_backtest.py", line 202, in __load_ohlcv
    self.df_ohlcv = load_data(file)
  File "/Users/ywen8/Documents/Projects/PyCharm/ebisu/src/__init__.py", line 48, in load_data
    'timestamp': pd.to_datetime(source['timestamp']),
  File "/Users/ywen8/.asdf/installs/python/3.6.5/lib/python3.6/site-packages/pandas/core/frame.py", line 2995, in __getitem__
    indexer = self.columns.get_loc(key)
  File "/Users/ywen8/.asdf/installs/python/3.6.5/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 2899, in get_loc
    return self._engine.get_loc(self._maybe_cast_indexer(key))
  File "pandas/_libs/index.pyx", line 107, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 131, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 1607, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 1614, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'timestamp'