Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError #27

Open
alanblake opened this issue Jul 7, 2019 · 1 comment
Open

KeyError #27

alanblake opened this issue Jul 7, 2019 · 1 comment

Comments

@alanblake
Copy link

I'm getting the following error when running ccGains. No error reported when ccGains was run on the previous years data .

INFO    : TRADE #1
INFO    : Exchange on 2018-01-07 09:38:26+00:00: Acquired ...
INFO    : Processing trade: Exchange, 2018-01-07 09:38:26+00:00, BTC, ...
INFO    : Selling ... XRP for ... BTC at Poloniex (2018-01-07 09:38:26+00:00, fee: ... BTC)
WARNING : Date 2018-01-07 09:38:26+00:00 missing in cached data. Repeating request to API
INFO    : Fetched historical price data with request: https://poloniex.com/public?command=returnTradeHistory&currencyPair=BTC_XRP&start=1515283200&end=1515369600
INFO    : Successfully fetched 1000 trades
INFO    : Saved bags' state to /ccGains/profile-XX/precrash.json
Traceback (most recent call last):
  File "pandas/_libs/index.pyx", line 439, in pandas._libs.index.DatetimeEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 987, in pandas._libs.hashtable.Int64HashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 993, in pandas._libs.hashtable.Int64HashTable.get_item
KeyError: 1515315600000000000

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/ccGains/env3/lib/python3.6/site-packages/ccgains/bags.py", line 843, in pay
    self.relation.get_rate(dtime, currency, self.currency))
  File "/ccGains/env3/lib/python3.6/site-packages/ccgains/relations.py", line 280, in get_rate
    result *= self.historic_prices[step_key].get_price(dtime)
  File "/ccGains/env3/lib/python3.6/site-packages/ccgains/historic_data.py", line 113, in get_price
    return df.at[pd.Timestamp(dtime).floor(df.index.freq)]
  File "/ccGains/env3/lib/python3.6/site-packages/pandas/core/indexing.py", line 2270, in __getitem__
    return self.obj._get_value(*key, takeable=self._takeable)
  File "/ccGains/env3/lib/python3.6/site-packages/pandas/core/series.py", line 1187, in _get_value
    return self.index.get_value(self._values, label)
  File "/ccGains/env3/lib/python3.6/site-packages/pandas/core/indexes/datetimes.py", line 939, in get_value
    return self.get_value_maybe_box(series, key)
  File "/ccGains/env3/lib/python3.6/site-packages/pandas/core/indexes/datetimes.py", line 971, in get_value_maybe_box
    key, tz=self.tz)
  File "pandas/_libs/index.pyx", line 81, in pandas._libs.index.IndexEngine.get_value
  File "pandas/_libs/index.pyx", line 89, in pandas._libs.index.IndexEngine.get_value
  File "pandas/_libs/index.pyx", line 441, in pandas._libs.index.DatetimeEngine.get_loc
KeyError: Timestamp('2018-01-07 09:00:00+0000', tz='UTC')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "ccGains-XX-2018.py", line 386, in <module>
    main()
  File "ccGains-XX-2018.py", line 249, in main
    bf.process_trade(trade)
  File "/ccGains/env3/lib/python3.6/site-packages/ccgains/bags.py", line 1087, in process_trade
    'buy_ratio': trade.buyval / trade.sellval})
  File "/ccGains/env3/lib/python3.6/site-packages/ccgains/bags.py", line 848, in pay
    currency, self.currency, dtime))
  File "/ccGains/env3/lib/python3.6/site-packages/ccgains/bags.py", line 240, in _abort
    raise exception_type(msg)
ValueError: Could not fetch the price for currency_pair XRP_AUD on 2018-01-07 09:38:26+00:00 from provided CurrencyRelation object.

@alanblake
Copy link
Author

I've resolved this temporarily by limiting the poloniex history data fetch. I set the end time to the transaction timestamp. I'll post more details soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant