Coinigy / api

Coinigy API Examples
159 stars 65 forks source link

addOrder always returns internal_order_id "0" #41

Open nklarer-core opened 5 years ago

nklarer-core commented 5 years ago

I have written a function that passes a set of values to a dictionary and posts to the addOrder endpoint. However, I always receive the following response from the endpoint:

b'{"data":{"internal_order_id":"0"},"notifications":[]}'

Function

` def makeOrder(self, auth_id, exch_id, mkt_id, order_type_id, price_type_id, limit_price, order_quantity):

headers = {
  'Content-Type': 'application/json',
  'X-API-KEY': self.APIKEY,
  'X-API-SECRET': self.APISECRET,
}

values = {
  "auth_id": int(auth_id),
  "exch_id": int(exch_id),
  "mkt_id": int(mkt_id),
  "order_type_id": int(order_type_id),
  "price_type_id": int(price_type_id),
  "limit_price": int(limit_price),
  "order_quantity": float(order_quantity),
}

print(values)
request = requests.post('https://api.coinigy.com/api/v1/addOrder', json=values, headers=headers)
logging.debug(request.content)
print(request.content)

return request.json()['data']['internal_order_id']`

Here is a sample dictionary:

{'mkt_id': 3341, 'limit_price': 3603.78, 'order_quantity': 0.001, 'auth_id': 396720, 'price_type_id': 3, 'order_type_id': 2, 'exch_id': 70}

Has anyone encountered this?

ByronAP commented 5 years ago

I have not, but I will look into it in a few

nklarer-core commented 5 years ago

Thanks.

Yesterday, I tried the call on the mock server. It worked correctly and returned an ID.

Then, I tried to use the wrapper in your Coinigy repo. That returned the same response in the original post.

My account was upgraded manually. Could this be a permissions issue?

robborden commented 5 years ago

Nathan,

It could be a bug with returning the order id through the API after placing an order on the specific exchange you're using. I have determined which exchange that is and I will investigate. However, I noticed that the account you're using doesn't have Trading activated for the account on this page: https://www.coinigy.com/user/api. Can you please activate this for your account and give it another try?