Пример #1
0
 def run(self):
     try:
         chancecoind.set_options()
         db = util.connect_to_db()
         blocks.follow(db)
     except:
         pass
Пример #2
0
 def run(self):
     try:
         chancecoind.set_options()
         db = util.connect_to_db()
         blocks.follow(db)
     except:
         pass
Пример #3
0
    elif args.action == 'market':
        while True:
            market(args.give_asset, args.get_asset)

    elif args.action == 'purge':
        config.zeromq_publisher = zeromq.ZeroMQPublisher()
        config.zeromq_publisher.daemon = True
        config.zeromq_publisher.start()
        blocks.purge(db)
           
    elif args.action == 'help':
        parser.print_help()

    elif args.action == 'server':
        api_server = api.APIServer()
        api_server.daemon = True
        api_server.start()

        #throw a reference into config so that other modules can reference the thread to put messages into the queue
        config.zeromq_publisher = zeromq.ZeroMQPublisher()
        config.zeromq_publisher.daemon = True
        config.zeromq_publisher.start()

        blocks.follow(db)

    else:
        parser.print_help()

# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
Пример #4
0
    elif args.action == 'pending':
        awaiting_btcs = util.get_order_matches(db,
                                               validity='pending',
                                               is_mine=True)
        table = PrettyTable(['Matched Order ID', 'Time Left'])
        for order_match in awaiting_btcs:
            order_match = format_order_match(db, order_match)
            table.add_row(order_match)
        print(table)

    # PARSING
    elif args.action == 'reparse':
        blocks.reparse(db)

    elif args.action == 'rollback':
        blocks.reparse(db, block_index=args.block_index)

    elif args.action == 'server':
        api_server = api.APIServer()
        api_server.daemon = True
        api_server.start()
        blocks.follow(db)

    elif args.action == 'potentials':
        blocks.get_potentials(db)

    else:
        parser.print_help()

# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
Пример #5
0
        # Balances.
        balances = history['balances']
        table = PrettyTable(['Asset', 'Amount'])
        for balance in balances:
            asset = util.get_asset_name(balance['asset_id'])
            amount = util.devise(balance['amount'], balance['asset_id'], 'output')
            table.add_row([asset, amount])
        print(colorama.Fore.WHITE + colorama.Style.BRIGHT + 'Balances' + colorama.Style.RESET_ALL)
        print(colorama.Fore.CYAN + str(table) + colorama.Style.RESET_ALL)
        print('\n')
 
        # Sends.
        sends = history['sends']
        table = PrettyTable(['Amount', 'Asset', 'Source', 'Destination', 'Tx Hash'])
        for send in sends:
            amount = util.devise(send['amount'], send['asset_id'], 'output')
            asset = util.get_asset_name(send['asset_id'])
            table.add_row([amount, asset, send['source'], send['destination'], util.short(send['tx_hash'])])
        print(colorama.Fore.WHITE + colorama.Style.BRIGHT + 'Sends' + colorama.Style.RESET_ALL)
        print(colorama.Fore.YELLOW + str(table) + colorama.Style.RESET_ALL)
        print('\n')

    elif args.action == 'help':
        parser.print_help()

    else:
        bitcoin.bitcoind_check()
        blocks.follow()

# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
Пример #6
0
        api_status_poller.start()

        api_server = api.APIServer()
        api_server.daemon = True
        api_server.start()

        # Check blockchain explorer.
        if not config.FORCE:
            time_wait = 10
            num_tries = 10
            for i in range(1, num_tries + 1):
                try:
                    blockchain.check()
                except Exception as e: # TODO
                    logging.exception(e)
                    logging.warn("Blockchain backend (%s) not yet initialized. Waiting %i seconds and trying again (try %i of %i)..." % (
                        config.BLOCKCHAIN_SERVICE_NAME, time_wait, i, num_tries))
                    time.sleep(time_wait)
                else:
                    break
            else:
                raise Exception("Blockchain backend (%s) not initialized! Aborting startup after %i tries." % (
                    config.BLOCKCHAIN_SERVICE_NAME, num_tries))

        blocks.follow(db, proxy)

    else:
        parser.print_help()

# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4