Notifications
option-icon

In reply to Websocket APIs

ROCKxROCK, on 30-Sep-2015 08:42 PM said:
> Websocket APIs are accessible only through Pusher JS?
Yes, Websocket API are accessible via Pusher service but you can use the library you want depending on your software infrastructure. Take a look at the pusher libraries page: https://pusher.com/docs/libraries
> No IP:PORT address?
Yes, no need for IP or PORT. Just use the library you get from Pusher and set it up with our key, channel and event as described here: https://api.therocktrading.com/doc/#api-websocket.
Thank you

768x90 vc

Websocket APIs are accessible only through Pusher JS?
No IP:PORT address?

Thank you!

Edited: 27-Jan-2016 08:33pm In reply to Re: Working on new API

Hello!
> 1)
> I still get a Non Autorized error message when trying to Call Show Orders with
> an ID of a deleted order, or an Id which never existed.
> An ID which is active or was executed does work without problems.
>
API has just been updated in order to better handle errors especially on 'show' and 'delete' order requests.
Now a show order request on an already deleted order, returns a 404 HTTP error 'record not found'. This replace the previous not authorized error for a better understanding.
> 2)
> In addition to that my bot got today the error message: "Error occurred deleting
> offer".
> When you send this error message? What was wrong with this order?
> If an order is not active, I normally get "'Cannot remove an offer which is not
> active'", so this can't be the error ?
Similarly to show request, when you try to delete an already deleted offer, you get a 404 error (deleted offers are no more available).
Instead if you try to delete an existing offer but not more active, you get a 422.
Please take a look at the API documentation pages for detailed information:
https://api.therocktrading.com/doc/v1/index.html#api-Trading_API-CancelOrder

Edited: 22-Jan-2016 07:10am In reply to Re: Working on new API

hey :)

1)
I still get a Non Autorized error message when trying to Call Show Orders with an ID of a deleted order, or an Id which never existed.
An ID which is active or was executed does work without problems.

2)
In addition to that my bot got today the error message: "Error occurred deleting offer".
When you send this error message? What was wrong with this order?
If an order is not active, I normally get "'Cannot remove an offer which is not active'", so this can't be the error ?

In reply to Re: Working on new API

mikexine, on 08-Sep-2015 04:11 PM said:
> You should definitely try something like Scaleway
> SSD Cloud Server
- it should be much much faster than a Raspberry..
thank you. I will try to inform myself about several servers.

In reply to Re: Working on new API

> At the moment this is for just 4 orders 8 seconds at my Pi. This is very long.
> Of course it is much faster at my windows pc (about 2 seconds), so I probably
> have to buy the Pi 2, maybe this would be faster.

You should definitely try something like Scaleway SSD Cloud Server - it should be much much faster than a Raspberry..

Edited: 08-Sep-2015 03:22pm In reply to Re: Working on new API

Paci Barbarossa, on 08-Sep-2015 02:08 PM said:
> You are right, you can't know which thread will get to us first, so my proposal
> does not work. You need another workaround, like your idea of using more apikeys.
>
>
> The real question is, do you really need threads? Why not simply place orders
> sequentially?

because depending on the device I use (PC or Rasberry Pi) and the exchange, it can take alot of time to place orders sequentially. At the moment I place orders sequentially at one exchange, but simultanously at all exchanges. So the total time of placing orders is the longest time I needed for placing orders sequentially. At the moment this is for just 4 orders 8 seconds at my Pi. This is very long. Of course it is much faster at my windows pc (about 2 seconds), so I probably have to buy the Pi 2, maybe this would be faster.

But sending all orders simultanously would also solve this problem.

With the help of mikexine I will add websocket APIs to my bot. I think this will also lower my needed calls to ask for openorders/orderbook/balance every 5 seconds, which should speed up everything, too.

> About show order, we will update documentation, in order to answer your question.

Thank you :)

> About what happened tonight, the answer is "nothing". We do not have reports of
> any problems, and our monitoring software did not report any downtime of any kind.
> I guess just a temporary network connection on your side.
>

Hmm.. but the connection to all other exchanges were fine (I got normal response for every call), so I wonder what the problem could be.

