Bitcoin Forum
November 16, 2024, 05:56:24 PM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1] 2 »
1  Economy / Trading Discussion / Huobi Price feed / OKCoin Price Feed on: January 18, 2014, 12:44:52 PM
Hi,

Anyone know where I can find a good Huobi price feed for the Bitcoin and OKCoin price feed for the litecoin?

Preferably in json-format, and if there is a real-time websocket for price / trade updating, all the better.

Thanks, Dirk
2  Economy / Service Discussion / Re: MtGox bitcoin withdrawal delay >:( on: January 08, 2014, 06:25:13 PM
I am having an issue again with withdrawing BTC, withdrawed over 24 hours ago. Anyone else experiencing problems now?
3  Economy / Service Discussion / Limit reached or not enough bitcoins in your account (Mtgox) on: November 19, 2013, 06:51:50 PM
Hi,

At Mtgox when trying to withdraw BTC I get a message:

Limit reached or not enough bitcoins in your account

I do have enough BTC in my account and I did not reach my limit. Anyone else experiencing such a problem?

Thanks for any insight.
4  Economy / Trading Discussion / Re: 401 Unauthorized on BTCChina, PHP code on: November 14, 2013, 03:24:55 PM
Code:
        $accessKey = "YOUR_ACCESS_KEY"; 
        $secretKey = "YOUR_SECRET_KEY";

You replaced your key and secret I presume?

Yeah :-).
5  Economy / Trading Discussion / 401 Unauthorized on BTCChina, PHP code on: November 13, 2013, 05:25:41 PM
Hi,

For BTCChina I use the provided PHP code, but I always get a 401 Unauthorized error. Anyone know how to fix this problem?

Thanks, Dirk

--- This is the code:

<?php
  function sign($method, $params = array()){
 
 
        $accessKey = "YOUR_ACCESS_KEY";
        $secretKey = "YOUR_SECRET_KEY";
 
        $mt = explode(' ', microtime());
        $ts = $mt[1] . substr($mt[0], 2, 6);
 
        $signature = http_build_query(array(
            'tonce' => $ts,
            'accesskey' => $accessKey,
            'requestmethod' => 'post',
            'id' => 1,
            'method' => $method,
            'params' => '', //implode(',', $params),
        ));
        var_dump($signature);
 
        $hash = hash_hmac('sha1', $signature, $secretKey);
 
        return array(
            'ts' => $ts,
            'hash' => $hash,
            'auth' => base64_encode($accessKey.':'. $hash),
        );
    }
 
    function request($method, $params){
        $sign = sign($method, $params);
 
        $options = array(
            CURLOPT_HTTPHEADER => array(
                'Authorization: Basic ' . $sign['auth'],
                'Json-Rpc-Tonce: ' . $sign['ts'],
            ),
        );
 
        $postData = json_encode(array(
            'method' => $method,
            'params' => $params,
            'id' => 1,
        ));
        print($postData);
 
        $headers = array(
                'Authorization: Basic ' . $sign['auth'],
                'Json-Rpc-Tonce: ' . $sign['ts'],
            );       
        $ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT,
'Mozilla/4.0 (compatible; BTC China Trade Bot; '.php_uname('a').'; PHP/'.phpversion().')'
);
curl_setopt($ch, CURLOPT_URL, 'https://api.btcchina.com/api_trade_v1.php');
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
 
// run the query
$res = curl_exec($ch);
return $res;
/**/
      }
 
try {
var_dump(request('getAccountInfo', array()));
 
} catch (Exception $e) {
echo "Error:".$e->getMessage();
}
?>
6  Economy / Trading Discussion / Mtgox Websocket connection on: August 21, 2013, 02:01:14 PM
Hi,

Lately I experience an unstable connection to the Mtgox websocket, sometimes it also takes very long before the server starts pushing messages (it does say it is connected fine though).

Is this a common problem, or might it be a problem with my connection?

Thanks,

Dirk
7  Economy / Trading Discussion / Empty data from MtGox after sending requests. on: August 13, 2013, 07:16:07 PM
Hi,

I use a PHP script to send requests to MtGox, but lately get a lot of empty data back on requests and have to try hundreds or thousands of times before I get actual data back after sending a request. Did anyone experience a similar problem, any idea how to resolve?

The code is here, key and secret removed:

  <?php
   
function mtgox_query($path, array $req = array()) {
    // API settings
    $key = ''; 
    $secret = '';
    // generate a nonce as microtime, with as-string handling to avoid problems with 32bits systems
    $mt = explode(' ', microtime());
    $req['nonce'] = $mt[1].substr($mt[0], 2, 6);
   
    // generate the POST data string
    $post_data = http_build_query($req, '', '&');
    $prefix = '';
    if (substr($path, 0, 2) == '2/') {
        $prefix = substr($path, 2)."\0";
    }
    // generate the extra headers
    $headers = array(
        'Rest-Key: '.$key,
        'Rest-Sign: '.base64_encode(hash_hmac('sha512', $prefix.$post_data, base64_decode($secret), true)),
    );
    // our curl handle (initialize if required)
    static $ch = null;
    if (is_null($ch)) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MtGox PHP client; '.php_uname('s').'; PHP/'.phpversion().')');
    }
    //curl_setopt($ch, CURLOPT_URL, 'https://data.mtgox.com/api/'.$path);
    curl_setopt($ch, CURLOPT_URL, 'https://23.67.8.44/api/'.$path);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    // run the query
    $res = curl_exec($ch);
    if ($res === false) throw new Exception('Could not get reply: '.curl_error($ch));
    $dec = json_decode($res, true);
    if (!$dec) throw new Exception('Invalid data received, please make sure connection is working and requested API exists');
   
    return $dec;
    print json_encode($dec);
}
?>

