Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

How to install the dev branch with setuptools? #165

Closed
metaperl opened this issue Jan 30, 2018 · 8 comments
Closed

How to install the dev branch with setuptools? #165

metaperl opened this issue Jan 30, 2018 · 8 comments
Assignees
Labels

Comments

@metaperl
Copy link

I installed BitEx as follows:

git clone https://github.com/Crypto-toolbox/bitex.git
git checkout dev
python3 setup.py install --force

However, the following script:

from bitex import Bittrex
import inspect
print(inspect.getfile(Bittrex))

e = Bittrex(
    key='f4c12autob1pumaa49a5bayern9f',
    secret='9d5bahn3eadidas19a76munich98'
)
#e.load_key('testbitex.key')

t = e.ticker('BTC-OK')

print(e)

print(t)

print (t.formatted)

print (t.formatted.ask)


yields this error transcript:

schemelab@metta:~/prg/tmp$ python testbitex.py 
/home/schemelab/install/miniconda3/lib/python3.6/site-packages/BitEx-2.0.0-py3.6.egg/bitex/interface/bittrex.py
Traceback (most recent call last):
  File "testbitex.py", line 7, in <module>
    secret='9d544b263e634762a019a76d6ff81f98'
  File "/home/schemelab/install/miniconda3/lib/python3.6/site-packages/BitEx-2.0.0-py3.6.egg/bitex/interface/bittrex.py", line 21, in __init__
  File "/home/schemelab/install/miniconda3/lib/python3.6/site-packages/BitEx-2.0.0-py3.6.egg/bitex/interface/rest.py", line 21, in __init__
  File "/home/schemelab/install/miniconda3/lib/python3.6/site-packages/BitEx-2.0.0-py3.6.egg/bitex/interface/base.py", line 27, in __init__
  File "/home/schemelab/install/miniconda3/lib/python3.6/site-packages/BitEx-2.0.0-py3.6.egg/bitex/interface/bittrex.py", line 32, in _get_supported_pairs
  File "/home/schemelab/install/miniconda3/lib/python3.6/site-packages/requests/models.py", line 892, in json
    return complexjson.loads(self.text, **kwargs)
  File "/home/schemelab/install/miniconda3/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/home/schemelab/install/miniconda3/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/schemelab/install/miniconda3/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
schemelab@metta:~/prg/tmp$ 
@deepbrook
Copy link
Collaborator

That's the right way to install it.

However, I just started working through the tests and making the code pass - so many components are bound to not work correctly atm.

In this case, it's likely to be due to the fact that _get_supported_pairs still calls self.pair instead of a direct request. This had lead to some issues in the past and is being removed currently.

I'll fix it today.

@deepbrook deepbrook self-assigned this Jan 31, 2018
@deepbrook deepbrook added the bug label Jan 31, 2018
@deepbrook
Copy link
Collaborator

Unfortunately I can't test this, since the exchange returns a 503.
Can you confirm this wasn't the case for you? If not, that may be the problem. Otherwise I'll have to test once the service is back up.

Relevant tests for bittrex are green, otherwise.

@metaperl
Copy link
Author

Here is what I get this time:

schemelab@metta:~/prg/tmp$ python testbitex.py 
/home/schemelab/install/miniconda3/lib/python3.6/site-packages/BitEx-2.0.0-py3.6.egg/bitex/interface/bittrex.py
Traceback (most recent call last):
  File "testbitex.py", line 7, in <module>
    secret='hohohahaha'
  File "/home/schemelab/install/miniconda3/lib/python3.6/site-packages/BitEx-2.0.0-py3.6.egg/bitex/interface/bittrex.py", line 21, in __init__
  File "/home/schemelab/install/miniconda3/lib/python3.6/site-packages/BitEx-2.0.0-py3.6.egg/bitex/interface/rest.py", line 21, in __init__
  File "/home/schemelab/install/miniconda3/lib/python3.6/site-packages/BitEx-2.0.0-py3.6.egg/bitex/interface/base.py", line 27, in __init__
  File "/home/schemelab/install/miniconda3/lib/python3.6/site-packages/BitEx-2.0.0-py3.6.egg/bitex/interface/bittrex.py", line 32, in _get_supported_pairs
  File "/home/schemelab/install/miniconda3/lib/python3.6/site-packages/requests/models.py", line 892, in json
    return complexjson.loads(self.text, **kwargs)
  File "/home/schemelab/install/miniconda3/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/home/schemelab/install/miniconda3/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/schemelab/install/miniconda3/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
schemelab@metta:~/prg/tmp$ 

@deepbrook
Copy link
Collaborator

I still receive error Code 503. There's no point in doing any debugging if their server is down.

@deepbrook
Copy link
Collaborator

I've tested this on Bitstamp and can now produce this error when using the API class- something's not being returned where it should be. Investigating..

@deepbrook
Copy link
Collaborator

deepbrook commented Jan 31, 2018

Runnig:

from bitex import Bittrex

e = Bittrex()
t = e.ticker('BTC-NEO')

print(e)
print(t)
print (t.request.url)
print (t.formatted.ask)

yields:

/home/nils/anaconda3/bin/python /home/nils/git/tentacle/test.py
/home/nils/anaconda3/lib/python3.5/site-packages/BitEx-2.0.0-py3.5.egg/bitex/api/base.py:54: IncompleteCredentialsWarning: Incomplete Credentials were given - authentication may not work!
<bitex.interface.bittrex.Bittrex object at 0x7f86c18c3080>
<Response [200]>
https://bittrex.com/api//v1.1/public/getmarketsummary?market=BTC-NEO
0.01413509

I've made some changes to the code, but I believe the primary issue was an empty payload. Could you check on your end ?

@metaperl
Copy link
Author

metaperl commented Feb 1, 2018

What is a "payload" ?

This program:

from bitex import Bittrex
import inspect
print(inspect.getfile(Bittrex))

e = Bittrex()


t = e.ticker('BTC-NEO')

print(e)
print(t)
print(t.request.url)
print (t.formatted)
print (t.formatted.ask)

runs just fine now. And it also runs on Binance when you change the constructor from Bittrex to Binance:

schemelab@metta:~/prg/tmp$ python bitexbittrex.py 
/home/schemelab/install/miniconda3/lib/python3.6/site-packages/BitEx-2.0.0-py3.6.egg/bitex/interface/bittrex.py
<bitex.interface.bittrex.Bittrex object at 0x7f8ff4cd6c18>
<Response [200]>
https://bittrex.com/api/v1.1/public/getmarketsummary?market=BTC-NEO
Ticker(bid='0.01375000', ask='0.01381285', high='0.01417719', low='0.01372504', last='0.01375000', volume='71248.17704382', timestamp=datetime.datetime(2018, 2, 1, 10, 13, 22, 550000, tzinfo=<UTC>))
0.01381285
schemelab@metta:~/prg/tmp$ 

@deepbrook
Copy link
Collaborator

I refer to the parameters sent via REST as the payload - but if the code works on your end now, this is of no concern to you.

Cheers for the contribution!

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

No branches or pull requests

2 participants