Skip to content

Commit

Permalink
Test Graphene source and fix issue when multiple quotes are provided.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zapata committed Jun 7, 2018
1 parent 75fa388 commit 33027ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bitshares_pricefeed/sources/graphene.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
Expand Down
8 changes: 8 additions & 0 deletions tests/sources/test_graphene.py
Original file line number Diff line number Diff line change
@@ -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'])


0 comments on commit 33027ca

Please sign in to comment.