Exemple #1
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """ Get the Bitcoin sensor. """

    from blockchain.wallet import Wallet
    from blockchain import exchangerates, exceptions

    wallet_id = config.get('wallet', None)
    password = config.get('password', None)
    currency = config.get('currency', 'USD')

    if currency not in exchangerates.get_ticker():
        _LOGGER.error('Currency "%s" is not available. Using "USD".', currency)
        currency = 'USD'

    wallet = Wallet(wallet_id, password)

    try:
        wallet.get_balance()
    except exceptions.APIException as error:
        _LOGGER.error(error)
        wallet = None

    data = BitcoinData()
    dev = []
    if wallet is not None and password is not None:
        dev.append(BitcoinSensor(data, 'wallet', currency, wallet))

    for variable in config['display_options']:
        if variable not in OPTION_TYPES:
            _LOGGER.error('Option type: "%s" does not exist', variable)
        else:
            dev.append(BitcoinSensor(data, variable, currency))

    add_devices(dev)
Exemple #2
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """ Get the Bitcoin sensor. """

    from blockchain.wallet import Wallet
    from blockchain import exchangerates, exceptions

    wallet_id = config.get('wallet', None)
    password = config.get('password', None)
    currency = config.get('currency', 'USD')

    if currency not in exchangerates.get_ticker():
        _LOGGER.error('Currency "%s" is not available. Using "USD".', currency)
        currency = 'USD'

    wallet = Wallet(wallet_id, password)

    try:
        wallet.get_balance()
    except exceptions.APIException as error:
        _LOGGER.error(error)
        wallet = None

    data = BitcoinData()
    dev = []
    if wallet is not None and password is not None:
        dev.append(BitcoinSensor(data, 'wallet', currency, wallet))

    for variable in config['display_options']:
        if variable not in OPTION_TYPES:
            _LOGGER.error('Option type: "%s" does not exist', variable)
        else:
            dev.append(BitcoinSensor(data, variable, currency))

    add_devices(dev)
Exemple #3
0
def check_btc_balance():
    cursor = connection.cursor()
    cursor.execute("SELECT sum(balance) FROM main_accounts WHERE currency_id=2 AND balance>0 ")
    s = cursor.fetchone() * 1
    if s == (None, ):
        s = Decimal("0.0")
    else:
        (s, ) = s
    cursor.execute("SELECT sum(amnt) FROM main_cryptotransfers WHERE status in "
                   "('processing') AND currency_id=2 AND pub_date>='2015-05-08' ")

    s1 = cursor.fetchone() * 1
    if s1 == (None, ):
        s1 = Decimal("0.0")
    else:
        (s1, ) = s1

    Balance1 = 0  #
    Crypton = Wallet(CryptoSettings["BTC"]["host"],
                     CryptoSettings["BTC"]["rpc_user"],
                     CryptoSettings["BTC"]["rpc_pwd"])
    Balance2 = sato2Dec(Crypton.get_balance())
    print Balance2
    print Balance1
    print s
    print s1
    print Balance1 + Balance2
    print s1 + s
    Delta = Balance1 + Balance2 - s - s1
    print "Delta is %s " % Delta
    return Delta >= 0
Exemple #4
0
def send_btc_to_author():
    print "Attempting to send 10000 bits from reader to author for turning page"

    # Set Wallet object to readers wallet
    wallet = Wallet(reader_wallet_id, reader_wallet_password)

    # Send from wallet to new address (Receiving address (AUTHOR), Amount in satoshi, from address (READER))
    payment = wallet.send(author_receive_address, 10000, from_address=reader_send_from_address)

    # Adds 10,000 for some unknown reason in the error message when you try to send again with an unconfirmed transactions

    print "Sent 10000 bits from reader to author for turning page"
    print "Transaction Hash to search blockchain.info to verify transactions: " + str(payment.tx_hash)

    # Return the balance of reader's wallet
    balance = wallet.get_balance()

    print "Current total balance of readers wallet in Satoshi is  " + str(balance)

    # Convert from Satoshi's to bits
    converted_balance = convert_satoshi_to_bits(balance)

    print "Current total balance of readers wallet in Bits is  " + str(converted_balance)

    # return current wallet balance (includes unconfirmed) for front end
    return str(converted_balance)
