当前位置: 首页>>代码示例>>Python>>正文


Python Wallet.balance方法代码示例

本文整理汇总了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
开发者ID:LaiYongqiang,项目名称:brickmover,代码行数:31,代码来源:main.py


注:本文中的wallet.Wallet.balance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。