Jump to content

Crypto Market Order functions That Create and Cancel Order with Php and javascript


Recommended Posts

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.

Link to post
Share on other sites

I removed the apikeys from your message.  Keep in mind this is a public forum, spidered by google.  Even if those are development keys, you don't want to publish them to the world.

Link to post
Share on other sites

This pretty interesting, not going to lie. I'm too technically impaired to understand what's happening in the source code, but I still understand some things about the crypto market. I use tools to help me nevigate through what's happening, like investous is my favorite right now cause it's the one that lets me best understand the way the whole stuff works. I'm pretty happy with the few hudred bucks I was able to make on my own, cause my kids laughed at me when I told them about me starting in crypto. Guess I can laugh at them now, cause I made more than they ever did by investing, haha.

Edited by Barand
spammy link removed
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.