diff --git a/bitshares_pricefeed/sources/graphene.py b/bitshares_pricefeed/sources/graphene.py index d54a175..e47aa78 100644 --- a/bitshares_pricefeed/sources/graphene.py +++ b/bitshares_pricefeed/sources/graphene.py @@ -10,13 +10,13 @@ def _fetch(self): feed = {} try: for base in self.bases: + feed[base] = {} for quote in self.quotes: if quote == base: continue ticker = Market("%s:%s" % (quote, base)).ticker() if hasattr(self, "quoteNames") and quote in self.quoteNames: quote = self.quoteNames[quote] - feed[base] = {} if (float(ticker["latest"])) > 0 and float(ticker["quoteVolume"]) > 0: feed[base][quote] = {"price": (float(ticker["latest"])), "volume": (float(ticker["quoteVolume"]) * self.scaleVolumeBy)} diff --git a/tests/sources/test_graphene.py b/tests/sources/test_graphene.py new file mode 100644 index 0000000..ebdbb51 --- /dev/null +++ b/tests/sources/test_graphene.py @@ -0,0 +1,8 @@ +from bitshares_pricefeed.sources.graphene import Graphene + +def test_graphene_fetch(checkers): + source = Graphene(quotes=['USD', 'CNY'], bases=['BTS']) + feed = source.fetch() + checkers.check_feed(feed, ['USD:BTS', 'CNY:BTS']) + +