Edited: 08-Sep-2015 02:09pm In reply to Re: Working on new API

You are right, you can't know which thread will get to us first, so my proposal does not work. You need another workaround, like your idea of using more apikeys.

The real question is, do you really need threads? Why not simply place orders sequentially?

About show order, we will update documentation, in order to answer your question.

About what happened tonight, the answer is "nothing". We do not have reports of any problems, and our monitoring software did not report any downtime of any kind. I guess just a temporary network connection on your side.

Thank you

Edited: 19-May-2016 12:21pm In reply to Re: Working on new API

Paci Barbarossa, on 08-Sep-2015 10:27 AM said:
> If you are using threads, you need to be able to code thread wise. You can share
> a nonce, based on timestamp, between n threads, and add n to the base nonce for
> instance.
>
> /paci

Yes, but can I control the order you receive the calls? Even if I add +1 to every nonce, it might happen that you get 123456, then 123455 and then 123457, so the seconds one would cause an error. Or not? So I think several API Keys are the only solution.

Will you answer my question about "show order" and the error message, when I call for an ID wich never existed?

And what happend tonight 01:39am (UTC+01:00) at therock? I got tons of timeout errors, before my bot crashed =/

HTTPSConnectionPool(host='api.therocktrading.com', port=443): Read timed out. (read timeout=30)

HTTPSConnectionPool(host='api.therocktrading.com', port=443): Max retries exceeded with url: /v1/balances (Caused by ConnectTimeoutError(, 'Connection to api.therocktrading.com timed out. (connect timeout=30)'))

In reply to Re: Working on new API

If you are using threads, you need to be able to code thread wise. You can share a nonce, based on timestamp, between n threads, and add n to the base nonce for instance. Or you can use different apikeys, one for each thread, but sounds weird. Basically you have to decide how, but it's mandatory that any call has an incremented nonce.

/paci

Edited: 08-Sep-2015 10:21am In reply to No response from API

Scholastik, on 07-Sep-2015 06:55 PM said:
> Hi,
>
> because mikexine script does not have a timeout for requests (I'm sure he will
> add it now :) )
> my bot froze tonight. This also happend when using v0. I fixed it, by adding a
> timeout.
>
> But Paci, can you tell me, why this does happen? I only have this problem with
> TheRockTrading. So obviously it happens sometimes (mostly at night), that I get
> no answer from TheRockTrading. And without a timeout, my bot freezes.

Timeout added: https://github.com/mikexine/TheRock-Py/commit/723c712352e95f98e9b35d55f209c698a45f5f0b

thanks for your suggestion! :)

Edited: 07-Sep-2015 06:56pm

Hi,

because mikexine script does not have a timeout for requests (I'm sure he will add it now :) )
my bot froze tonight. This also happend when using v0. I fixed it, by adding a timeout.

But Paci, can you tell me, why this does happen? I only have this problem with TheRockTrading. So obviously it happens sometimes (mostly at night), that I get no answer from TheRockTrading. And without a timeout, my bot freezes.

Edited: 07-Sep-2015 06:33pm In reply to Re: Working on new API

@mikexine:
Your script sends the calls in a row. It waits until one order is placed and then places the next one.

I added threads, so the calls were sent exactly to the same time. That's why also the nonce values are the same.

I already tested hundreds of possible solutions (e.g my own function to generate nonces, to make sure they do increase), but I did not managed to get it to work :D (also because not all exchanges accept a selfmade nonce) So the best solution for now is, to do the calls in a row... but this takes time...

edit:
@ Paci Barbarossa:
Will more than one v1 API Key solve this?

In reply to Re: Working on new API

thank you :)

about errors:
Is it always the same form, if an error appaers ? I wrote my script that way now, that i checks if there is "errors" in the result. If so, in prints the result and stops. If no "errors" is in the result, it will continue.

It would be easier of course, if there would be always an "errors" key. The value to this key would be "true" if there is an error and "false" if there is no error.
But okay, would be too complicated to change this now.

About Show Order:
Okay, so if I'm also able to get deleted/executed orders, you should immediatly add this to your documentation ;)

