Example #1
0
 def test_key_info(self):
     for key in self.key_handler.keys:
         t = liqui_client.TradeAPI(key, self.key_handler,
                                   self.connection)
         r = t.getInfo()
Example #2
0
import liqui_client

if len(sys.argv) < 2:
    print("Usage: compute-account-value.py <key file>")
    print("    key file - Path to a file containing key/secret/nonce data")
    sys.exit(1)

key_file = sys.argv[1]
with liqui_client.KeyHandler(key_file) as handler:
    if not handler.keys:
        print("No keys in key file.")
    else:
        for key in handler.keys:
            print("Computing value for key %s" % key)
            with liqui_client.BTCEConnection() as connection:
                t = liqui_client.TradeAPI(key, handler, connection)

                try:
                    r = t.getInfo()

                    exchange_rates = {}
                    for pair in t.apiInfo.pair_names:
                        asks, bids = liqui_client.getDepth(pair)
                        exchange_rates[pair] = bids[0][0]

                    btc_total = 0
                    for currency in t.apiInfo.currencies:
                        balance = r.funds[currency]
                        if currency == "btc":
                            print("\t%s balance: %s" %
                                  (currency.upper(), balance))
Example #3
0
 def test_construction(self):
     keys = list(self.key_handler.keys)
     t = liqui_client.TradeAPI(keys[0], self.key_handler,
                               self.connection)