def insert_config_into_exchanges(config): limit_only = config["limit_only"] public_key = config["public_api_key"] private_key = config["private_api_key"] exchange = config["exchange"] if no_exchanges_table_exists(): create_exchanges_table() insert_exchange(exchange, public_key, private_key, limit_only)
insertofftime=5000) root.option_add("*TCombobox*Listbox*selectBackground", "#D15101") # ------------------------------ if db.no_merkatos_table_exists(): db.create_merkatos_table() if db.no_exchanges_table_exists(): db.create_exchanges_table() test = konfig.encrypt_keys( dict(exchange="test", public_api_key='abc', private_api_key='123', limit_only=True), password) db.insert_exchange(**test) merkatos = db.get_all_merkatos() complete_merkato_configs = generate_complete_merkato_configs(merkatos) # ------------------------------ app = App(master=root, block_on_error=args.blockOnError, password=password, delay=args.delay, side=tk.RIGHT) for persisted in complete_merkato_configs: pprint(persisted) konfig.decrypt_keys(config=persisted['configuration'], password=password) bot = Bot(root, app(), app, persist=persisted)
def start_merkatos(entered_password): if platform.system().lower() == "darwin": def mainloop(): while True: try: root.update_idletasks() root.update() time.sleep(1) except UnicodeDecodeError: print("Caught Scroll Error") else: def mainloop(): while True: try: root.update_idletasks() root.update() except UnicodeDecodeError: print("Caught Scroll Error") parser = argparse.ArgumentParser() parser.add_argument('-b', '--blockOnError', action='store_true', help="DEBUGGING ONLY: blocks all bots on error") parser.add_argument('-p', '--password', default="", help="password for decrypting db") parser.add_argument( '-d', '--delay', type=int, default=10000, help="delay in milliseconds between bot updates. Default 10000.") args = parser.parse_args() if not args.password: password = entered_password else: password = args.password root = tk.Tk() root.title("merkato (pre-release)") mystyle = ttk.Style() mystyle.theme_use('clam') # ('clam', 'alt', 'default', 'classic') mystyle.configure("app.TLabel", foreground="white", background="black", font=('Liberation Mono', '10', 'normal')) # "#4C4C4C") mystyle.configure("unlocked.TLabel", foreground="light green", background="black", font=('Liberation Mono', '12', 'normal')) # "#4C4C4C") mystyle.configure("smaller.TLabel", foreground="white", background="black", font=('Liberation Mono', '10', 'normal')) # "#4C4C4C") mystyle.configure("heading.TLabel", foreground="white", background="black", font=('Liberation Mono', '36', 'normal')) # "#4C4C4C") mystyle.configure("app.TFrame", foreground="gray55", background="black") # "#4C4C4C",) mystyle.configure("app.TButton", foreground="gray55", background="#D15101", activeforeground="#F2681C") # F2681C mystyle.configure("app.TCheckbutton", foreground="gray55", background="black") # "#4C4C4C") mystyle.configure("app.TCombobox", background="#F2681C", selectbackground="#D15101") # postoffset = (0,0,500,0)) mystyle.configure("app.TEntry", foreground="black", background="gray55") mystyle.configure("pass.TEntry", foreground="gray55", background="gray55", insertofftime=5000) root.option_add("*TCombobox*Listbox*selectBackground", "#D15101") # ------------------------------ if db.no_merkatos_table_exists(): db.create_merkatos_table() if db.no_exchanges_table_exists(): db.create_exchanges_table() test = konfig.encrypt_keys( dict(exchange="test", public_api_key='abc', private_api_key='123', limit_only=True), password) db.insert_exchange(**test) merkatos = db.get_all_merkatos() complete_merkato_configs = generate_complete_merkato_configs(merkatos) # ------------------------------ app = App(master=root, block_on_error=args.blockOnError, password=password, delay=args.delay, side=tk.RIGHT) for persisted in complete_merkato_configs: # pprint(persisted) konfig.decrypt_keys(config=persisted['configuration'], password=password) bot = Bot(root, app(), app, persist=persisted) app.add_screen(bot, "null", textvariable=bot.title_var, bg="gray75", fg="black", selectcolor="lightblue") for i in range(1): bot = Bot( root, app(), app, ) app.add_screen(bot, "null", textvariable=bot.title_var, bg="gray75", fg="black", selectcolor="lightblue") root.after(1000, lambda: app.update_frames(initialize=True)) root.after(100, app.finish_new_button()) mainloop()
def insert_config_into_exchanges(config): limit_only = config["limit_only"] public_key = config["public_api_key"] private_key = config["private_api_key"] exchange = config["exchange"] insert_exchange(exchange, public_key, private_key, limit_only)