1

在这个文档中,我们有一个关于 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... 
4

1 回答 1

2

好的,我找到了答案:

我们有基础:

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

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

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"
}

其中 f_sign_query eq 到这个

如果我们替换“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)}
}

等等...

于 2013-04-02T14:39:53.307 回答