Thanks, Dirk.
8  Economy / Trading Discussion / Gox 500 internal server error on: July 31, 2013, 05:11:17 PM
Hi,

I get a lot of 500 internal server errors on the v2 Gox API, is this a common thing? Any suggested solutions?

Thanks, Dirk
9  Economy / Trading Discussion / CancelOrder method btc-e on: May 19, 2013, 06:38:43 PM
Hi,

When I use the CancelOrder method in the trade API and send order_id: (actual order id) with it, I get this back:

error: "invalid parameter: order_id"
success: 0

Doesn't make sense, because order_id seems to be the right parameter?

Anyone know how to go about this?

Thanks, Dirk
10  Economy / Service Discussion / Re: BTC-E Nonce Generation on: May 18, 2013, 08:08:30 PM
I think the nonce is not really tied to the time? You could just count it up at each request?

Possible, though I need to keep a database of the nonce value then, which I currently don't have :-).
11  Economy / Service Discussion / Re: BTC-E Nonce Generation on: May 18, 2013, 07:34:02 PM
Thanks, I ran into that I think, or it could be something else, it isn't working anymore.

I now use this, that should work for at least a while (if you have a better way I'd gladly hear so, but I think it is limited since you have only 10 digits and you want some accuracy on the milli or microsecond level, the best I can do probably is to add 110000000 to it):

$req['nonce'] = substr($mt[1],-7).substr($mt[0], 2, 3);

I get this error message back:

invalid nonce parameter; 0 8905540614

I don know why it gives a zero first, but the 8905540614 is the nonce I send. It's kinda weird, because it is 10 digits and it's ever-increasing (I reset the keys), so something else might still be causing it.

      
12  Economy / Service Discussion / Re: BTC-E Nonce Generation on: May 18, 2013, 03:47:30 PM
I am testing code for the BTC-E trading platform, however, it seems like it can only process one API request per second, if I do more it gives an invalid nonce parameter error back.

It can only process one API request per unique nonce and your nonce is number of seconds since the Unix epoch, so you are changing your nonce only once per second. You are skipping the microseconds part of microtime() return. Please read: http://php.net/manual/en/function.microtime.php, or the quickest shortcut would be $req['nonce'] = (int) 10000*microtime(true);

I already tried generating a more complex nonce, but it didn't work.

Apparently it needs a nonce of exactly 10 numbers (this is mentioned nowhere however), which I now generate partly from the seconds and from the microseconds part:

$mt = explode(' ', microtime());
$req['nonce'] = substr($mt[1],-4).substr($mt[0], 2, 6);

Issue solved now, thanks for the reply.
13  Economy / Service Discussion / BTC-E Nonce Generation on: May 18, 2013, 03:16:47 PM
Hi,

I am testing code for the BTC-E trading platform, however, it seems like it can only process one API request per second, if I do more it gives an invalid nonce parameter error back.

I use PHP, this is the code to generate the nonce:

        $mt = explode(' ', microtime());
        $req['nonce'] = $mt[1];

If I try a more complex nonce, like:

    $req['nonce'] = $mt[1].substr($mt[0], 2, 6);

I also get an invalid nonce parameter error back.

Anyone ran into the same problem? How to solve it?

Thanks, Dirk
14  Economy / Trading Discussion / Re: Order Management System on: April 29, 2013, 02:44:09 PM
Thanks, that makes sense.

Does anyone know if there is something available (pref open source) that I can integrate easily in my own Javascript/HTML/PHP based trading system?
15  Economy / Trading Discussion / Order Management System on: April 29, 2013, 01:14:24 PM
Hi,

I want to create an order management system; can someone with experience with the Websocket API as well as the HTTP API shortly tell the pros and cons of the two for inserting/deleting/updating/showing orders? I already (partly) wrote the logic to calculate which orders I wanted to insert and I am coding in a Javascript/HTML/PHP environment.

Is there a difference in reliability between the Websocket and HTTP API for inserting/deleting/updating/showing orders?

Thanks, Dirk.
16  Economy / Trading Discussion / Re: Making a real time automated trading system on: April 29, 2013, 08:53:19 AM
What's a more reliable way to insert/cancel/update orders, through HTTP or through the websocket?
17  Economy / Trading Discussion / Re: Making a real time automated trading system on: April 25, 2013, 12:02:10 PM
What about using AJAX, could that do the trick?
18  Economy / Trading Discussion / Re: Making a real time automated trading system on: April 25, 2013, 10:09:14 AM
Thanks, had an initital peak into Goxtool, looks like I should be able to configure it in a the right way. Was it hard for you to make a program that works on multiple exchanges? Are you also able to adjust your price based on real time data of multiple exchanges?
19  Economy / Trading Discussion / Re: Making a real time automated trading system on: April 25, 2013, 09:46:43 AM
Basically, what I'd like, is to be able to calculate a fair value of the bitcoin price based on

a.) real-time order book data
b.) recent time and sales data
c.) manual adjustments or additional algorithms based on historic data or future projections

Then, I would like to be able to put orders into the system in an efficient manner.

Preferably I also would like to have a graphical representation of the order book as well a graphical way to show which orders are mine. I'd also like to put orders in or cancel orders just by clicking on the graphical user interface.

If there is open source software available that does exactly that, or that I can relatively easily adjust to do just that, that would be best of course.
20  Economy / Trading Discussion / Re: Making a real time automated trading system on: April 25, 2013, 09:39:01 AM
Java or python are the best for this project. I have built a trading bot. It is a great experience and a lot of hard work.

How long did it take you? Did you publish the software?
Pages: [1] 2 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!