Arkadaşlar merhabalar. Şuradaki apiyi phpde yazmaya çalışıyorum. https://novaexchange.com/remote/faq/ . Bu adreste python örnek kodunu vermişler.
Şu şekilde:
#!/usr/bin/python

import time
import hmac
import hashlib
import base64
import requests

# https://novaexchange.com/remote/faq/

API_KEY = "YOUR_API_KEY"
API_SECRET = "YOUR_API_SECRET"

public_set = set([ "markets", "market/info", "market/orderhistory", "market/openorders" ]) # optional
private_set = set([ "getbalances", "getbalance", "getdeposits", "getwithdrawals", "getnewdepositaddress", "getdepositaddress", "myopenorders", "myopenorders_market", "cancelorder", "withdraw", "trade", "tradehistory", "getdeposithistory", "getwithdrawalhistory", "walletstatus" ])

url = "https://novaexchange.com/remote/v2/"

def api_query( method, req = None ):
        url = "https://novaexchange.com/remote/v2/"
        if not req:
                req = {}
        if method.split('/')[0][0:6] == 'market':
                r = requests.get( url + method + '/', timeout = 60 )
        elif method.split('/')[0] in private_set:
                url += 'private/' + method + '/' + '?nonce=' + str( int( time.time() ) )
                req["apikey"] = API_KEY
                req["signature"] = base64.b64encode( hmac.new( API_SECRET, msg = url, digestmod = hashlib.sha512 ).digest() )
                headers = {'content-type': 'application/x-www-form-urlencoded'}
                r = requests.post( url, data = req, headers = headers, timeout = 60 )
        return r.text

# Eample usage:

# Public:
# print api_query( "markets" )
print api_query( "market/orderhistory/" + "LTC_DOGE" )
# etc...

# Private:
print api_query("getbalances")
# print api_query( "trade/" + "LTC_DOGE", { 'tradebase': 0, 'tradetype': "BUY", 'tradeprice': 0.000001, 'tradeamount': 1000 } )
# print api_query( 'cancelorder/' + str( 1426936 ) )
# print api_query( 'tradehistory' )
# etc...
Public işlemleri file_gets_content() ile çekip güzel bir şekilde işleyebiliyorum. Problem private işlemlerde.

Ona pythonu şu şekilde php'ye uyarladım ancak 505 hatası alıp duruyorum :s.
Yazdığım php kodu şu şekilde:
<?php

$api_key    = "xxxxxxxxxxxxxxxxxxxxxx";
$api_secret = "xxxxxxxxxxxxxxxxxxxxxx";

$t=time();

$url = "https://novaexchange.com/remote/v2/private/"."tradehistory"."/?nonce=".$t;

$signature = hash_hmac('sha512', $url, $api_secret, true);


$ch = curl_init();
$curlConfig = array(
    CURLOPT_URL            => "https://novaexchange.com/remote/v2/private/tradehistory"."/?nonce=".$t,
    CURLOPT_POST           => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_POSTFIELDS     => array(
        'apikey' => $api_key,
        'signature' => $signature,
    )
);
curl_setopt_array($ch, $curlConfig);
$result = curl_exec($ch);


curl_close($ch);

echo $result;
Nerede hata yapıyorum arkadaşlar bilemiyorum. Python kodundan benim anladığım şu şekilde. url nin sonuna nonce parametresi ile anlık saniye atıyoruz. Bu urlye post edeceğiz ve bu url ile apisecret'i şifreleyerek signature değeri buluyoruz. Api key ile signature'ı post fields olarak nonce değerli urlye post ediyoruz.

Dipnot: apikey, apisecret yanlış yazınca auth failed diyor. Bilgileri doğru girince internet 505 error alıyorum.
Arkadaşlar yardım ederseniz çok makbule geçer.