def main(prepare, use, do, get, params, debug): if get is not None: do = get if prepare is not None and use in ['ht', 'yjb', 'yh', 'gf', 'xq', 'sm']: user = easytrader.use(use, debug) user.prepare(prepare) with open(ACCOUNT_OBJECT_FILE, 'wb') as f: dill.dump(user, f) if do is not None: with open(ACCOUNT_OBJECT_FILE, 'rb') as f: user = dill.load(f) if not debug: disable_log() if len(params) > 0: result = getattr(user, do)(*params) else: result = getattr(user, do) json_result = json.dumps(result) click.echo(json_result)
def main(prepare, use, do, get, params, debug): if get is not None: do = get if prepare is not None and use in ['ht', 'yjb', 'yh', 'gf', 'xq']: user = easytrader.use(use, debug) user.prepare(prepare) with open(ACCOUNT_OBJECT_FILE, 'wb') as f: dill.dump(user, f) if do is not None: with open(ACCOUNT_OBJECT_FILE, 'rb') as f: user = dill.load(f) if not debug: disable_log() if len(params) > 0: result = getattr(user, do)(*params) else: result = getattr(user, do) json_result = json.dumps(result) click.echo(json_result)