catalyst icon indicating copy to clipboard operation
catalyst copied to clipboard

catalyst.api.record fails randomly in live mode (Bitfinex)

Open avolution opened this issue 7 years ago • 3 comments

The code:

record(
      price=data.current(symbol('btc_usd'), 'price'),
      volume=data.current(symbol('btc_usd'), 'volume'),
      cash=context.portfolio.cash,
      leverage=context.account.leverage,
)

The exception:

Traceback (most recent call last):
  File "main.py", line 338, in <module>
    main()
  File "main.py", line 300, in main
    quote_currency='usd'
  File " /catalyst/utils/run_algo.py", line 596, in run_algorithm
    stats_output=stats_output
  File " /catalyst/utils/run_algo.py", line 358, in _run
    overwrite_sim_params=False,
  File " /catalyst/exchange/exchange_algorithm.py", line 1075, in run
    data, overwrite_sim_params
  File " /catalyst/exchange/exchange_algorithm.py", line 362, in run
    data, overwrite_sim_params
  File " /catalyst/algorithm.py", line 725, in run
    for perf in self.get_generator():
  File " /catalyst/gens/tradesimulation.py", line 222, in transform
    for dt, action in self.clock:
  File " /catalyst/exchange/live_graph_clock.py", line 74, in __iter__
    self.context.frame_stats, recorded_cols=recorded_cols
  File " /catalyst/exchange/utils/stats_utils.py", line 198, in prepare_stats
    value = row_data[column]
KeyError: 'price'

I have discovered this error also for others keys like 'cash' etc.

The same code is working in backtest without problems.


Use Catalyst version 0.5.18

avolution avatar Aug 02 '18 13:08 avolution

Thanks @avolution , we will investigate this.

lenak25 avatar Aug 06 '18 09:08 lenak25

Hi @avolution, I have tried to reproduce it, because it happens randomly, it is very difficult to reproduce. Is there more information that you can provide? Thanks

EmbarAlmog avatar Aug 27 '18 11:08 EmbarAlmog

I have same problems in backtest mode. Sometimes ,it record. now it is not working

studyquant avatar Nov 23 '18 07:11 studyquant