Exemplo n.º 1
0
def get_coinbase_balance(COINBASE_API_KEY,COINBASE_API_SECRET):
    client = coinbase_api.client(credentials.COINBASE_API_KEY,credentials.COINBASE_API_SECRET)
    accounts = client.get_accounts()["data"]
    text = ""
    for account in accounts:
        text+="\n%s : %s (*%s%s*)" % (account.balance.currency,account.balance.amount,account.native_balance.amount,account.native_balance.currency)
    return text
Exemplo n.º 2
0
 def test_tx2(self):
     client = coinbase_api.client(credentials.COINBASE_API_KEY,credentials.COINBASE_API_SECRET)
     tx_id = "da5769b3-4da4-56f8-8c41-c8cb8085bfb2"
     transaction = coinbase_api.tx(client,tx_id)
     #print transaction
     #print(coinbase_transaction_info(transaction))
     self.assertEqual("send",transaction.type)
     self.assertEqual("confirmed",transaction.network.status)
Exemplo n.º 3
0
 def test_all(self):
     client = coinbase_api.client(credentials.COINBASE_API_KEY,credentials.COINBASE_API_SECRET)
     # print(user)
     accounts = client.get_accounts()["data"]
     #print accounts
     #print(client.get_primary_account())
     for account in accounts:
         for tx in account.get_transactions()["data"]:
             transaction = coinbase_api.tx(client,tx.id)
Exemplo n.º 4
0
 def test_account(self):
     client = coinbase_api.client(credentials.COINBASE_API_KEY,credentials.COINBASE_API_SECRET)
     currencies = ["ETH","LTC","BCH"]
     for currency in currencies:
         try:
             account = coinbase_api.account(client,currency)
             self.assertLess(0,account.balance.amount) 
         except UserWarning as e:
             #print e
             pass
Exemplo n.º 5
0
def send_coinbase_koinex(COINBASE_API_KEY,COINBASE_API_SECRET,amount,currency):
    from exchanges import koinex
    client = coinbase_api.client(COINBASE_API_KEY,COINBASE_API_SECRET)
    to = koinex.ADDRESSES.get(currency)
    if to == None:
        raise UserWarning("No koinex address for currency:%s" % currency)
    tx = coinbase_api.send(client,to,amount,currency)
    print(tx)
    target_confirmations = koinex.CONFIRMATIONS.get(tx["to"]["currency"])
    logging.info(tx)
    return (tx,target_confirmations)
Exemplo n.º 6
0
 def test_zero_amount(self):
     client = coinbase_api.client(credentials.COINBASE_API_KEY,credentials.COINBASE_API_SECRET)
     self.assertRaises(UserWarning,send_coinbase_coindelta,credentials.COINBASE_API_KEY,credentials.COINBASE_API_SECRET,0,"ETH")
Exemplo n.º 7
0
 def test_tx_bad(self):
     client = coinbase_api.client(credentials.COINBASE_API_KEY,credentials.COINBASE_API_SECRET)
     self.assertRaises(UserWarning,coinbase_api.tx,client,"")
Exemplo n.º 8
0
 def test_tx(self):
     client = coinbase_api.client(credentials.COINBASE_API_KEY,credentials.COINBASE_API_SECRET)
     tx_id = "e0f5eff6-54bd-59f0-bd70-42af7d967791"
     transaction = coinbase_api.tx(client,tx_id)
     self.assertEqual("send",transaction.type)
     self.assertEqual("confirmed",transaction.network.status)
Exemplo n.º 9
0
 def test_client(self):
     client = coinbase_api.client(credentials.COINBASE_API_KEY,credentials.COINBASE_API_SECRET)
     user = client.get_current_user()
     self.assertEqual("3a2b719d-f765-52ba-a027-a91d1965972e",user.id)
     self.assertEqual("Varun Kohli",user.name)
Exemplo n.º 10
0
def get_transaction(id):
    from exchanges import coinbase_api
    client = coinbase_api.client(credentials.COINBASE_API_KEY,
                                 credentials.COINBASE_API_SECRET)
    transaction = coinbase_api.tx(client, id)
    return transaction