Can you imagine, why everything does work, when I call for an ID that belongs to an open order, while I get the "Non Authorized" error, when calling an Id of an order which is already canceled?

Which error should appear, when I call for an ID which never existed?

Edited: 18-Jan-2016 01:58pm In reply to Nonce

Scholastik, on 05-Sep-2015 01:00 PM said:
> And another question:
>
> In version 0 was no nonce. So I was able to place 10 orders at once.
>
> Now you require a nonce and when I try to do several calls at once, I also get
> the "not authorized" error.
>
> Do you have an idea, how to make up to 10 calls at once, without having problem
> with nonce ? Making them in a row would take too much time =/
>
> edit:
> maybe with more than one API Key? One key for every call?

Hi

I tried to replicate you error with this code:


#setup
from PyRock import PyRock
apikey = 'API_KEY'
apisecret = 'API_SECRET'
rock = PyRock(apikey, apisecret)
# just trying to buy 1 euro at 1 doge
fund = 'eurdog'
amount = 1
price = 1
# sending 10 different buy orders and printing the nonce (it is the "same nonce" as in PyRock).
for x in range(0, 10):
print int(time.time() * 1e6)
buyorder = rock.PlaceBuyOrder(fund, amount, price)
print(buyorder)
print(x)

and I get no errors, every order is created.
Can you describe how you get that error? maybe you're making too many calls..
Thanks! :)

In reply to API v 1 first suggestions

Scholastik, on 05-Sep-2015 11:53 AM said:
> Hi,
> now I implemented the API v1 into my bot (thanks to mikexine https://github.com/mikexine/TheRock-Py
> ) .
>
> But I have a few suggestions/complains ;)
>
> 1) You should include more info in your documentation.
> - We need all possible error responses for every kind of call and how the response
> with an error in it looks like.
> - we also need all possible information about the data in the response. E.g when
> I call "show order", there is the info "status". But what could status be? How
> does the string looks like, when the order is not "active"?

Documentation is never enough :-) We will try to expand it even more. All possibles error messages would make it very long and complex, but we'll see what we can do in between.

Status for an order should be very clear: can be active, but also deleted, or executed.

> 2) "Show Order" vs "Show transaction". Why you made two seperated calls for this?

Because they are two completely separate object. An order does not necessarily
create a transaction, as a transaction does not necessarily create an order or
can be linked to one.

> The reason for calling this, is to find out if the order was filled partly, or
> filled completly. But if the order was filled completly I get an error message
> "Not Authorized", which doesn't help at all. So you should either add a better
> error message there, like "order not found in open orders" or you should merge
> these two functions, to be able to get the status of every order.

If you get a "Not Authorized", then you are making some mistakes. With authorization,
indeed.

> edit:
> if you don't merge those two functions, we also need a "status" info in the Show
> Transaction response. There we could get info about, if the order was cancelled
> or filled or partly filled.
>
> edit2:
> I just found out, that I missunderstood the "show transaction" call. It is not
> for orders, but only for deposit/withdrawal.
> So how do I get information about not active orders?

Oh, ok, now I see your error.

To get informations of non active order, you can use show order to get specific
informations on that order.

Otherwise we can add the ability to filter the list of orders on API "orders",
if you prefer.

Thank you
/paci

Edited: 05-Sep-2015 01:53pm

And another question:

In version 0 was no nonce. So I was able to place 10 orders at once.

Now you require a nonce and when I try to do several calls at once, I also get the "not authorized" error.

Do you have an idea, how to make up to 10 calls at once, without having problem with nonce ? Making them in a row would take too much time =/

edit:
maybe with more than one API Key? One key for every call?

Edited: 05-Sep-2015 12:00pm

Hi,
now I implemented the API v1 into my bot (thanks to mikexine https://github.com/mikexine/TheRock-Py ) .

But I have a few suggestions/complains ;)

1) You should include more info in your documentation.
- We need all possible error responses for every kind of call and how the response with an error in it looks like.
- we also need all possible information about the data in the response. E.g when I call "show order", there is the info "status". But what could status be? How does the string looks like, when the order is not "active"?

