Page 1 of 1
Profitability API
Posted: Sat Apr 02, 2016 3:21 am
by Maznoz
Hi,
is there currently a working API to get (near) real-time or aggregated over some period of time (15m to 1 hour) profitability information?
The old endpoint (
https://prohashing.com/exchange/instantProfitability) has been returning null for a while. The new live stats on the charts page seem interesting, is there a way to connect to the websocket API?
If you want to prevent public access it could be an option to protect the API with a token (JWT) associated to a user account.
Best,
Maznoz
Re: Profitability API
Posted: Wed Apr 06, 2016 12:14 pm
by Steve Sokolowski
Thanks for the report. I will fix that as soon as possible. However, there is a better way to get profitability that provides more accurate and up-to-date data.
There is a WAMP endpoint that will give the same live profitability that is visible in the bar chart. It is undocumented, but you can use it until we do document it next week. The WAMP server is wss://prohashing.com:444/ws with username web and password web. Subscribe to channel "profitability_updates." The profitability is the average of the past 250 shares, which right now are being inserted every 5 seconds or so.
The URL will be changed in about two weeks to
https://live.prohashing.com:443/ws and we'll update you on that when it happens, but the JSON returned on the channel will be the same. The reason for that change is that some people have port 444 blocked, and it's also why we haven't documented this feature until we get it changed.
Please offer comments and suggestions.
Re: Profitability API
Posted: Thu Apr 07, 2016 4:34 am
by Maznoz
Hi Steve,
thanks alot for this information. Using the WAMP endpoint is exactly the solution I was looking for but I couldn't find the username/password. I expect to have a go at using this endpoint over the weekend.
Best,
Maznoz
Re: Profitability API
Posted: Thu Apr 07, 2016 8:16 am
by Steve Sokolowski
Keep in mind that the endpoint's address will change sometime next week when it is formally released.
If you want to make sure you are protected, add an "if" statement to your code to connect to live.prohashing.com:443 when you are disconnected.
Re: Profitability API
Posted: Thu Apr 07, 2016 8:48 pm
by Steve Sokolowski
Hi Maznoz,
Thanks for the report. The REST API has now been fixed and the changes are available immediately.
Thanks again,
-Steve
Re: Profitability API
Posted: Mon Apr 17, 2017 6:41 pm
by kaptainkrayola
the REST api seems to return data about 1 in 10 times.
Re: Profitability API
Posted: Mon Apr 17, 2017 7:13 pm
by Steve Sokolowski
kaptainkrayola wrote:the REST api seems to return data about 1 in 10 times.
We announced last month that we were considering deprecating the REST API in favor of WAMP, which provides much more accurate and instant updates with less bandwidth. The documentation (search for "WAMP") provides more information on that. Nobody said they were using it, so we went ahead.
Is it possible for you to convert to the new API?
Re: Profitability API
Posted: Mon Apr 17, 2017 10:04 pm
by kaptainkrayola
I tried to do it server side with node.js and couldn't get it to talk to me. I'm going to implement it client side and see if i can get the JS to work. If it does then there's no need for the REST interface so we might be good anyway. I'll post back here once I have something working.
Thanks!