Profitability API

Encounter a problem related to the pool or have a request for a feature? Post your issue here and we will help you out.
Forum rules
Welcome to the System Support forum! Encounter a problem related to the pool? Post your issue here and we will help you out.

Keep in mind that the forums are monitored by PROHASHING less closely than the official support channels, so if you have a pressing issue, please submit an official support ticket so that our Support Analyst can look into your issue in a timely manner.

We cannot answer financial questions related to your account on a public forum, so those questions should always be submitted through the orange Support button on prohashing.com/about.

For the full list of PROHASHING forums rules, please visit https://prohashing.com/help/prohashing- ... rms-forums.
Locked
Maznoz
Posts: 27
Joined: Thu Sep 03, 2015 6:02 am

Profitability API

Post by Maznoz » Sat Apr 02, 2016 3:21 am

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
User avatar
Steve Sokolowski
Posts: 4585
Joined: Wed Aug 27, 2014 3:27 pm
Location: State College, PA

Re: Profitability API

Post by Steve Sokolowski » Wed Apr 06, 2016 12:14 pm

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.
Maznoz
Posts: 27
Joined: Thu Sep 03, 2015 6:02 am

Re: Profitability API

Post by Maznoz » Thu Apr 07, 2016 4:34 am

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
User avatar
Steve Sokolowski
Posts: 4585
Joined: Wed Aug 27, 2014 3:27 pm
Location: State College, PA

Re: Profitability API

Post by Steve Sokolowski » Thu Apr 07, 2016 8:16 am

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.
User avatar
Steve Sokolowski
Posts: 4585
Joined: Wed Aug 27, 2014 3:27 pm
Location: State College, PA

Re: Profitability API

Post by Steve Sokolowski » Thu Apr 07, 2016 8:48 pm

Hi Maznoz,

Thanks for the report. The REST API has now been fixed and the changes are available immediately.

Thanks again,

-Steve
kaptainkrayola
Posts: 7
Joined: Mon Apr 17, 2017 6:39 pm

Re: Profitability API

Post by kaptainkrayola » Mon Apr 17, 2017 6:41 pm

the REST api seems to return data about 1 in 10 times.
User avatar
Steve Sokolowski
Posts: 4585
Joined: Wed Aug 27, 2014 3:27 pm
Location: State College, PA

Re: Profitability API

Post by Steve Sokolowski » Mon Apr 17, 2017 7:13 pm

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?
kaptainkrayola
Posts: 7
Joined: Mon Apr 17, 2017 6:39 pm

Re: Profitability API

Post by kaptainkrayola » Mon Apr 17, 2017 10:04 pm

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!
Locked