コード例 #1
0
def logininfo():
    d = {"status": "%d" % sp.get_login_status(80)}
    if my_config.get('logininfo') is not None:
        d['info'] = my_config.get('logininfo')
    if info_cache['connected'] is not None:
        d['connected'] = info_cache['connected']
    if info_cache['account_info'] is not None:
        d['account_info'] = info_cache['account_info']
    d['account_fields'] = sp.fields("SPApiAccInfo")
    d['strategy_list'] = strategy.strategy_list()
    d['strategy_headers'] = {}
    for i in strategy.strategy_list():
        d['strategy_headers'][i] = strategy.headers(i)
    d['strategy_data'] = my_config.get_stratdata_by_strategy('strategy_data')
    d['backtest_data'] = my_config.get_stratdata_by_strategy('backtest_data')
    d['versions'] = [["web-backend", VERSION], ["backtrader", btversion]]
    return jsonify(d)
コード例 #2
0
 def get_stratdata_by_strategy(self, root):
     d = {}
     for k, v in self.config[root].items():
         if v['strategy'] not in d:
             d[v['strategy']] = []
         d[v['strategy']].append(v)
     for k in strategy.strategy_list():
         if k not in d:
             d[k] = []
     return d