def __init__(self, update=False, id=None, timeval=None, taskval=None): super(CalendarWindow, self).__init__() self.setGeometry(300, 300, 400, 400) if update: self.setWindowTitle("Edit Task") else: self.setWindowTitle("Add Task") self.reminder_data = {} self.commons = Commons() self._id = id self._timeval = timeval self._taskval = taskval self.init_ui() self.update = update
def prepare_bot(exchange: str, user: str): settings = load_settings(user) commons = Commons(user, settings['ema_spans_minutes']) all_coins = set(flatten([s.split('/') for s in commons.cc.markets])) settings['coins'] = [c for c in settings['coins'] if c in all_coins] all_margin_pairs = [ f"{e['base']}/{e['quote']}" for e in commons.cc.sapi_get_margin_allpairs() ] settings['symbols'] = [ s for c in settings['coins'] if (s := f"{c}/{settings['quot']}") in all_margin_pairs ] commons.init(settings['symbols']) receiver_funcs = [commons.update_ema] vwap = Vwap(commons, settings) vwap.init() receiver_funcs.append(vwap.on_update) commons.start_call_limiter() streamer = Streamer(settings, receiver_funcs) return commons, vwap, streamer
from commons import Commons from command_builder import CommandBuilder import subprocess import json import sys commons = Commons() command_builder = CommandBuilder() cmd = command_builder.build_get_voter_table(5, 'b1') json = commons.get_correct_json_from_cmd(cmd, 'rows') print(json) cmd = command_builder.build_get_account('b1') ret = commons.get_correct_account_response_from_cmd(cmd, 'total') if ret is None: print("Problem with getting account balance") else: print("Account balance is: %s" % ret) cmd = command_builder.build_get_account('patreosxxxxx') ret = commons.get_correct_account_response_from_cmd(cmd, 'total') if ret is None: print("Problem with cmd: `%s`" % (' '.join(cmd)), file=sys.stderr) else: print("Account balance is: %s" % ret) tokens = commons.safe_split("patreosxxxxx,20", ',', 2) print(tokens[0]) cmd = command_builder.build_get_voter_table(1)
def __init__(self): self.class_to_name = {0: 'Non Corona', 1: 'Corona'} self.utils = Commons() self.model = self.utils.prepare_model()