tk1337
|
|
October 27, 2013, 05:05:34 PM |
|
Hello everyone! I am currently working on a UI for CEX.IO. I am having a little trouble with the trading part tho. Would anyone be willing to help me with that part? All I need is a single PHP script that I can set type, amount, and price and send it over the API. I tried and tried but I just don't understand what I am doing wrong. Something like this would be perfect: <?php function cex_query($method, array $req = array()) { // API settings $key = ''; // your API-key $secret = ''; // your Secret-key $req['method'] = $method; $mt = explode(' ', microtime()); $req['nonce'] = $mt[1]; // generate the POST data string $post_data = http_build_query($req, '', '&'); $sign = hash_hmac('sha512', $post_data, $secret); // generate the extra headers $headers = array( 'Sign: '.$sign, 'Key: '.$key, ); // 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; BTCE PHP client; '.php_uname('s').'; PHP/'.phpversion().')'); } curl_setopt($ch, CURLOPT_URL, 'https://cex.io/api/place_order/GHS/BTC'); 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; }
$result = cex_query('Trade', array('type' => 'buy', 'amount' => 1, 'price' => 10)); var_dump($result);
?> Just after a quick glance, I would say, you're not setting the headers correctly, probably should define a content type, maybe a few other things. Granted, I haven't looked much at the API and I am half-awake atm.
|
|
|
|
|
|
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
|
papaminer
|
|
October 27, 2013, 05:21:11 PM |
|
@CEX
Is it possible to support SCRYPT-BASED MINERS?
Like LiteCoin?
|
฿: 1L7dSte4Rs4KyyxRCgrqSWYtkXdAb4Gy1z MORE INFO ABOUT ME: BTC
|
|
|
kickbit
|
|
October 27, 2013, 08:17:28 PM |
|
@CEX
Is it possible to support SCRYPT-BASED MINERS?
Like LiteCoin?
I think no, it's all about bitcoins
|
|
|
|
CEX (OP)
Legendary
Offline
Activity: 1227
Merit: 1003
|
|
October 27, 2013, 09:01:17 PM |
|
Hello everyone! I am currently working on a UI for CEX.IO. I am having a little trouble with the trading part tho. Would anyone be willing to help me with that part? All I need is a single PHP script that I can set type, amount, and price and send it over the API. I tried and tried but I just don't understand what I am doing wrong. Something like this would be perfect: <?php function cex_query($method, array $req = array()) { // API settings $key = ''; // your API-key $secret = ''; // your Secret-key $req['method'] = $method; $mt = explode(' ', microtime()); $req['nonce'] = $mt[1]; // generate the POST data string $post_data = http_build_query($req, '', '&'); $sign = hash_hmac('sha512', $post_data, $secret); // generate the extra headers $headers = array( 'Sign: '.$sign, 'Key: '.$key, ); // 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; BTCE PHP client; '.php_uname('s').'; PHP/'.phpversion().')'); } curl_setopt($ch, CURLOPT_URL, 'https://cex.io/api/place_order/GHS/BTC'); 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; }
$result = cex_query('Trade', array('type' => 'buy', 'amount' => 1, 'price' => 10)); var_dump($result);
?> Hey! Here is a working example. http://pastebin.com/h1TrCJD1
|
Buy/sell BTC and ETH using your Visa/Mastercard. Instant payments, low fees, worldwide coverage, 100% secure. Register Join Bitcoin Affiliate program! Invite users and get 30% lifetime bonus. Join now
|
|
|
CEX (OP)
Legendary
Offline
Activity: 1227
Merit: 1003
|
|
October 27, 2013, 09:04:05 PM |
|
@CEX
Is it possible to support SCRYPT-BASED MINERS?
Like LiteCoin?
I think no, it's all about bitcoins Bitfury ASIC can only calculate SHA-256 hashes, that is why we can not mine litecoins. Best Reagards, CEX.IO
|
Buy/sell BTC and ETH using your Visa/Mastercard. Instant payments, low fees, worldwide coverage, 100% secure. Register Join Bitcoin Affiliate program! Invite users and get 30% lifetime bonus. Join now
|
|
|
Jude Austin
Legendary
Offline
Activity: 1140
Merit: 1000
The Real Jude Austin
|
|
October 27, 2013, 09:25:40 PM |
|
Hello everyone! I am currently working on a UI for CEX.IO. I am having a little trouble with the trading part tho. Would anyone be willing to help me with that part? All I need is a single PHP script that I can set type, amount, and price and send it over the API. I tried and tried but I just don't understand what I am doing wrong. Something like this would be perfect: <?php function cex_query($method, array $req = array()) { // API settings $key = ''; // your API-key $secret = ''; // your Secret-key $req['method'] = $method; $mt = explode(' ', microtime()); $req['nonce'] = $mt[1]; // generate the POST data string $post_data = http_build_query($req, '', '&'); $sign = hash_hmac('sha512', $post_data, $secret); // generate the extra headers $headers = array( 'Sign: '.$sign, 'Key: '.$key, ); // 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; BTCE PHP client; '.php_uname('s').'; PHP/'.phpversion().')'); } curl_setopt($ch, CURLOPT_URL, 'https://cex.io/api/place_order/GHS/BTC'); 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; }
$result = cex_query('Trade', array('type' => 'buy', 'amount' => 1, 'price' => 10)); var_dump($result);
?> Hey! Here is a working example. http://pastebin.com/h1TrCJD1Yeah, I finally got it working. Thanks.
|
Buy or sell $100 of Crypto and get $10!
|
|
|
papaminer
|
|
October 27, 2013, 09:42:48 PM |
|
@CEX
Is it possible to support SCRYPT-BASED MINERS?
Like LiteCoin?
I think no, it's all about bitcoins Bitfury ASIC can only calculate SHA-256 hashes, that is why we can not mine litecoins. Best Reagards, CEX.IO I understand... and I know there are no ASICs for alt-crypt yet... but I am talking about hosted scrypt-based miners... The old RIGs type of miners... you know... mobos/ram/hd/cpu/gpu... (IN THE CLOUD)...
|
฿: 1L7dSte4Rs4KyyxRCgrqSWYtkXdAb4Gy1z MORE INFO ABOUT ME: BTC
|
|
|
ny2cafuse
Legendary
Offline
Activity: 1582
Merit: 1002
HODL for life.
|
|
October 28, 2013, 01:51:50 AM |
|
CEX, You could probably make a killing if you guys offered scrypt based cloud-mining. If CryptoIndustries gets machines out the door, they would make a killing on your site. A dozen or so Horus units and shares for 100-200khs/share. I'd definitely buy in if you guys ever went that route. Here's a link to the Horus. http://www.cryptoindustries.com/?product=horus-10mh-fuse
|
Community > Devs
|
|
|
bitdigger2013
|
|
October 28, 2013, 03:47:27 AM |
|
Just trying to understand the fees.
Your saying 0.001 BTC/GHS/HOUR?
so for 24 hours of mining at 1 GHS the fee will be about 0.024BTC?
Let me know if I am do the math correctly.
|
|
|
|
ny2cafuse
Legendary
Offline
Activity: 1582
Merit: 1002
HODL for life.
|
|
October 28, 2013, 03:50:03 AM |
|
Just trying to understand the fees.
Your saying 0.001 BTC/GHS/HOUR?
so for 24 hours of mining at 1 GHS the fee will be about 0.024BTC?
Let me know if I am do the math correctly.
No, you read it wrong. It's $0.001, as in a tenth of a penny.
|
Community > Devs
|
|
|
PatMan
|
|
October 28, 2013, 02:50:44 PM |
|
BTC0.1027 per G/h? That's just nuts
|
|
|
|
davecoin
|
|
October 28, 2013, 02:54:53 PM |
|
Just trying to understand the fees.
Your saying 0.001 BTC/GHS/HOUR?
so for 24 hours of mining at 1 GHS the fee will be about 0.024BTC?
Let me know if I am do the math correctly.
No, you read it wrong. It's $0.001, as in a tenth of a penny. Correct, it's $0.024 per day per GH. This amounts to $1.00 per kWh.
|
|
|
|
mobile
Sr. Member
Offline
Activity: 400
Merit: 250
the sun is shining, but the ice is still slippery
|
|
October 28, 2013, 04:52:48 PM |
|
Dear CEX users, There were some minor data-center issues, which resulted 0 hash power for some time. However everything is fixed now, and ALL users will be compensated for their losses, to make sure you are 100% happy with our service. I am glad you like our service, we will keep it up an running for your benefit Just saw this. Compensation from data center downtime? Wow! This speaks volumes. Well done CEX. Cheers...
|
1 MoBi1eNbqh8QMuvtZjYzQGV8NEckJJYcT rep| GnuPG <3 CLAM <3
|
|
|
CEX (OP)
Legendary
Offline
Activity: 1227
Merit: 1003
|
|
October 28, 2013, 05:17:16 PM |
|
Dear CEX users, The maintenance fee will be less. We are just running some final calculations, and will get back with exact information soon.
|
Buy/sell BTC and ETH using your Visa/Mastercard. Instant payments, low fees, worldwide coverage, 100% secure. Register Join Bitcoin Affiliate program! Invite users and get 30% lifetime bonus. Join now
|
|
|
PatMan
|
|
October 28, 2013, 05:20:45 PM |
|
Nice one Can you lower the G/h price too?.........
|
|
|
|
CEX (OP)
Legendary
Offline
Activity: 1227
Merit: 1003
|
|
October 28, 2013, 05:49:32 PM |
|
haha) Nice try
|
Buy/sell BTC and ETH using your Visa/Mastercard. Instant payments, low fees, worldwide coverage, 100% secure. Register Join Bitcoin Affiliate program! Invite users and get 30% lifetime bonus. Join now
|
|
|
PatMan
|
|
October 28, 2013, 05:54:30 PM |
|
DOH!! Busted
|
|
|
|
PaulC2K
Newbie
Offline
Activity: 26
Merit: 0
|
|
October 28, 2013, 07:02:10 PM |
|
@CEX I registered last weekend and was very unimpressed, i was sent there by a friend without really knowing anything and just assumed it was in early beta, because the site is like 90% empty, unpopulated. I mentioned this to said friend last night and he gave me his login so i could see what its about, but again, empty. Firefox, Chrome, IE... empty. I fired up my remote connection into my homeserver and tried through that, and its all there as i'd been told it was. I've just found out that Malwarebytes is basically blocking your site, i used Firebug to look for errors and this seems to be what is picking up on: ReferenceError: io is not defined var socketio = io.connect(' https://ws.cex.io/');www.cex.io (line 527) What is thats going on there which is causing MB to block your IP address, and (before adding to ignore list) basically turn your website into a content-less waste of space when visiting it.
|
|
|
|
|
papaminer
|
|
October 28, 2013, 07:18:06 PM |
|
|
฿: 1L7dSte4Rs4KyyxRCgrqSWYtkXdAb4Gy1z MORE INFO ABOUT ME: BTC
|
|
|
|