Exemple #5
0
def getBTC(id, key):
    wallet = Wallet(id, key)
    sbtc = 100000000
    bal = float(wallet.get_balance())
    if bal == 0 or bal == '':
        btc = "balance is zero"
    else:
        btc = bal/sbtc
    return btc
Exemple #6
0
def get_balance(request):
	login=request.GET.get('login')
	password=request.GET.get('password')

	if login and password:
		wallet = Wallet(login, password)
		try:
			balance=wallet.get_balance()
		except BaseException:
			return HttpResponse('{"status":"API not allowed in yours account or login or password is uncorrected"}')
		return HttpResponse('{"status":"ok", "balance":'+ str(balance) +'}')
	return HttpResponse('{"status":"login or password not input"}')
Exemple #7
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """ Get the Bitcoin sensor. """

    try:
        from blockchain.wallet import Wallet
        from blockchain import exchangerates, exceptions

    except ImportError:
        _LOGGER.exception("Unable to import blockchain. " "Did you maybe not install the 'blockchain' package?")

        return False

    wallet_id = config.get("wallet", None)
    password = config.get("password", None)
    currency = config.get("currency", "USD")

    if currency not in exchangerates.get_ticker():
        _LOGGER.error('Currency "%s" is not available. Using "USD".', currency)
        currency = "USD"

    wallet = Wallet(wallet_id, password)

    try:
        wallet.get_balance()
    except exceptions.APIException as error:
        _LOGGER.error(error)
        wallet = None

    data = BitcoinData()
    dev = []
    if wallet is not None and password is not None:
        dev.append(BitcoinSensor(data, "wallet", currency, wallet))

    for variable in config["display_options"]:
        if variable not in OPTION_TYPES:
            _LOGGER.error('Option type: "%s" does not exist', variable)
        else:
            dev.append(BitcoinSensor(data, variable, currency))

    add_devices(dev)
Exemple #8
0
def check_balance():
    print "Checking balance of wallet..."

    # Make sure to grab wallet of reader
    wallet = Wallet(reader_wallet_id, reader_wallet_password)

    # Pull back the balance for readers wallet
    balance = wallet.get_balance()

    print "Current total balance of readers wallet in Satoshi is  " + str(balance)

    converted_balance = convert_satoshi_to_bits(balance)

    print "Current total balance of readers wallet in Bits is  " + str(converted_balance)

    # Return current reader wallet balance for front end
    return str(converted_balance)
Exemple #9
0
def getBTC(id, key):
    wallet = Wallet(id, key)
    sbtc = 100000000
    bal = float(wallet.get_balance())
    btc = bal / sbtc
    return btc
Exemple #10
0
from blockchain.wallet import Wallet

wallet = Wallet('ada4e4b6-3c9f-11e4-baad-164230d1df67', 'password123',
                'http://localhost:3000')

print wallet.get_balance()
Exemple #11
0
from blockchain.wallet import Wallet

wallet = Wallet('ada4e4b6-3c9f-11e4-baad-164230d1df67', 'password123', 'http://localhost:3000')

