Bitcoin Forum
November 03, 2024, 11:48:40 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Warning: One or more bitcointalk.org users have reported that they strongly believe that the creator of this topic is a scammer. (Login to see the detailed trust ratings.) While the bitcointalk.org administration does not verify such claims, you should proceed with extreme caution.
Pages: [1]
  Print  
Author Topic: Good start api script exchanges  (Read 1260 times)
bram_vnl (OP)
Legendary
*
Offline Offline

Activity: 1148
Merit: 1000


View Profile
March 14, 2016, 02:33:04 PM
 #1

Where is a good start to make price scripts from exchanges for my website?

I want to understand API exchange
pooya87
Legendary
*
Offline Offline

Activity: 3626
Merit: 10997


Crypto Swap Exchange


View Profile
March 15, 2016, 07:40:28 AM
 #2

Where is a good start to make price scripts from exchanges for my website?

do you want to add like a price indicator to your website or option to buy and sell through exchanger's API

i am not an expert but for the first you can add a price widget to your site like this:
Code:
<div id="coindesk-widget"></div>
<script type="text/javascript" src="//widget.coindesk.com/bpiticker/coindesk-widget.min.js?509e9d"></script>

Quote
I want to understand API exchange

API exchange is basically sending an http request to the exchanger with what you want to do and signing it with your API secret key for security.
and example:
{APIRequestURI}/createorder&MarketName=BTC_USD&Amount=1&type=sell&price=420

then sign this with API secret and send it via POST method and receive the JSON response.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
mocacinno
Legendary
*
Offline Offline

Activity: 3556
Merit: 5187


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
March 15, 2016, 07:48:59 AM
 #3

I can probably write a couple price widgets for you, so you can use them directly onto your site, and learn from the samples?
PM me for a quote if you're interested!

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
bram_vnl (OP)
Legendary
*
Offline Offline

Activity: 1148
Merit: 1000


View Profile
March 15, 2016, 08:09:32 AM
 #4

I can probably write a couple price widgets for you, so you can use them directly onto your site, and learn from the samples?
PM me for a quote if you're interested!

I have send you a PM
bram_vnl (OP)
Legendary
*
Offline Offline

Activity: 1148
Merit: 1000


View Profile
March 15, 2016, 08:11:55 AM
 #5

Where is a good start to make price scripts from exchanges for my website?

do you want to add like a price indicator to your website or option to buy and sell through exchanger's API

i am not an expert but for the first you can add a price widget to your site like this:
Code:
<div id="coindesk-widget"></div>
<script type="text/javascript" src="//widget.coindesk.com/bpiticker/coindesk-widget.min.js?509e9d"></script>

Quote
I want to understand API exchange

API exchange is basically sending an http request to the exchanger with what you want to do and signing it with your API secret key for security.
and example:
{APIRequestURI}/createorder&MarketName=BTC_USD&Amount=1&type=sell&price=420

then sign this with API secret and send it via POST method and receive the JSON response.

Thx for that, but I want host the script on my website not from other websites
bram_vnl (OP)
Legendary
*
Offline Offline

Activity: 1148
Merit: 1000


View Profile
March 15, 2016, 02:25:50 PM
 #6

Thanks for the help from @mocacinno

But I have a question from bittrex api, I have this code

Code:
<?php
$url 
'https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-nlg';
$response file_get_contents($url);
$obj json_decode($response,true);
echo 
'&#579; '$obj['result'][0]['Ask'] . '
'
;
?>

My question, the code show
Bittrex Ƀ 4.74E-6 and I want something like this Bittrex Ƀ 0.00000474
pooya87
Legendary
*
Offline Offline

Activity: 3626
Merit: 10997


Crypto Swap Exchange


View Profile
March 16, 2016, 03:36:24 AM
 #7

~~
Bittrex Ƀ 4.74E-6 and I want something like this Bittrex Ƀ 0.00000474


they are both the same 4.74E-6 is the scientific method of showing the number.
by the time of displaying the result in your output you have to just change the "format".

most of the time i do this in c#
Code:
txtOutput.Text = string.Format("{0:0.00000000}",4.74E-6);

i don't know about PHP, so google can help you better:
http://stackoverflow.com/questions/1471674/why-is-php-printing-my-number-in-scientific-notation-when-i-specified-it-as-00
http://stackoverflow.com/questions/10916675/display-float-value-w-o-scientific-notation

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
mocacinno
Legendary
*
Offline Offline

Activity: 3556
Merit: 5187


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
March 16, 2016, 08:15:10 AM
 #8

