scrtlabs / catalyst

An Algorithmic Trading Library for Crypto-Assets in Python
http://enigma.co
Apache License 2.0
2.49k stars 725 forks source link

Add custom variable groups in live graph #68

Open fredfortier opened 6 years ago

fredfortier commented 6 years ago

Currently, all custom variables (i.e. tracked with record()) are in a single subplot. It's get messy quickly. As a solution, we could add a subplot configuration to allow grouping variables of similar scale into individual subplots.

screenshot 2017-11-16 15 50 37
wphan commented 6 years ago

how are you able to run live graph? I'm trying this with:

run_algorithm(
    capital_base=0.1,        
    initialize=initialize,   
    handle_data=handle_data, 
    analyze=analyze,         
    exchange_name='binance', 
    live=True,               
    algo_namespace=NAMESPACE,
    base_currency='btc',     
    live_graph=True,         
    simulate_orders=True,    
    stats_output=None,       
)                            

and the error i'm getting is:

[2018-02-01 06:06:14.392000] WARNING: run_algo: Catalyst is currently in ALPHA. It is going through rapid development and it is subject to errors. Please use carefully. We encourage you to report any issue on GitHub: https://github.com/enigmampc/catalyst/issues
[2018-02-01 06:06:17.394000] INFO: run_algo: running algo in paper-trading mode
[2018-02-01 06:06:17.982000] INFO: exchange_bundle: pricing data for [u'btc_usd'] not found in range 2015-03-01 00:00:00+00:00 to 2018-01-31 00:00:00+00:00, updating the bundles.
    [====================================]  Ingesting daily price data for btc_usd on bitfinex:  100%
[2018-02-01 06:06:19.918000] WARNING: Loader: Refusing to download new treasury data because a download succeeded at 2018-02-01 05:40:43.857449+00:00.
[2018-02-01 06:06:19.925000] INFO: exchange_algorithm: initialized trading algorithm in live mode
[2018-02-01 06:06:20.241000] INFO: exchange_algorithm: portfolio balances, cash: 0.1, positions: 0.0
[2018-02-01 06:06:27.793000] INFO: mean_reversion_simple: 2018-02-01 06:06:00+00:00: buying - price: 0.01394003, rsi: 0.0, macd: -1.73472347598e-18, macd_signal: -1.73472347598e-18
2018-02-01 06:06:00+00:00: buying - price: 0.01394003, rsi: 0.0, macd: -1.73472347598e-18, macd_signal: -1.73472347598e-18
[2018-02-01 06:06:29.347000] INFO: exchange_algorithm: statistics for the last 1 minutes:
                           starting_cash  ending_cash  portfolio_value  pnl  long_exposure  short_exposure  orders  transactions          volume  price_change            macd  rsi     macd_signal       price  cash
period_close
2018-02-01 06:07:00+00:00            0.1          0.1              0.1  0.0              0               0       0             0  70757.65636979           0.0 -1.73472348e-18  0.0 -1.73472348e-18  0.01394003   0.1
Traceback (most recent call last):
  File "macd_crossover.py", line 281, in <module>
    stats_output=None,
  File "D:\Users\wphan\Miniconda2\envs\catalyst\lib\site-packages\catalyst\utils\run_algo.py", line 551, in run_algorithm
    stats_output=stats_output
  File "D:\Users\wphan\Miniconda2\envs\catalyst\lib\site-packages\catalyst\utils\run_algo.py", line 330, in _run
    overwrite_sim_params=False,
  File "D:\Users\wphan\Miniconda2\envs\catalyst\lib\site-packages\catalyst\exchange\exchange_algorithm.py", line 297, in run
    data, overwrite_sim_params
  File "D:\Users\wphan\Miniconda2\envs\catalyst\lib\site-packages\catalyst\algorithm.py", line 724, in run
    for perf in self.get_generator():
  File "D:\Users\wphan\Miniconda2\envs\catalyst\lib\site-packages\catalyst\gens\tradesimulation.py", line 222, in transform
    for dt, action in self.clock:
  File "D:\Users\wphan\Miniconda2\envs\catalyst\lib\site-packages\catalyst\exchange\live_graph_clock.py", line 67, in __iter__
    self.callback(self.context, df)
TypeError: 'NoneType' object is not callable

should live_graph be a callable instead of bool? I'm having a hard time finding any documentation on this.