Jump to content

charlion

New Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by charlion

  1. I’m currently trying to building a websocket widget, using node package manager(NPM),WAMPserver and electronjs. the package was well installed because when i start it it works. It log into the console But i dont know how i can handle it with html on wamp server . it seems electronjs is not working for wamp and websocket.
  2. @Barand Thanks for your respond. i used document.getElementById("demo"). innerHTML = obj[0].p still Uncaught TypeError: Cannot read property '0' of undefined. more Light into it would be appreciated
  3. My problem is how to handle this json respond using document.getElementById or any other methods. I needed to output the value of 'P'. And also work with php echo on the output The json respond is bellow [ { "a": 26129, "p": "0.01633102", "q": "4.70443515", "f": 27781, "l": 27781, "T": 1498793709153, "m": true, "M": true } ] Bellow is the code I'm working with. it gives Uncaught TypeError: Cannot read property 'p' of undefined <!DOCTYPE html> <html> <body> <h2> Price</h2> <p id="demo"></p> <script> var burl = "https://api3.binance.com"; /////////// baseurl///////// var query = '/api/v3/aggTrades'; query += '?symbol=BTCUSDT'; var url = burl + query; var ourRequest = new XMLHttpRequest(); ourRequest.open('GET',url,true); ourRequest.onload = function(){ console.log(ourRequest.responseText); } var obj = ourRequest.send(); document.getElementById("demo").innerHTML = obj.p; </script> </body> </html> Please help me and thanks in advance
  4. Hi everyone. I'm very new into self learning programming. Presently I'm trying to develop a simple basic Robot that would only Place a Market Order every seconds and it will cancel the Order every followed seconds. Using the following library: https://docs.b2bx.exchange/en/_docs/api-reference.html#private-api It would place Trade Order at a ( Price = ex.com api * Binance api Aggregate Trades Price) I have already wrote the api to call for xe.com exchange rate with php <?php $auth = base64_encode("username:password"); $context = stream_context_create([ "http" => [ "header" => "Authorization: Basic $auth" ] ]); $homepage = file_get_contents("https://xecdapi.xe.com/v1/convert_from?to=NGN&amount=1.195", false, $context ); $json = json_decode($homepage, TRUE); foreach ($json as $k=>$to){ echo $k; // etc }; ?> And also for the Binance Aggregate Price in JavaScript <script> var burl = "https://api3.binance.com"; var query = '/api/v3/aggTrades'; query += '?symbol=BTCUSDT'; var url = burl + query; var ourRequest = new XMLHttpRequest(); ourRequest.open('GET',url,true); ourRequest.onload = function(){ console.log(ourRequest.responseText); } ourRequest.send(); </script> My problem is how to handle these two api responds and also the functions to use them to place a trade and cancel it. Please help me out. Thanks in advance on any help.
  5. Hello everyone. please I have problem with printing out a value from inside an array of a nested json. ive tried several ways its always returns "index not define". here is the code . $valr= "https://ice3.com/api/v1/orderbook/ticker"; ////////////////////////////source $valrGet = file_get_contents($valr); $valrD = json_decode($valrGet, true); $valrSell = ["ask"] ["price"]; Here is the structure of the json from the source : {"errors":false,"response":{"entities":[{"pair_id":3,"pair_name":"BTC\/ZAR","ask":{"price":"179382.54","amount":"0.05357142"},"bid":{"price":"177229.4286563","amount":"0.0011"}},{"pair_id":4,"pair_name":"BTC\/NGN","ask":{"price":"8890000.00","amount":"0.10"},"bid": my target is to output the value of ("price") from "pair_name" BTC\/ZAR please help. Thanks in advance
  6. <?php $url = "https://btc-e.com/api/3/ticker/btc_usd"; $fileGet = file_get_contents($url); $json = json_decode($fileGet, TRUE); $json = $json["ticker"]["last"]; $premium = 5; //in percentage $premium = $premium / 100; $dollar_amount = $premium * $json; $customer_price = $json + $dollar_amount; echo $customer_price; ?> i was trying to display my own premiunm exchange rate. i mean (Buy Bitcoin on my site at $.....). i was doing this by using the last exchange rate from btc-e.com/api/btc_usd.which was a jason. what i did is that i define my own percentage from there last exchange rate and i add that percentage to it.but it doesn't work. above is example of my code let say im working with addition of 5 percent. please can i get a help ?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.