Zapata / bitshares-pricefeed

Price Feed Script for BitShares
MIT License
10 stars 19 forks source link

Fix RobinHood #7

Open Zapata opened 5 years ago

Zapata commented 5 years ago
____________________________________________________ test_robinhood_equities_fetch ____________________________________________________

checkers = <class 'conftest.Checkers'>

    def test_robinhood_equities_fetch(checkers):
        source = RobinHood(equities=['F:USD', 'BABA:USD'], aliases={'F':'FORDCOM', 'BABA':'ALIBABACOM'})
        feed = source.fetch()
>       checkers.check_feed(feed, ['FORDCOM:USD', 'ALIBABACOM:USD'], noVolume=True)

tests/sources/test_robinhood.py:6: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

feed = {}, pairs = ['FORDCOM:USD', 'ALIBABACOM:USD'], kargs = {'noVolume': True}, pair = 'FORDCOM:USD', quote = 'FORDCOM', base = 'USD'
@py_assert1 = False, @py_format3 = "'USD' in {}", @py_format5 = "assert 'USD' in {}"

    @staticmethod
    def check_feed(feed, pairs, **kargs):
        print(feed)
        for pair in pairs:
            (quote, base) = pair.split(':')
>           assert base in feed
E           AssertionError: assert 'USD' in {}

tests/sources/conftest.py:9: AssertionError
-------------------------------------------------------- Captured stdout call ---------------------------------------------------------

RobinHood encountered an error while loading live data.
{}
-------------------------------------------------------- Captured stderr call ---------------------------------------------------------
Traceback (most recent call last):
  File "/home/zapata/Projects/bitshares/bitshares-pricefeed/wrappers_env/lib/python3.6/site-packages/bitshares_pricefeed-0.0.10-py3.6.egg/bitshares_pricefeed/sources/main.py", line 65, in fetch
    feed = self._fetch() # pylint: disable=no-member
  File "/home/zapata/Projects/bitshares/bitshares-pricefeed/wrappers_env/lib/python3.6/site-packages/bitshares_pricefeed-0.0.10-py3.6.egg/bitshares_pricefeed/sources/robinhood.py", line 23, in _fetch
    result = response.json()['results']
  File "/home/zapata/Projects/bitshares/bitshares-pricefeed/wrappers_env/lib/python3.6/site-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/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)
Zapata commented 5 years ago

Robinhood API now need a Robinhood account, that need a full KYC and to be an US citizen.