使用R创建订单API Binance

时间:2018-12-05 14:42:17

标签: r api rstudio cryptocurrency binance

请帮助...:)

我正在尝试通过RStudio中的Binance API创建订单,但无法创建订单。

这是我使用的代码:

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'
)

我得到回应: 回应[https://api.binance.com/api/v3/order?signature=3e70e503ca46fa86d11a3c4d1c4fa1486be78f6d9c1c09b7e05ea4ae04c303e7]   日期:2018-12-05 14:29   状态:400   内容类型:application / json; charset = utf-8   大小:95 B

但是我的Binance帐户没有任何反应:/

我在做什么错了?

谢谢...

0 个答案:

没有答案