As pooya87 said, sprintf would be the best way to do this.
I actually didn't think of this, and advised Bram_vnl to explode the string on "E-", and divide the first ellement of the return array by 10 to the power of [second ellement of the returnarray], but sprintf would be a much better idear  Smiley

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
bram_vnl (OP)
Legendary
*
Offline Offline

Activity: 1148
Merit: 1000


View Profile
March 16, 2016, 09:50:07 AM
 #9

I have change

Code:
$obj = json_decode($response, true);
echo 'Ƀ '. $obj['result'][0]['Last'] . '<br>';

to

Code:
$obj = json_decode($response,true);
echo number_format($obj['result'][0]['Last'], 8);

That works  Cool


http://www.guldenpagina.nl
bram_vnl (OP)
Legendary
*
Offline Offline

Activity: 1148
Merit: 1000


View Profile
March 16, 2016, 01:20:47 PM
Last edit: March 16, 2016, 01:47:54 PM by bram_vnl
 #10

The last thing I need the php script's for yobit alcurex safecex
pooya87
Legendary
*
Offline Offline

Activity: 3626
Merit: 10997


Crypto Swap Exchange


View Profile
March 17, 2016, 04:39:40 AM
Last edit: March 17, 2016, 04:51:45 AM by pooya87
 #11

https://yobit.net/api/3/ticker/nlg_btc
since this doesn't have the json_decode($response,true) part you can check for response success some other way (optional)
change the obj to this:
Code:
$obj['nlg_btc']['Last']
the difference here is that the response is not an array. you just have to give the keys to json to reach what you want.

i haven't heard about the other two exchangers Smiley

edit:
https://alcurex.org/api/market.php?pair=NLG_btc&last=last
Code:
$obj['nlg_btc']['price']

https://safecex.com/api/getmarket?market=NLG/BTC
Code:
$obj['last']

you might wanna check with mocacinno that knows PHP

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Patatas
Legendary
*
Offline Offline

Activity: 1750
Merit: 1115

Providing AI/ChatGpt Services - PM!


View Profile
March 17, 2016, 04:50:58 AM
 #12

Have a look at this newly created exchange's API https://gatecoin.com/api very well structured and easy to understand.Not only for trades but they provide customer ticker's like Market analysis and Depth.Request header's are easier to create as well :
Code:
              jqXHR.setRequestHeader("API_PUBLIC_KEY", publicKey);
                            jqXHR.setRequestHeader("API_REQUEST_SIGNATURE", hashInBase64);
                            jqXHR.setRequestHeader("API_REQUEST_DATE", now);
                       

Not sure what exactly you're looking for but this one should serve all the custom needs.
bram_vnl (OP)
Legendary
*
Offline Offline

Activity: 1148
Merit: 1000


View Profile
March 17, 2016, 09:39:35 AM
 #13

https://yobit.net/api/3/ticker/nlg_btc
since this doesn't have the json_decode($response,true) part you can check for response success some other way (optional)
change the obj to this:
Code:
$obj['nlg_btc']['Last']
the difference here is that the response is not an array. you just have to give the keys to json to reach what you want.

i haven't heard about the other two exchangers Smiley

edit:
https://alcurex.org/api/market.php?pair=NLG_btc&last=last
Code:
$obj['nlg_btc']['price']

https://safecex.com/api/getmarket?market=NLG/BTC
Code:
$obj['last']

you might wanna check with mocacinno that knows PHP

I got Safecex working, I will look the last 2 Alcurex and Yobit
bram_vnl (OP)
Legendary
*
Offline Offline

Activity: 1148
Merit: 1000


View Profile
March 18, 2016, 11:06:45 AM
 #14

@mocacinno I have send you a pm
mocacinno
Legendary
*
Offline Offline

Activity: 3556
Merit: 5187


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
March 18, 2016, 11:18:39 AM
 #15

@mocacinno I have send you a pm


I've seen it, i'm on the road ATM, so it's kinda hard to test out code. I'll see if i can give you a solution this weekend Wink

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
bram_vnl (OP)
Legendary
*
Offline Offline

Activity: 1148
Merit: 1000


View Profile
March 18, 2016, 12:42:46 PM
 #16

@mocacinno I have send you a pm


I've seen it, i'm on the road ATM, so it's kinda hard to test out code. I'll see if i can give you a solution this weekend Wink

thats oke!  Smiley
bram_vnl (OP)
Legendary
*
Offline Offline

Activity: 1148
Merit: 1000


View Profile
March 26, 2016, 11:21:47 AM
 #17

Thx for the scripts!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!