Script:
Sending Orders to Binance Via Google Script Apps
. In this article, we will show you how to connect their api.
Prerequisites
- You have a google account and have enabled the Google apps script api for your project.
- You have a binance account and are familiar with their website.
.
Step 1: Set Up The Google Apps Script Project
1.
- Then, click on the “Enable” button next to “Google Custom Search API”.
3.
Step 2: Install the Binance API Client Library
- Open Your Google Apps Script Project.
- Click on the “Libraries” Menu and Select “Manage Libraries”.
- Search for “Binance API Client Library” and click on the Result.
4.
Step 3: Create a new script to send an order
1.
2.
3.
Code:
`JavaScript
Function Sendorder (Tobinance, Order) {
var api = binance.client;
// Set The API Endpoint and Authentication Details
api.setendpoint (“
var apikey = “your_api_key”;
var apisecret = “your_api_secret”;
// Set The Order Information
var orderinfo = {
“Symbol”: Tobinance,
“Side”: Order [“Side”],
“Type”: Order [“Type”],
“Quantity”: Order [“Quantity”]
};
// Send a post request to binance API
api.post (“/order”, orderinfo, function (error, response) {
If (Error) {
Console.log (“Error Sending Order:”, Error);
} Else {
console.log (“Order Sent successionfully!”);
}
});
}
`
Step 4: Call the Sendorder
Function From Your Google Apps Script Project
1.
2.
Example Code for a Button:
`JavaScript
Function OneDit (e) {
var tobinance = e.sourceeapp.getactiveshtiveSheet (). Getrange (1, 1) .getvalue ();
Var order = e.sourceeapp.getactiveshteSheet (). Getrange (2, 2) .getvalue ();
Sendorder (Tobinance, Order);
}
`
This script will call the Sendorder
function when an edit is made to a cell in your sheet.
Step 5: Test Your Script
- Save your Google Apps Script Project.
- Go to the “Run” Menu and Select “Send Order”.
- Enter the Binance Symbol, Side, Type, and Quantity of the Order you want to send.
- Click on the button or press enter.
If everything is set up correctly, your script should send an order an order an order to binance using their api. Button again.
API Documentation
API Documentation:
Note: This is just a basic example to get you started. .
Hope this helps! Let me know if you have any questions or need further assistance.