bram_vnl (OP)
Legendary
Offline
Activity: 1148
Merit: 1000
|
|
March 14, 2016, 02:33:04 PM |
|
Where is a good start to make price scripts from exchanges for my website?
I want to understand API exchange
|
|
|
|
pooya87
Legendary
Offline
Activity: 3486
Merit: 10666
|
|
March 15, 2016, 07:40:28 AM |
|
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: <div id="coindesk-widget"></div> <script type="text/javascript" src="//widget.coindesk.com/bpiticker/coindesk-widget.min.js?509e9d"></script> 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.
|
. .BLACKJACK ♠ FUN. | | | ███▄██████ ██████████████▀ ████████████ █████████████████ ████████████████▄▄ ░█████████████▀░▀▀ ██████████████████ ░██████████████ █████████████████▄ ░██████████████▀ ████████████ ███████████████░██ ██████████ | | CRYPTO CASINO & SPORTS BETTING | | │ | | │ | ▄▄███████▄▄ ▄███████████████▄ ███████████████████ █████████████████████ ███████████████████████ █████████████████████████ █████████████████████████ █████████████████████████ ███████████████████████ █████████████████████ ███████████████████ ▀███████████████▀ ███████████████████ | | .
|
|
|
|
mocacinno
Legendary
Online
Activity: 3430
Merit: 5033
https://merel.mobi => buy facemasks with BTC/LTC
|
|
March 15, 2016, 07:48:59 AM |
|
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!
|
|
|
|
bram_vnl (OP)
Legendary
Offline
Activity: 1148
Merit: 1000
|
|
March 15, 2016, 08:09:32 AM |
|
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
Activity: 1148
Merit: 1000
|
|
March 15, 2016, 08:11:55 AM |
|
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: <div id="coindesk-widget"></div> <script type="text/javascript" src="//widget.coindesk.com/bpiticker/coindesk-widget.min.js?509e9d"></script> 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
Activity: 1148
Merit: 1000
|
|
March 15, 2016, 02:25:50 PM |
|
Thanks for the help from @mocacinno But I have a question from bittrex api, I have this 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 'Ƀ '. $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
Activity: 3486
Merit: 10666
|
|
March 16, 2016, 03:36:24 AM |
|
~~ 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# 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-00http://stackoverflow.com/questions/10916675/display-float-value-w-o-scientific-notation
|
. .BLACKJACK ♠ FUN. | | | ███▄██████ ██████████████▀ ████████████ █████████████████ ████████████████▄▄ ░█████████████▀░▀▀ ██████████████████ ░██████████████ █████████████████▄ ░██████████████▀ ████████████ ███████████████░██ ██████████ | | CRYPTO CASINO & SPORTS BETTING | | │ | | │ | ▄▄███████▄▄ ▄███████████████▄ ███████████████████ █████████████████████ ███████████████████████ █████████████████████████ █████████████████████████ █████████████████████████ ███████████████████████ █████████████████████ ███████████████████ ▀███████████████▀ ███████████████████ | | .
|
|
|
|
mocacinno
Legendary
Online
Activity: 3430
Merit: 5033
https://merel.mobi => buy facemasks with BTC/LTC
|
|
March 16, 2016, 08:15:10 AM |
|
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
|
|
|
|
bram_vnl (OP)
Legendary
Offline
Activity: 1148
Merit: 1000
|
|
March 16, 2016, 09:50:07 AM |
|
I have change $obj = json_decode($response, true); echo 'Ƀ '. $obj['result'][0]['Last'] . '<br>'; to $obj = json_decode($response,true); echo number_format($obj['result'][0]['Last'], 8); That works http://www.guldenpagina.nl
|
|
|
|
bram_vnl (OP)
Legendary
Offline
Activity: 1148
Merit: 1000
|
|
March 16, 2016, 01:20:47 PM Last edit: March 16, 2016, 01:47:54 PM by bram_vnl |
|
The last thing I need the php script's for yobit alcurex safecex
|
|
|
|
pooya87
Legendary
Offline
Activity: 3486
Merit: 10666
|
|
March 17, 2016, 04:39:40 AM Last edit: March 17, 2016, 04:51:45 AM by pooya87 |
|
https://yobit.net/api/3/ticker/nlg_btcsince 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: 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 edit: https://alcurex.org/api/market.php?pair=NLG_btc&last=lasthttps://safecex.com/api/getmarket?market=NLG/BTCyou might wanna check with mocacinno that knows PHP
|
. .BLACKJACK ♠ FUN. | | | ███▄██████ ██████████████▀ ████████████ █████████████████ ████████████████▄▄ ░█████████████▀░▀▀ ██████████████████ ░██████████████ █████████████████▄ ░██████████████▀ ████████████ ███████████████░██ ██████████ | | CRYPTO CASINO & SPORTS BETTING | | │ | | │ | ▄▄███████▄▄ ▄███████████████▄ ███████████████████ █████████████████████ ███████████████████████ █████████████████████████ █████████████████████████ █████████████████████████ ███████████████████████ █████████████████████ ███████████████████ ▀███████████████▀ ███████████████████ | | .
|
|
|
|
Patatas
Legendary
Offline
Activity: 1750
Merit: 1115
Providing AI/ChatGpt Services - PM!
|
|
March 17, 2016, 04:50:58 AM |
|
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 : 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
Activity: 1148
Merit: 1000
|
|
March 17, 2016, 09:39:35 AM |
|
I got Safecex working, I will look the last 2 Alcurex and Yobit
|
|
|
|
bram_vnl (OP)
Legendary
Offline
Activity: 1148
Merit: 1000
|
|
March 18, 2016, 11:06:45 AM |
|
@mocacinno I have send you a pm
|
|
|
|
mocacinno
Legendary
Online
Activity: 3430
Merit: 5033
https://merel.mobi => buy facemasks with BTC/LTC
|
|
March 18, 2016, 11:18:39 AM |
|
@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
|
|
|
|
bram_vnl (OP)
Legendary
Offline
Activity: 1148
Merit: 1000
|
|
March 18, 2016, 12:42:46 PM |
|
@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 thats oke!
|
|
|
|
bram_vnl (OP)
Legendary
Offline
Activity: 1148
Merit: 1000
|
|
March 26, 2016, 11:21:47 AM |
|
Thx for the scripts!
|
|
|
|
|