print wallet.get_balance() 
Exemple #12
0
class BTCProcessor:
    def __init__(self, customer):
        self.customer = customer  #models.Customers.objects.get(id=1) #customer
        if self.customer.btc_wallet() is None:
            self.wallet_generation()
        self.password = self.customer.btc_wallet().password
        self.wallet_id = self.customer.btc_wallet().id
        self.wallet = Wallet(self.wallet_id, self.password,
                             NODE_WALLET_SERVICES)

    def wallet_generation(self, label=None):
        label = label if label is not None else self.customer.user.get_fullname(
        ) + ' wallet'
        user_password = get_random_string(60)
        new_wallet = createwallet.create_wallet(user_password,
                                                API_CODE,
                                                NODE_WALLET_SERVICES,
                                                label=label)
        btc_wallet = BTC(id=new_wallet.identifier,
                         addr=new_wallet.address,
                         label=new_wallet.label,
                         customer=self.customer,
                         password=user_password)
        btc_wallet.save()
        return new_wallet.__dict__

    def wallet_info(self):
        wallet = self.wallet
        return wallet.__dict__

    def new_address(self, label='test_label'):
        newaddr = self.wallet.new_address(label)
        return newaddr

    def list_addresses(self):
        addresses = self.wallet.list_addresses()
        return addresses

    def get_balance(self):
        get_balance = float(self.wallet.get_balance() / 100000000)
        obj, created = models.Balance.objects.get_or_create(
            customer=self.customer, currency='BTC')
        obj.amount = get_balance
        obj.save()
        return get_balance

    def send_tx(self, target_addr, amount, from_address=None):
        amount = amount * 100000000
        payment = self.wallet.send(target_addr, amount, fee=500)  #min fee=220
        return payment.__dict__['tx_hash']

    def send_many_tx(self, recipients):
        # recipients = { '1NAF7GbdyRg3miHNrw2bGxrd63tfMEmJob' : 1428300,
        # 		'1A8JiWcwvpY7tAopUkSnGuEYHmzGYfZPiq' : 234522117 }
        payment_many = self.wallet.send_many(recipients)
        return payment_many.tx_id

    def get_address(self, addr, confirmations=2):
        addr = self.wallet.get_address(addr, confirmations=confirmations)
        return addr

    def archive_address(self, addr):
        archive_address = self.wallet.archive_address(addr)
        return archive_address

    def unarchive_address(self, addr):
        unarchive_address = self.wallet.unarchive_address(addr)
        return unarchive_address

    def push_tx(self, push_code):
        # push_code = '0100000001fd468e431cf5797b108e4d22724e1e055b3ecec59af4ef17b063afd36d3c5cf6010000008c4930460221009918eee8be186035be8ca573b7a4ef7bc672c59430785e5390cc375329a2099702210085b86387e3e15d68c847a1bdf786ed0fdbc87ab3b7c224f3c5490ac19ff4e756014104fe2cfcf0733e559cbf28d7b1489a673c0d7d6de8470d7ff3b272e7221afb051b777b5f879dd6a8908f459f950650319f0e83a5cf1d7c1dfadf6458f09a84ba80ffffffff01185d2033000000001976a9144be9a6a5f6fb75765145d9c54f1a4929e407d2ec88ac00000000'
        pushtxed = pushtx.pushtx(push_code)
        return pushtxed

    def get_price(self, currency, amount):
        btc_amount = exchangerates.to_btc(currency, amount)
        return btc_amount

    def statistics(self):
        stats = statistics.get()
        return stats

    def blockexplorer(self):
        block = blockexplorer.get_block(
            '000000000000000016f9a2c3e0f4c1245ff24856a79c34806969f5084f410680')
        tx = blockexplorer.get_tx(
            'd4af240386cdacab4ca666d178afc88280b620ae308ae8d2585e9ab8fc664a94')
        blocks = blockexplorer.get_block_height(2570)
        address = blockexplorer.get_address(
            '1HS9RLmKvJ7D1ZYgfPExJZQZA1DMU3DEVd')
        xpub = None  #blockexplorer.get_xpub('xpub6CmZamQcHw2TPtbGmJNEvRgfhLwitarvzFn3fBYEEkFTqztus7W7CNbf48Kxuj1bRRBmZPzQocB6qar9ay6buVkQk73ftKE1z4tt9cPHWRn')
        addresses = None  # blockexplorer.get_multi_address('1HS9RLmKvJ7D1ZYgfPExJZQZA1DMU3DEVd', 'xpub6CmZamQcHw2TPtbGmJNEvRgfhLwitarvzFn3fBYEEkFTqztus7W7CNbf48Kxuj1bRRBmZPzQocB6qar9ay6buVkQk73ftKE1z4tt9cPHWRn')
        outs = blockexplorer.get_unspent_outputs(
            '1HS9RLmKvJ7D1ZYgfPExJZQZA1DMU3DEVd')
        latest_block = blockexplorer.get_latest_block()
        txs = blockexplorer.get_unconfirmed_tx()
        blocks_by_name = None  #blockexplorer.get_blocks(pool_name = 'Discus Fish')

    def get_target_wallet_addr(self, customer=None, email=None):
        if customer is not None:
            return customer.btc_wallet().addr
        if email is not None:
            user = models.Users.objects.get(email=email)
            return user.customer().btc_wallet().addr
        return None
