Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attack_hourly_cost value no longer returned. #47

Closed
lukechilds opened this issue Sep 18, 2019 · 9 comments · Fixed by #48
Closed

attack_hourly_cost value no longer returned. #47

lukechilds opened this issue Sep 18, 2019 · 9 comments · Fixed by #48

Comments

@lukechilds
Copy link
Contributor

lukechilds commented Sep 18, 2019

There is no longer a number value returned for attack_hourly_cost, each coin has a '?' string instead.

This is breaking howmanyconfs.com (lukechilds/howmanyconfs.com#12) which relies on that value in it's own calculations.

Is it possible to add support for this metric back in?

Thanks!

@tdickman
Copy link
Owner

@lukechilds Sorry about that - I'll take a look at it tonight and let you know when it's fixed.

@lukechilds
Copy link
Contributor Author

Thanks a lot ❤️

No rush, whenever you can find some time.

@tdickman
Copy link
Owner

It looks like we'll need to move to Nicehash's v2 api as documented here: https://docs.nicehash.com/, so this is going to take a bit more time.

Happy to accept prs as always :).

@lukechilds
Copy link
Contributor Author

Ok, I'm in the process of obtaining a new visa and moving countries so limited time at the moment but happy to look into this once I've got everything sorted.

@lukechilds
Copy link
Contributor Author

@tdickman yup, had a little play today, it looks like it's this line always returning 0 which then breaks all the further calculations:

cost = nh.get_cost_global(coin_algorithm, coin_hashrate)

Will dig into nh code tomorrow and see what needs to be done to get it working with the new NiceHash API.

@lukechilds
Copy link
Contributor Author

@tdickman sorry for the late response, I've been quite ill.

I spent some time looking into this but don't even seem to be able to get the project to run anymore, after setting up virtualenv with deps I just get:

Traceback (most recent call last):
  File "crypto51/app.py", line 12, in <module>
    nh = NiceHash()
  File "/Users/lukechilds/dev/oss/crypto51-standard/crypto51/apis/nicehash.py", line 19, in __init__
    self._buy_info = requests.get('https://api.nicehash.com/api?method=buy.info').json()
  File "/Users/lukechilds/.local/share/virtualenvs/crypto51-standard-vAU0x_mH/lib/python3.7/site-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Looks like some JSON error but I'm sure it was running when I first created this issue. I could even spoof NH API with cost = n from here. Not sure what changed. Possibly they just changed the NH API JSON response in the last few days but not sure how likely that is.

Anyway, I'm not super familiar with Python development or this codebase so thinking it would probs be quicker for me to just re-write this as a little Node.js API.

What are your thoughts?

If that's good with you then I'll be sure to expose all the info you need for your site so you can piggy back on my API like I have been on yours. Or if you'd rather keep the heavy lifting on your end then I'm totally good with that but do you think this something you could look at working on yourself?

If you take this on I'm happy to send you a BTC tip for your efforts.

Cheers, Luke ✌️

@szmarczak
Copy link
Contributor

@lukechilds The API has changed. V1 no longer works.

doesn't work: https://api.nicehash.com/api?method=buy.info (524 cloudflare timeout)
works: https://api2.nicehash.com/main/api/v2/public/buy/info

@ClemensLey
Copy link

I just want to mention that https://www.crypto51.app is an awesome project and it would be very cool if you could get it up an running again.

@lukechilds
Copy link
Contributor Author

@ClemensLey if you have any experience with the NiceHash API we'd welcome some help with #48.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants