今晚在线等一段js改成java(重谢)

李海华 2017-10-11 10:30:59
必有重谢,50元红包,会的应该半小时搞定
const crypto = require('crypto')
const request = require('request')

const apiKey = '<Your API key here>'
const apiSecret = '<Your API secret here>'

const apiPath = 'v2/auth/r/alerts'
const nonce = Date.now().toString()
const body = { "type": "price" }
const rawBody = JSON.stringify(body)
let signature = `/api/${apiPath}${nonce}${rawBody}`

signature = crypto
.createHmac('sha384', apiSecret)
.update(signature)
.digest('hex')

const options = {
url: `https://api.bitfinex.com/${apiPath}`,
headers: {
'bfx-nonce': nonce,
'bfx-apikey': apiKey,
'bfx-signature': signature
},
body: body,
json: true
}
request.post(options, (error, response, body) => {
console.log(body);
})
...全文
240 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
縱頭開始 2017-10-12
  • 打赏
  • 举报
回复
代码还需要?
李海华 2017-10-11
  • 打赏
  • 举报
回复
有用,在线等,方便的朋友可加我,我的是290695839

23,407

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