def parser(origination_number,input,bank):

    #split the input 
    mod_input = input.split()
    verb = mod_input[0]
    
    if (verb == "my_number"):
        return origination_number

    #CREATE
    if(verb == "create"):
        # phone_number = origination_number
        identifier = mod_input[1]
        address = mod_input[2]
        pw = mod_input[3]
        #act = account(origination_number, identifier, address, pw,bank)
        bank.add_account(origination_number, identifier, address, pw)
        act = bank.get_account(origination_number)
        return "account created for {0}".format(act.account_id)

    
    caller = bank.get_account(origination_number)
    
    #Amount account
    if (verb == "balance"):
        #account = mod_input[1]
        return "balance {0}".format(caller.wallet.get_balance())
   
    #combine     
    if (verb == "combine"):
        identifier = mod_input[1]
        outgoing = mod_input[2]
        #password = mod_input[2]
        wallet = Wallet(identifier, 'Boondock2013')
        #failsafe: only import 10 satoshi max
        previous_balance = wallet.get_balance()
        previous_balance = min(previous_balance, 10)
        ra = caller.address.address
        rw = caller.wallet
        print ra
        print previous_balance
        #outgoing_addr = wallet.get_address(outgoing)
        print outgoing
        wallet.send(ra, previous_balance, outgoing)
        #current_balance = rw.get_balance()
        return "Successfully moved {0} satoshi from {1} to {2}: ".format(previous_balance, outgoing, ra )

    #INFO
    if (verb == "account_info"):
        #account = mod_input[1]
        return "Blockchain Wallet: {0}\n Address: {1}".format(caller.wallet.identifier, caller.address)

    #WITHDRAW
    if (verb == "withdraw"):
        accountID = mod_input[1]
        amount = mod_input[2]

        #check if amount is valid
        amount = get_satoshis(amount)
        if(amount < 0):
            return "Invalid quantity specified: amount must be a valid currency valued at greater than 1 satoshi"


        #check if the user has the account that they want to draw from 
        if (accountID in caller.waccounts ):
            
            #get the actual account from the bank 
            account = bank.get_account(accountID)

            if (hasFunds(amount, account)):
                withdraw(account, caller, amount)
                return "SUCCESS " + input

        else:
            return "Invalid/Unknown account"


    #DEPOSIT
    if (verb == "deposit"):
        accountID = mod_input[1]
        amount = mod_input[2]

        #check if amount is valid
        amount = get_satoshis(amount)
        if(amount < 0):
            return "Invalid quantity specified: amount must be a valid currency valued at greater than 1 satoshi"

        if (accountID in caller.daccounts):
            
            act = bank.get_account(accountID)
            deposit(act,caller,amount)
            return ("SUCCESS " + input)

        else:
            return "Invalid/Unknown account"

    #bxb
    if (verb == "bxb"):
        pn = mod_input[1]
        amount = mod_input[2]

        #check if amount is valid
        #amount = get_satoshis(amount)
        if(amount < 0):
            return "Invalid quantity specified: amount must be a valid currency valued at greater than 1 satoshi"

        # if (accountID in caller.daccounts):
            
        else: 
            act = bank.get_account(pn)
            transaction.deposit(act,caller,amount,15000)
            return ("SUCCESS " + input)

    else:
        return "Invalid/Unknown account"


    


    #ADD, this adds money to an account, gives a person the ability to access the account, what percent of the money they have access to     
    if (verb == "add"):
        #def account_to_person(self, account, person, permission, person_to_percent = 1.0):

        #this is the account you are sending the coins from
        act = origination_number

        #this is the phone number you are sending the coins to. 
        desitnation_phone = mod_input[1]

        #this is the permission that you want to give the person 
        permission = mod_input[2]

        #this is the amount of coins you are sending 
        amount = get_satoshis(mod_input[3])
        if(amount < 0):
            return "Invalid quantity specified: amount must be a valid currency valued at greater than 1 satoshi"

        #this is the percent they can withdraw ONLY if they are actually withdrawers 
        percent = mod_input[4]

        #this checks if the persons phone number is in the bank keys 
        if (not(desitnation_phone in bank.accounts.keys())):
            return "Person doesn't exist"

        actual_amount = (amount * percent)

        if (not(hasFunds(act,amount))):
            return "Not enough coins to make transfer"

        #transfers from an account to a person: 
            # 1. take the account we are transferring from!
            # 2. the desitnation_phone we are sending it to. 
            # 3. permission whether they can take or depsoit
            # 4. the amount we are actually transferring
            # 5. the percent to transfer

        #account_to_person(account,desitnation_phone,permission,actual_amount)
    else:
        return "Unknown verb!"
Exemple #14
0
def check_btc_balance(verbose=False):
    cursor = connection.cursor()
    cursor.execute(
        "SELECT sum(balance) FROM main_accounts WHERE currency_id=2 AND balance>0 "
    )
    s = cursor.fetchone() * 1
    if s == (None, ):
        s = Decimal("0.0")
    else:
        (s, ) = s
    main_account = Accounts.objects.get(id=13)

    blockchain.util.TIMEOUT = 300

    cursor.execute(
        "SELECT sum(if(debit_credit='in',-1*amnt, amnt)) "
        "FROM main_cryptotransfers WHERE status in ('processing','created','processing2')   AND currency_id=2 AND pub_date>='2015-05-08' "
    )

    s1 = cursor.fetchone() * 1
    if s1 == (None, ):
        s1 = Decimal("0.0")
    else:
        (s1, ) = s1
    SERVICE_URL = settings.blockchaininfo_service
    (Balance1, Balance2, Balance3, Balance4, Balance5, Balance6,
     Balance8) = (0, 0, 0, 0, 0, 0, 0)
    Balance7 = 0
    Balance9 = 0
    Balance10 = 0
    Balance11 = 0
    Balancecold = sato2Dec(get_balance("1AMTTKEAav9aQDotyhNg4Z7YSUBYTTA6ds",
                                       0))
    Balancecold = sato2Dec(get_balance("19jHRHwuHnQQVajRrW976aCXYYdgij8r43",
                                       0)) + Balancecold
    Balancecold = sato2Dec(get_balance("17iAu7iSSwo9VGeNn6826Lz1qLPq152xAW",
                                       0)) + Balancecold
    Balancecold = sato2Dec(get_balance("15c3H6jhQys8b8M5vszx2s21UNDH3caz9P",
                                       0)) + Balancecold
    Balancecold = sato2Dec(get_balance("19YxpMLUAdZoJpUBqwURcJzd2zs4knMvGV",
                                       0)) + Balancecold

    Balance1 = sato2Dec(get_balance("167GWdfvG4JtkFErq4qBBLqKYFK26dhgDJ",
                                    0)) + Balance1
    Balance1 = sato2Dec(get_balance("1Q1woBCCGiuELYzVvS3hCgSs6pFKuqHNpt",
                                    0)) + Balance1
    Balance1 = sato2Dec(get_balance("19TaiL4j288Zgm1AQXUwMcyLup7vki54Fs",
                                    0)) + Balance1
    Balance1 = sato2Dec(get_balance("13EDdpizTP3grQQAnpCtSJNTTwkDkV9VeB",
                                    0)) + Balance1
    Balance1 = sato2Dec(get_balance("1AXKnEK3P1tiHEBAVpDzg4k3yXosR5oKL8",
                                    0)) + Balance1
    Balance1 = sato2Dec(get_balance("1GjthoqTvBq1N8KkKVEDHV9b8snmt2ehcS",
                                    0)) + Balance1
    Balance1 = sato2Dec(get_balance("1LvDnHktCL77r16eimv7Fr9d5xDieb1wFC",
                                    0)) + Balance1
    Balancecold = sato2Dec(get_balance("15jsdKn3L8ExQngY8HRRUz3prof8mAn8yr",
                                       0)) + Balancecold
    HotWalletBalance = sato2Dec(
        get_balance("1LNYCGkXtJscvMHHucEfpxWMBnf33Ke18W", 0))

    Crypton = Wallet("2b835907-d012-4552-830c-6116ab0178f2",
                     "#Prikol13_",
                     service_url=SERVICE_URL,
                     api_code="b720f286-9b3f-452c-b93c-969c8dd3967f")
    Crypton1 = Wallet("772bb645-48f5-4328-9c3d-3838202132d6",
                      "xxx_21_34_Zb",
                      service_url=SERVICE_URL,
                      api_code="b720f286-9b3f-452c-b93c-969c8dd3967f")
    Crypton2 = Wallet("ee23c1bd-d3dd-4661-aef5-8e342c7f5960",
                      "xxx_21_34_Zb",
                      service_url=SERVICE_URL,
                      api_code="b720f286-9b3f-452c-b93c-969c8dd3967f")
    Crypton3 = Wallet("e6202826-bb24-435c-8350-b4a942b4380b",
                      "xxx_21_34_Zb",
                      service_url=SERVICE_URL,
                      api_code="b720f286-9b3f-452c-b93c-969c8dd3967f")
    Crypton4 = Wallet("3ccaa767-770f-476f-a836-9db1c005055e",
                      "_quenobi8610",
                      service_url=SERVICE_URL,
                      api_code="b720f286-9b3f-452c-b93c-969c8dd3967f")
    Crypton5 = Wallet("caa19b23-198a-4aad-a9c0-3f80efe37118",
                      "dirty_43_13",
                      service_url=SERVICE_URL,
                      api_code="b720f286-9b3f-452c-b93c-969c8dd3967f")
    Crypton6 = Wallet("14ef48bb-4d71-4bc4-be34-75ba0978202f",
                      "dirty_43_13",
                      service_url=SERVICE_URL,
                      api_code="b720f286-9b3f-452c-b93c-969c8dd3967f")
    Crypton7 = Wallet("913d6442-fc77-4b7b-b5f8-af272e458897",
                      "xxx_21_34_Zb",
                      service_url=SERVICE_URL,
                      api_code="b720f286-9b3f-452c-b93c-969c8dd3967f")
    Crypton8 = Wallet("5432b01c-f67e-473e-aa4c-29cd9682b259",
                      "xxx_21_34_Zb",
                      service_url=SERVICE_URL,
                      api_code="b720f286-9b3f-452c-b93c-969c8dd3967f")  #
    Crypton9 = Wallet("a2ba7138-2bd3-4898-b68b-d0908d40bc4d",
                      "xxx_21_34_Zb",
                      api_code="b720f286-9b3f-452c-b93c-969c8dd3967f",
                      service_url=SERVICE_URL)  #

    Crypton10 = Wallet("d8d5ce8a-6ff9-4f7e-80f3-08cac5788781",
                       "xxx_21_34_Zb",
                       api_code="b720f286-9b3f-452c-b93c-969c8dd3967f",
                       service_url=SERVICE_URL)  #

    Crypton11 = Wallet("eb836197-285e-44ee-a8cf-5642a02e6250",
                       "#Prikol13_",
                       api_code="b720f286-9b3f-452c-b93c-969c8dd3967f",
                       service_url=SERVICE_URL)  #
    Crypton12 = Wallet("c800e14e-95d4-4fcf-816b-696fbaaf5741",
                       "xxx_21_34_Zb",
                       api_code="b720f286-9b3f-452c-b93c-969c8dd3967f",
                       service_url=SERVICE_URL)

    Crypton13 = Wallet("e60c37e7-4375-44ea-b167-a63b453c14a1",
                       "#Prikol13_",
                       api_code="b720f286-9b3f-452c-b93c-969c8dd3967f",
                       service_url=SERVICE_URL)

    Crypton14 = Wallet("118344b4-5d26-4cfe-871a-0c3393ee5db0",
                       "#Prikol13_",
                       api_code="b720f286-9b3f-452c-b93c-969c8dd3967f",
                       service_url=SERVICE_URL)
    Crypton15 = Wallet("f252bb25-6b99-4e49-a5cf-41489eefb728",
                       "#Prikol13_",
                       api_code="b720f286-9b3f-452c-b93c-969c8dd3967f",
                       service_url=SERVICE_URL)
    Crypton16 = Wallet("5a778945-fbb4-4692-b448-fd5b513c008d",
                       "#Prikol13_",
                       api_code="b720f286-9b3f-452c-b93c-969c8dd3967f",
                       service_url=SERVICE_URL)
    Balance2 = sato2Dec(Crypton.get_balance())
    print "Balance of hot wallet 1 " + str(Balance2)

    Balance3 = sato2Dec(Crypton1.get_balance()) + sato2Dec(
        Crypton4.get_balance())
    print "Balance of hot wallet 2 " + str(Balance3)
    Balance4 = sato2Dec(Crypton2.get_balance())
    print "Balance of hot wallet 3 " + str(Balance4)
    Balance5 = sato2Dec(Crypton3.get_balance())
    print "Balance of hot wallet 4 " + str(Balance5)
    Balance6 = sato2Dec(Crypton5.get_balance())
    print "Balance of hot wallet 5 " + str(Balance6)
    Balance7 = sato2Dec(Crypton6.get_balance())
    print "Balance of hot wallet 6 " + str(Balance7)
    Balance8 = sato2Dec(Crypton7.get_balance())
    print "Balance of hot wallet 7 " + str(Balance8)

    Balance9 = sato2Dec(Crypton8.get_balance())
    print "Balance of hot wallet 8 " + str(Balance9)
    Balance10 = sato2Dec(Crypton9.get_balance())
    print "Balance of hot wallet 9 " + str(Balance10)

    Balance11 = sato2Dec(Crypton10.get_balance())
    print "Balance of hot wallet 10 " + str(Balance11)

    Balance12 = sato2Dec(Crypton11.get_balance())
    print "Balance of hot wallet 12 " + str(Balance12)

    Balance13 = sato2Dec(Crypton12.get_balance())
    print "Balance of hot wallet 13 " + str(Balance13)
    Balance14 = sato2Dec(Crypton13.get_balance())
    print "Balance of hot wallet 14 " + str(Balance14)
    Balance15 = sato2Dec(Crypton14.get_balance())
    print "Balance of hot wallet 15 " + str(Balance15)

    Balance16 = sato2Dec(Crypton15.get_balance())
    print "Balance of hot wallet 16 " + str(Balance16)
    Balance17 = sato2Dec(Crypton16.get_balance())
    print "Balance of hot wallet 17 " + str(Balance17)
    Dismiss = Decimal("0.0")
    Crypton = CryptoAccount("BTC", "trade_stock")
    LChange = Crypton.listaddressgroupings()
    BalanceCore = Decimal(str(Crypton.getbalance()))
    if False:
        for adres in LChange[0]:
            if not adres[0] in ("1LNYCGkXtJscvMHHucEfpxWMBnf33Ke18W",
                                "1CzLixrLpf6LRiiqH5jMZ7dD3GP2gDJ4xw",
                                "1FLCVHDDwJmimjgch5s4CtjpbNn5pQ3mAi"):
                BalanceCore += Decimal(str(adres[1]))

    BalanceOnHots = BalanceCore + Balance11 + Balance10 + Balance1 + Balance2 + Balance3 + Balance4 + Balance5 + Balance6 + Balance7 + Balance8 + Balance9 + Balance12 + Balance13 + Balance14 + Balance15 + Balance16 + Balance17

    print "our core wallet " + str(BalanceCore)
    print "Correction " + str(Dismiss)
    print "balance of cold wallet " + str(Balancecold)
    print "balance on hots wallet " + str(BalanceOnHots)
    print "balance of accounts " + str(s)
    print "main accounts balance " + str(main_account.balance)
    print "checking consistens %s" % (s + main_account.balance)
    print "balance of processing  " + str(s1)
    print "sum on walletes " + str(Balancecold + BalanceOnHots)
    print "sum in system " + str(s1 + s)
    change_volitile_const("balance_corr_BTC", Dismiss)
    change_volitile_const("balance_out_BTC", str(Balancecold + BalanceOnHots))

    Delta = Balancecold + BalanceOnHots - s - s1 + Dismiss
    print "Delta is %s " % Delta
    return Delta >= 0
Exemple #15
0
def getBTC(id, key):
    wallet = Wallet(id, key)
    sbtc = 100000000
    bal = float(wallet.get_balance())
    btc = bal/sbtc
    return btc