please help...:)
I am trying to create an order via Binance API in RStudio, but I cannot create it.
This is the code that I use:
apiKey <- "*My API key*"
secretKey <- "*My Secret key*"
timestamp <- GET(url = "https://api.binance.com", path = "/api/v1/time")
timestamp=content(timestamp, as="parsed")
timestamp=timestamp$serverTime - 1542213129131.6
"symbol" = "BTS-BTC"
"side" = "SELL"
"type" = "MARKET"
"quantity" = 1000
"recvWindow" = 5000000000000
"timeInForce" = "GTC"
postmsg <- paste0("timestamp=", timestamp,"&recvWindow=",recvWindow,"&symbol=",symbol,
"&side=",side,"&type=",type,"&quantity=",quantity,"&timeInForce=",timeInForce)
signature <- openssl::sha256(postmsg, key=secretKey)
POST(
url = "https://api.binance.com",
path = "api/v3/order",
content_type('application/json'), add_headers(.headers = c("X-MBX- APIKEY"=apiKey)),
query=list(signature=signature),
encode = 'json'
)
I am getting response: Response [https://api.binance.com/api/v3/order?signature=3e70e503ca46fa86d11a3c4d1c4fa1486be78f6d9c1c09b7e05ea4ae04c303e7] Date: 2018-12-05 14:29 Status: 400 Content-Type: application/json;charset=utf-8 Size: 95 B
But nothing happens on my Binance account :/
What am I doing wrong?
Thanks...