本文整理汇总了Python中wallet.Wallet.balance方法的典型用法代码示例。如果您正苦于以下问题:Python Wallet.balance方法的具体用法?Python Wallet.balance怎么用?Python Wallet.balance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wallet.Wallet
的用法示例。
在下文中一共展示了Wallet.balance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from wallet import Wallet [as 别名]
# 或者: from wallet.Wallet import balance [as 别名]
class Cashier:
_exchanges = exchanges.actived_exchanges
def __init__(self):
self.wallet = Wallet()
self.qty_per_order = config.configuration['qty_per_order']
def post_transfers(self, buy_account, sell_account):
'''交易完成以后的比特币转账
流程:
1. 检查钱包是否有足够余额
2.1 有余额则先发送比特币给卖方
2. 买方转移比特币到钱包
'''
buy_ex = Trader._exchanges[buy_account.name]
sell_ex = Trader._exchanges[sell_account.name]
wallet_balance = self.wallet.balance()
if wallet_balance > self.qty_per_order:
self.wallet.withdraw(sell_account.stock_deposit_address, self.qty_per_order)
buy_ex.withdraw_stock(self.qty_per_order)
def make_balance(self, accounts):
wallet_balance = self.wallet.balance()
for a in accounts:
if a.stock_balance < self.qty_per_order and wallet_balance > self.qty_per_order:
_logger.info('[CASHIER]\t\t Transfering BTC from wallet to account "{0}", qty={1}'
.format(a.name, self.qty_per_order))
self.wallet.withdraw(a.stock_deposit_address, self.qty_per_order)
wallet_balance -= self.qty_per_order