Here is a step -by -step guide to creating an order EPI using binance with Rstudio. We will use a binance in the R package to call bees.
Step 1: Required packages Install **
The following packages must be installed:
`r
Install.packages (“Curl”)
Install.packages (“Readr”)
Install.Packages (“JSONLITE”)
`
Step 2: Set API Binance Accreditation Data
Make sure you have a binance account and create an API key and a secret key. This can be done on the [binance API site] (
For example:
- Create a new API key:
+ Go to your Binance account
+ In the upper right corner click "Account"
+ Scroll down to the "Token API" section
+ Select "Edit"
+ Complete the requested fields and click "Save Changes"
- Create a new secret key:
+ Go to your Binance account
+ In the upper left corner click "Settings"
+ Scroll down to the "secret" section
+ Click "generate the secret key"
+ Copy the generated secret key
Step 3: Write C code to make calls
Create a new R file and paste this code:
r
Set API Binance Accreditation Data
Apikey <- "Your key bees“
SecretKey <- "Your secret key“
Recharge Libraries Request
Library (binance)
Library (Readr)
Library (JSONLITE)
Define the feature to create an order
CREATE_ORDER <- Function (API_KEY, SECRET_KEY) {
Create a new order object
Order <- Create_order ({
API_KEY = API_KEY,
SecretKey = SecretKey,
symbol = “btcusdt”,
Half = “buy”,
Type = “Limit”,
quantity = 10,
Price = 10000
})
Return the created order
return (order)
}
Of use:
Order <- Create_order (API_KEY, SecretKey)
Prints details of order
Print (order)
`
Step 4: Make a r code with Binance API library
In your ID Rstudio, click "File"> "New File" or pressCtrl+N ‘to create a new file. So, go to the directory where you saved the R file and paste the above code.
Click “Make” (or press F5) to make the code. This will make binance calls to create an order using your credentials.
Error message:
If you find errors, make sure:
- Bees and the secret key is correct
- You have installed the requested packages (
Curl
,Readr 'and' JSONLITE
)
- Idstio is connected to your binance account
You can use the following error message as a reference:
`
Error: Error Create_order ({
API_KEY = API_KEY,
SecretKey = SecretKey,
symbol = "btcusdt",
Half = "buy",
Type = "Limit",
quantity = 10,
Price = 10000
}): Call API Binance Failed
`
If you still find problems, feel free to ask for further help!