2) "Show Order" vs "Show transaction". Why you made two seperated calls for this? The reason for calling this, is to find out if the order was filled partly, or filled completly. But if the order was filled completly I get an error message "Not Authorized", which doesn't help at all. So you should either add a better error message there, like "order not found in open orders" or you should merge these two functions, to be able to get the status of every order.

edit:
if you don't merge those two functions, we also need a "status" info in the Show Transaction response. There we could get info about, if the order was cancelled or filled or partly filled.

edit2:
I just found out, that I missunderstood the "show transaction" call. It is not for orders, but only for deposit/withdrawal.
So how do I get information about not active orders?

Thank you :)

Edited: 23-Jan-2016 10:40am In reply to Re: Working on new API

About the v1 API signature:

we have received some feedbacks that it's not clear if signature has to include URL with params or not

to try to avoid confusion, we have decided to include everything in the URL, params included,
when using an API with GET method

so, if you are passing optional params to, for instance, https://api.therocktrading.com/v1/transactions signature has to be something like:


{ nonce }{ url with params if GET }
10294858483https://api.therocktrading.com/v1/transactions?currency=EUR

Plus, we are going to add, on v1, a timestamp on almost any API that return an object, as requested by several users.

Finally, remember that v1 is still subject to changes, so if you see bugs or have a change proposal, do not hesitate to let us know.

Thank you
/paci

Edited: 13-Jul-2015 02:31pm In reply to Re: Working on new API

Someone asked us why the "logged users online" statistics has been lower recently.

The number is lower now, because it's not including trading bots anymore with the switch to new api.therocktrading.com service.

We will probably add back to the ticker that number, but differentiating between "real" logged in users (like it is now) and trading bots.

EDIT: we are now reporting, logged in users on web interface, and active v0 and v1 bots in the last 24h.

Thank you
/paci

In reply to Re: Working on new API

Scholastik, on 01-Jul-2015 02:47 PM said:
> Hi paci :)
>
> I just want to remind you, to add an additional output information to a successful
> cancel. The information about the last unfilled amount, before it was canceled
> ;)

Basically all actions on v1 API will return the object created/modified.

So, yes, when deleting an offer, the entire offer with its informations will be returned, including the amount_unfilled as you are requesting :-).

Let me stress once again that v1 will be open to modifications and adjustments in the first period of deployment, which means:

1. if you create a bot using v1 API be aware that specification may change and break your bot, so be advised
2. if you have requests for additional features or better ones, do not hesitate to voice your opinions while things can still be changed

Thank you!
/paci

Edited: 18-Jan-2016 08:18pm In reply to Working on new API

Hi paci :)

I just want to remind you, to add an additional output information to a successful cancel. The information about the last unfilled amount, before it was canceled ;)

Edited: 20-Jan-2016 09:59am In reply to Re: Working on new API

The new API system is almost ready and will probably deploy in the next 24-72 hours.

It's not an easy task, so we do not promise to deploy it in this timeframe, neither that it will work smoothly even if we have tested the process a lot.

I want to remind all that the result will be:
- a new separate server for API (api.therocktrading.com)
- a new v0 api that will replicate the current ones that will be sooner or later not supported anymore
- a new v1 api with stronger security, better documentation, wider functionalities; this one will be the reference in the future, but for a while it will be subject to changes thanks (I hope) to users feedback
- a new API on websockets

If you have questions or concerns, don't hesitate to voice your opinion.

Stay strong, be a rock.
/paci

In reply to Re: Working on new API

ervalvola, on 20-May-2015 11:41 AM said:
> Good to hear!
>
> +1 for personal transactions!
> +1 for read-only API
>
> For now the only request that comes to my mind is an API to cancel all orders
> at once. But more to come, for sure...

We have this too! :-)
It's restricted to a particular currency pair: you can cancel all orders on BTCEUR, for instance, not all orders as a whole.

Thank you for your input
/paci

Edited: 10-Jan-2016 11:36pm In reply to Working on new API

Good to hear!

+1 for personal transactions!
+1 for read-only API

For now the only request that comes to my mind is an API to cancel all orders at once. But more to come, for sure...


Back