MtGox webstream api



在这个文档中我们有一个关于webstream mtgox api的信息。

所以这个问题。我们有下一个:

query = {
  "id":id,
  "call":apicall,
  "nonce":nonce,
  "currency":cry,
  "parameters":params,
  "item":item
}
output = serialize({
           "op":"call",
           "id":id,
           "call":self.encode_and_sign(serialize(query)),
           "context":"mtgox.com"
         })
ws.send(output)

此代码基于以下示例

我不能在HTTP-API和Webstreaming API (MtGox)之间建立同构。你能给出一个有效的{apicall,params,item}的例子吗?例如:

https://mtgox.com/api/1/generic/info
https://mtgox.com/api/1/generic/orders
maybe some more complex... 

好了,我找到了答案:

我们有基数:

query = {
  "id":id,
  "call":apicall,
  "nonce":nonce,
  "currency":cry,
  "parameters":params,
  "item":item
}

对于url =~ https://mtgox.com/api/1/generic/info => result查询将是下一个:

info_query = {
  "id":"1",
  "call":"private/info",
  "nonce":["0.63745499","1364911980"]
}
res_query = {
  "op":"call",
  "id":"1",
  "call":f_sing_query(apikey,secretkey,info_query),
  "context":"mtgox.com"
}

where f_sign_query eq to this

如果我们替换"private/info" -> "private/orders",我们将得到我们自己的订单。

现在,让我们按日期获取交易

fetch_query = {
  "id":"1",
  "call":"BTCUSD/trades/fetch",
  "nonce":["0.63745499","1364911980"],
  "params":{"since":"1363425799999469"}
}

result_query将是相同的(!Info_query <- fetch_query)

现在,add_trade的时刻。示例:我们想以1BTC-56.12345USD的价格卖出0.01 BTC

add_query = {
  "id":"1",
  "call":"BTCUSD/order/add",
  "nonce":["0.63745499","1364911980"],
  "params":{"type":"ask","amount_int":str(100000000*0.01),"price_int":str(56.1234*100000)}
}

相关内容

  • 没有找到相关文章