Skip to content

Commit

Permalink
add order and cancel order
Browse files Browse the repository at this point in the history
  • Loading branch information
nederhoed committed May 26, 2013
1 parent b2505e3 commit c948101
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
9 changes: 7 additions & 2 deletions example/orders.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@

# Open Orders
orders = api.orders(market)
pp.pprint(orders)
print len(orders), "open orders"

if not orders:
print api.add(market, 'bid', Decimal('0.01'), Decimal('10'))
order_id = api.add(market, 'bid', Decimal('1000'), Decimal('10'))
print "added:", order_id

orders = api.orders(market)
pp.pprint(orders)

for order in orders:
order_id = order['oid']
api.cancel(market, order_id)
print "cancelled:", order_id
10 changes: 8 additions & 2 deletions mtgoxexp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,14 @@ def add(self, market, type_,amount, price=None):
result = self.mtgox.call(path, data)
return result['data']

def cancel(self, todo):
"""Place order """
def cancel(self, market, order_id):
"""Cancel order """
path = "%s/money/order/cancel" % market
data = {
'oid': order_id,
}
result = self.mtgox.call(path, data)
return result['data']

if __name__ == "__main__":
import doctest
Expand Down

0 comments on commit c948101

Please sign in to comment.