0

请帮忙...:)

我正在尝试通过 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

但是我的币安账户上什么也没发生:/

我究竟做错了什么?

谢谢...

4

0 回答 0