"inverted": False,
"average": (ticker["bid"] + ticker["ask"] ) / 2,
})
+ return ticker
tickers = self.get_tickers()
if tickers is None:
try:
- ticker = self.ccxt.fetch_ticker("{}/{}".format(c1, c2))
- augment_ticker(ticker)
+ ticker = augment_ticker(self.ccxt.fetch_ticker("{}/{}".format(c1, c2)))
except ExchangeError:
try:
- ticker = invert(self.ccxt.fetch_ticker("{}/{}".format(c2, c1)))
+ ticker = invert(augment_ticker(self.ccxt.fetch_ticker("{}/{}".format(c2, c1))))
except ExchangeError:
ticker = None
else:
if "{}/{}".format(c1, c2) in tickers:
- ticker = tickers["{}/{}".format(c1, c2)]
- augment_ticker(ticker)
+ ticker = augment_ticker(tickers["{}/{}".format(c1, c2)])
elif "{}/{}".format(c2, c1) in tickers:
- ticker = invert(tickers["{}/{}".format(c2, c1)])
+ ticker = invert(augment_ticker(tickers["{}/{}".format(c2, c1)]))
else:
ticker = None
return ticker
self.assertTrue(ticker["inverted"])
self.assertIn("original", ticker)
self.assertEqual(10, ticker["original"]["bid"])
+ self.assertEqual(25, ticker["original"]["average"])
ticker = m.get_ticker("XVG", "XMR")
self.assertIsNone(ticker)
self.assertTrue(ticker["inverted"])
self.assertIn("original", ticker)
self.assertEqual(10, ticker["original"]["bid"])
+ self.assertEqual(25, ticker["original"]["average"])
ticker = m.get_ticker("XVG", "XMR")
self.assertIsNone(ticker)