Bitcoin Forum
May 06, 2024, 05:02:18 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Economy / Exchanges / Bittrex API V3 via Python on: December 28, 2020, 09:45:16 PM
Hello,

i'm trying to use the Bittrex WEB API V3 via a simple Python Script for placing Orders or getting the actual User Balance without !!! using any Bittrex spec. Library.
Unfortunately i have no Chance to have success with this.

I'm using this method for the Finance API without any Problems...

Code:
def getBalanceBN(curr):
    import requests, time, hmac, hashlib, json, base64, urllib
    from urllib.parse import urlencode

    BASE_URL = 'https://api.binance.com'
    url_path = '/api/v3/account'


    payload = {
    }

    query_string = urlencode(payload, True)
    if query_string:
        query_string = "{}&timestamp={}".format(query_string, int(time.time() * 1000))
    else:
        query_string = 'timestamp={}'.format(int(time.time() * 1000))

    hashstr = hmac.new(bin_secret.encode('utf-8'), query_string.encode('utf-8'), hashlib.sha256).hexdigest()
    url = BASE_URL + url_path + '?' + query_string + '&signature=' + hashstr

    params = {'url': url, 'params': {}}

    session = requests.Session()
    session.headers.update({
        'Content-Type': 'application/json;charset=utf-8',
        'X-MBX-APIKEY': bin_key
    })

    try:
        r = r = session.get(**params)
        balance_array = (json.loads(r.text)['balances'])
        #print(r.text)

        for i in range(len(balance_array)):
            if balance_array[i]['asset'] == curr:
                Balance = balance_array[i]['free']
                log('Binance Balance for ' + curr + ' = ' + str(Balance))
                return (Balance)

        if r.status_code != 200:
            print("API Error Code " + str(r.status_code))
            log("Error querying Binane API for User Balance API Error Code " + str(r.status_code))
            log(r.text)
            return ('error')

        return(0)

    except requests.ConnectionError:
        log("Error querying Binane API for getting User Balance " )
        return ('error')

I'm not able to find a simple example script where i can see how i have to change this for the Bittrex Authentication
Does anyone have an example Python Code who show's me how this would work for BITTREX (Place Orders or get Balance...)

Thank a lot

Neuri
2  Economy / Exchanges / KRAKEN WEB API via Python on: August 03, 2020, 06:55:29 PM
Hello,

i'm trying to use the Kraken WEB API via a simple Python Script for placing Orders or getting the actual User Balance without !!! using any Kraken spec. Library.
Unfortunately i have no Chance to have success with this.

I'm using this method for the Bitstamp API without any Problems...

Code:
def BuyMarket(curr,amount):
   client_id = xxx
   api_key = xxx
   api_secret = xxx

    amount = round(amount, 8)

    timestamp = str(int(round(time.time() * 1000)))
    nonce = str(uuid.uuid4())
    content_type = 'application/x-www-form-urlencoded'
    payload = {'amount': amount}

    if sys.version_info.major >= 3:
        from urllib.parse import urlencode
    else:
        from urllib import urlencode

    payload_string = urlencode(payload)

    message = 'BITSTAMP ' + api_key + \
              'POST' + \
              'www.bitstamp.net' + \
              '/api/v2/buy/market/' + curr +'/' + \
              '' + \
              content_type + \
              nonce + \
              timestamp + \
              'v2' + \
              payload_string
    message = message.encode('utf-8')
    signature = hmac.new(API_SECRET, msg=message, digestmod=hashlib.sha256).hexdigest()
    headers = {
        'X-Auth': 'BITSTAMP ' + api_key,
        'X-Auth-Signature': signature,
        'X-Auth-Nonce': nonce,
        'X-Auth-Timestamp': timestamp,
        'X-Auth-Version': 'v2',
        'Content-Type': content_type
    }
    r = requests.post(
        'https://www.bitstamp.net/api/v2/buy/market/' + curr +'/',
        headers=headers,
        data=payload_string
    )
    if not r.status_code == 200:
        # raise Exception('Status code not 200')
        raise Exception(r.status_code)
    string_to_sign = (nonce + timestamp + r.headers.get('Content-Type')).encode('utf-8') + r.content
    signature_check = hmac.new(API_SECRET, msg=string_to_sign, digestmod=hashlib.sha256).hexdigest()
    if not r.headers.get('X-Server-Auth-Signature') == signature_check:
        raise Exception('Signatures do not match')

    log ("Place Market Buy Order - amount:" + str(amount) + " currencypair:"+curr+ " " + str(r.content) )

    try:
        OrderID=json.loads(r.text)["id"]
    except:
        OrderID="error"

    return(OrderID)

Does anyone have an example Python Code who show's me how this would work for KRAKEN (Place Orders or get Balance...)

Thank a lot

Neuri
3  Other / Off-topic / Python script for Bitstamp HTTP API on: December 12, 2017, 08:50:30 PM
Hello,

i have serious troubles to get connected to the http api from Bitstamp. (https://www.bitstamp.net/api/)
Does anyone have a sample python script for instance just get the balance as respond.

Thank you for your help
4  Alternate cryptocurrencies / Mining (Altcoins) / GPU suggestion on: July 11, 2017, 06:29:35 PM
Hello,

i have a simple PC running 24/7 to run a little server application. I do some XMR mining with this PC because i don't have to care about power costs.
What graphic card would you suggest for mining in that case.(i don't care about the coin, but don't really believe in ETH) - power costs doesn't matter.

I know a rig would be a much better solution but the thing is that this pc is running all the time with just for a little server app.

Thanks for your answers
5  Alternate cryptocurrencies / Mining (Altcoins) / mineXMR.com experience on: June 05, 2017, 09:43:30 PM
Hello,

does anyone have experience with the mineXMR.com pool
I'm using this pool to get a little knowledge about XMR mining. I'm using this pool because my pc is behind a firewall so i need a pool which i can reach over port 80 or 443.

I'm using a standard windows pc for cpu mining, at the moment it's the only task on this pc, but the hash rate fluctuating from 10h/s to 160h/s.
Is this normal. Sometimes i start a miner on a second pc and it looks for me that this has an influence at the Hash Rate of the first one, so the total Hash Rate is not really increasing.

Does anyone know this problem? Would you suggest another pool (reachable over port 80 or 443, maybe with an ssh tunnel)

Thanks for your answers
6  Local / Altcoins (Deutsch) / XMR mining "hinter" firewall on: May 25, 2017, 04:03:55 PM
Hallo,

ich bin noch ein blutiger Anfänger im Mining/Coin Geschäft.
Ich würde gerne, mehr oder weniger zum kennenlernen, etwas Monero (XMR) via CPU minen.
Es geht mir nicht darum "reich" zu werden, aber ich möchte gerne das Ganze etwas besser kennen lernen/verstehen.
Aktuell mine ich bei Minergate, das funktioniert prinzipiell akzeptabel allerdings hätte ich ein paar Rechner hinter einer bestehenden Firewall zur verfügung die sowieso laufen und auf denen ein miner client nicht weiter stören würde. (Die Firewall Port Einstellungen möchte ich hierfür aber nicht ändern)
Es gibt ja einige pools welche über Standard Ports wie 80 oder 443 zur erreichbar sind.

Könnte mir jemand einen Tipp geben. Für mich wäre wichtig dass die minimale Auszahlung nicht allzu hoch ist da ich vermutlich in absehbarer Zeit keine großen Beträge schürfen kann, ich das Ganze (inkl. Auszahlung/Überweisung) aber vorerst gerne mal testen möchte.

Gruß und Dank...
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!