Bitcoin Forum
July 29, 2024, 12:19:51 PM *
News: Help 1Dq create 15th anniversary forum artwork.
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Mt.Gox API v2 - addition to nitrous documentation  (Read 815 times)
mikhail_tomsk (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
May 31, 2013, 03:35:59 AM
 #1

Cannot post to correct topic, https://bitcointalk.org/index.php?topic=164404.0
I hope someone will repost it.

I've made few trading applications - for me and for my customers on elance and I've found that with v2 API I can't get executed order status.
MONEY/ORDERS returns only open orders, and it seems there's no way to get when your order was executed and at what price.
Luckely, it's not true.
I'm using nitrous documentation, as it is most full
https://bitbucket.org/nitrous/mtgox-api/
Unfortunately, one method is not described:
MONEY/ORDER/RESULT
Let me do it for him:

arguments:
type   bid or ask
order   The id of the order

Sample response:
{"result":"success","data":{"order_id":"c434bee8-a349-4abb-b90b-29134ab6d362",
"trades":[
{"trade_id":"1369967240940410","primary":"Y","currency":"USD","type":"ask","properties":"market","item":"BTC",
"amount":{"value":"0.05000000","value_int":"5000000","display":"0.05000000\u00a0BTC","display_short":"0.05\u00a0BTC","currency":"BTC"},
"price":{"value":"129.00000","value_int":"12900000","display":"$129.00000","display_short":"$129.00","currency":"USD"},
"spent":{"value":"6.45000","value_int":"645000","display":"$6.45000","display_short":"$6.45","currency":"USD"},
"date":"2013-05-31 02:27:20"}],
"total_amount":{"value":"0.05000000","value_int":"5000000","display":"0.05000000\u00a0BTC","display_short":"0.05\u00a0BTC","currency":"BTC"},
"total_spent":{"value":"6.45000","value_int":"645000","display":"$6.45000","display_short":"$6.45","currency":"USD"},
"avg_cost":{"value":"129.00000","value_int":"12900000","display":"$129.00000","display_short":"$129.00","currency":"USD"}}}

Response fields in data:
order_id - The id of the order
trades -list of trade objects, described below
total_amount - currency object, amount of BTC to trade (sum of trades amounts)
total_spent - currency object, total USD spent or received (sum of trades amounts)
avg_cost - currency object, average BTC cost

trade object:
primary - "Y" or "N", I understand what is it, but didn't meet anything other than "Y", probably because my orders always fit into 1 trade
currency - Order currency
type - bid or ask
properties - Contains "market" for orders at market price
item - BTC, it is always BTC both for bid and ask type orders
amount - currency object, amount of BTC in this trade
price - currency object, BTC price for this trade
spent - how much USD was spent or received (depending on type - bid or ask)
date - date/time of this trade. formatted string


Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!