Peatio Wrappers vs new API .
Issue #405
resolved
I am testing (TestWrappers.java) the wrappers against the new internal exchange.
Some API method works, some doesn't. It seems to me that all the "read" operations works (getbalance, getorders), while the "write" operations fails (cancel, trade)
However from my profile there is no way of changing the access level of api keys.
Examples of api calls:
getbalance :
>>> 10:00:57.861 c.n.n.t.w.PeatioWrapper 834 DEBUG - Calling /api/v2/members/me with params:{access_key=mft0J5epMFpIgeX7A6ZY8rOpfsxuCgq8VOSEbCvu, signature=611b8f3aeb1729d8824077b2e81740f938d2239b6b89400f0ce1ff388c9be0e7, tonce=1427360457859}
>>> 10:00:57.975 c.n.n.t.w.PeatioWrapper 855 DEBUG - result:{}{"sn":"PEAWXXRDQTJTIO","name":"Desrever Nu","email":"desrever.nu@gmail.com","activated":true,"accounts":[{"currency":"usd","balance":"0.0","locked":"0.0"},{"currency":"btc","balance":"0.28","locked":"0.01"},{"currency":"nbt","balance":"0.0","locked":"0.0"},{"currency":"eur","balance":"0.0","locked":"0.0"}]}
>>> 10:00:57.978 c.n.n.t.WrapperTestUtils 59 INFO -
Positive response from TradeInterface.getBalance()
>>> 10:00:57.979 c.n.n.t.WrapperTestUtils 62 INFO - Balance{PEGTotal=.29 BTC
, PEGonOrder=.01 BTC
, PEGAvailable=.28 BTC
, NBTTotal=0 NBT
, NBTonOrder=0 NBT
, NBTAvailable=0 NBT
}
getactive orders :
>>> 10:00:59.081 c.n.n.t.w.PeatioWrapper 834 DEBUG - Calling /api/v2/orders with params:{access_key=mft0J5epMFpIgeX7A6ZY8rOpfsxuCgq8VOSEbCvu, limit=999, market=nbtbtc, signature=7ba25901f479142be7f504086cd30c06214666c495fa6984a02f98fb0afb1915, tonce=1427360459080}
>>> 10:00:59.200 c.n.n.t.w.PeatioWrapper 855 DEBUG - result:{}[{"id":3,"side":"buy","ord_type":"limit","price":"0.0001","avg_price":"0.0","state":"wait","market":"nbtbtc","created_at":"2015-03-26T08:53:21Z","volume":"100.0","remaining_volume":"100.0","executed_volume":"0.0","trades_count":0}]
>>> 10:00:59.203 c.n.n.t.WrapperTestUtils 159 INFO -
Positive response from TradeInterface.getActiveOrders(CurrencyPair pair)
>>> 10:00:59.204 c.n.n.t.WrapperTestUtils 162 INFO - Active orders : 1
>>> 10:00:59.204 c.n.n.t.WrapperTestUtils 165 INFO - Order{id=3, insertedDate=Thu Mar 26 08:53:21 CET 2015, executedDate=null, type=buy, pair=nbtbtc, amount=100 NBT
, price=.0001 BTC
, amountPlusFee=null, completed=false}
Buy:
09:57:22.645 c.n.n.t.w.PeatioWrapper 834 DEBUG - Calling /api/v2/orders with params:{access_key=mft0J5epMFpIgeX7A6ZY8rOpfsxuCgq8VOSEbCvu, market=nbtbtc, price=1.2E-5, side=buy, signature=4a435a07964e0eb4f47c322abb930d8e07ae132283673ead54c98b7b172fc4e7, tonce=1427360242645, volume=0.001}
>>> 09:57:22.756 c.n.n.t.w.PeatioWrapper 855 DEBUG - result:{}{"error":{"code":2001,"message":"Authorization failed"}}
cancel order :
>>> 10:01:01.526 c.n.n.t.w.PeatioWrapper 834 DEBUG - Calling /api/v2/order/delete with params:{access_key=mft0J5epMFpIgeX7A6ZY8rOpfsxuCgq8VOSEbCvu, id=3, signature=fe80ce0b6ef6dc7ef0725edebac30f952238e3e9d687aa765ffaec53523a52c4, tonce=1427360461526}
>>> 10:01:01.693 c.n.n.t.w.PeatioWrapper 855 DEBUG - result:{}""
>>> 10:01:01.694 c.n.n.t.w.PeatioWrapper 166 ERROR - httpResponse: ""
java.lang.ClassCastException: java.lang.String cannot be cast to org.json.simple.JSONArray
>>> 10:01:01.694 c.n.n.t.WrapperTestUtils 197 ERROR - ApiError [2 : Parsing Error]
I wonder if something changed in terms of API / signatures on their side, or may be a permission problem. Can someone try to get to the bottom of this?
Comments (8)
-
-
reporter - edited description
-
reporter @creon suggested it was a POST vs GET problem. checking it right now
-
reporter nope, maybe spotted a problem with the url : was calling http instead of https
-
reporter - changed status to resolved
httpS
-
reporter - changed milestone to 0.3.1 - Liquidity distribution model
-
reporter - changed milestone to 0.3.3 - Liquidity distribution model
-
reporter - changed milestone to 0.3.2 - Liquidity distribution model (t2)
- Log in to comment
API v2 docs for reference:
https://demo.peatio.com/documents/api_v2?lang=en