def format_feed (feed): timestamp = util.isodt(feed['timestamp']) if not feed['text']: text = '<Locked>' else: text = feed['text'] return [feed['source'], timestamp, text, feed['value'], D(feed['fee_fraction_int']) / D(1e8)]
def format_feed (feed): timestamp = util.isodt(feed['timestamp']) if not feed['text']: text = '<Locked>' else: text = feed['text'] return [feed['source'], timestamp, text, feed['value'], D(feed['fee_multiplier']) / D(1e8)]
def format_bet (bet): odds = D(bet['counterwager_quantity']) / D(bet['wager_quantity']) if not bet['target_value']: target_value = None else: target_value = bet['target_value'] if not bet['leverage']: leverage = None else: leverage = util.devise(db, D(bet['leverage']) / 5040, 'leverage', 'output') return [util.BET_TYPE_NAME[bet['bet_type']], bet['feed_address'], util.isodt(bet['deadline']), target_value, leverage, str(bet['wager_remaining'] / config.UNIT) + ' XCP', util.devise(db, odds, 'odds', 'output'), bet['expire_index'] - util.last_block(db)['block_index'], bet['tx_hash']]
def format_bet (bet): odds = D(bet['counterwager_amount']) / D(bet['wager_amount']) wager_remaining = D(bet['wager_remaining']) counterwager_remaining = round(wager_remaining * odds) if not bet['target_value']: target_value = None else: target_value = bet['target_value'] if not bet['leverage']: leverage = None else: leverage = util.devise(db, D(bet['leverage']) / 5040, 'leverage', 'output') return [util.BET_TYPE_NAME[bet['bet_type']], bet['feed_address'], util.isodt(bet['deadline']), target_value, leverage, str(wager_remaining / config.UNIT) + ' XCP', str(counterwager_remaining / config.UNIT) + ' XCP', util.devise(db, odds, 'odds', 'output'), util.get_time_left(bet), util.short(bet['tx_hash'])]
# VIEWING (temporary) elif args.action == 'balances': try: bitcoin.base58_decode(args.address, config.ADDRESSVERSION) except Exception: raise exceptions.InvalidAddressError('Invalid Bitcoin address:', args.address) balances(args.address) elif args.action == 'asset': results = util.api('get_asset_info', ([args.asset],))[0] # HACK asset_id = util.get_asset_id(args.asset) divisible = results['divisible'] total_issued = util.devise(db, results['total_issued'], args.asset, dest='output') call_date = util.isodt(results['call_date']) if results['call_date'] else results['call_date'] call_price = str(results['call_price']) + ' XCP' if results['call_price'] else results['call_price'] print('Asset Name:', args.asset) print('Asset ID:', asset_id) print('Divisible:', divisible) print('Total Issued:', total_issued) print('Issuer:', results['issuer']) print('Callable:', results['callable']) print('Call Date:', call_date) print('Call Price:', call_price) print('Description:', '‘' + results['description'] + '’') print('Shareholders:') balances = util.get_balances(db, asset=args.asset) # + util.get_escrowed(db, asset=asset) print('\taddress, quantity, escrow')
bitcoin.base58_decode(args.address, config.ADDRESSVERSION) except Exception: raise exceptions.InvalidAddressError('Invalid Bitcoin address:', args.address) balances(args.address) elif args.action == 'asset': results = util.api('get_asset_info', [args.asset]) asset_id = util.get_asset_id(args.asset) divisible = results['divisible'] total_issued = util.devise(db, results['total_issued'], args.asset, dest='output') call_date = util.isodt( results['call_date'] ) if results['call_date'] else results['call_date'] call_price = str(results['call_price']) + ' XCP' if results[ 'call_price'] else results['call_price'] print('Asset Name:', args.asset) print('Asset ID:', asset_id) print('Divisible:', divisible) print('Total Issued:', total_issued) print('Issuer:', results['issuer']) print('Callable:', results['callable']) print('Call Date:', call_date) print('Call Price:', call_price) print('Description:', '‘' + results['description'] + '’') elif args.action == 'wallet':
'utf-8') == '010966776006953D5567439E5E39F86A0D273BEE'.lower() assert len(pubkeyhash) == 20 """ follow() reorg() asset lock asset transfer expire order matches expire bet matches cancelling bets, orders bet_match order_match get_tx_info rpc bitcoind_check serialize get_inputs transaction """ """ Too small: util.isodt() util.devise() bet.get_fee_multiplier() """
follow() reorg() asset lock asset transfer expire order matches expire bet matches cancelling bets, orders bet_match order_match get_tx_info rpc bitcoind_check serialize get_inputs transaction """ """ Too small: util.isodt() util.devise() bet.get_fee_multiplier() """
total = util.devise(db, total, args.asset, 'output') divisible = bool(issuances[-1]['divisible']) issuer = issuances[-1]['issuer'] # Issuer of last issuance. callable_ = None call_date = issuances[-1]['call_date'] call_price = issuances[-1]['call_price'] description = issuances[-1]['description'] asset_id = util.get_asset_id(args.asset) print('Asset Name:', args.asset) print('Asset ID:', asset_id) print('Total Issued:', total) print('Divisible:', divisible) print('Issuer:', issuer) print('Callable:', callable_) print('Call Date:', util.isodt(call_date) if call_date else call_date) print('Call Price:', str(call_price) + ' XCP' if call_price else call_price) print('Description:', description) elif args.action == 'wallet': total_table = PrettyTable(['Asset', 'Balance']) totals = {} print() # TODO: This should be burns minus issuance fees (so it won’t depend on escrowed funds). for group in bitcoin.rpc('listaddressgroupings', []): for bunch in group: address, btc_balance = bunch[:2] get_address = util.get_address(db, address=address) balances = get_address['balances'] table = PrettyTable(['Asset', 'Balance'])