You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from gryphon.execution.strategies.base import Strategy
from gryphon.lib import arbitrage as arb
from gryphon.lib.exchange.consts import Consts
class MoneyLtIssue(Strategy):
def __init__(self, db, harness=None, strategy_configuration=None):
self.done = False
super(MoneyLtIssue, self).__init__(db, harness, strategy_configuration)
def tick(self, open_orders):
crosses = arb.detect_crosses_between_many_orderbooks(
[self.harness.bitstamp_eth_eur.get_orderbook(),
self.harness.bitstamp_eth_btc.get_orderbook(),
self.harness.bitstamp_eth_usd.get_orderbook()], ignore_unprofitable=False
)
for cross in crosses:
print(cross)
self.done = True
def is_complete(self):
return self.done
When multiple crosses are detected (hence why I need to pass 3 orderbooks), this happens :
ERROR:gryphon.execution.live_runner:[CurrencyMismatch] unsupported operation between money in 'EUR' and 'USD': '<'. Use XMoney for automatic currency conversion.
Traceback (most recent call last):
File "/opt/Projects/gryphon/gryphon/execution/live_runner.py", line 281, in live_run
harness.tick()
File "harness.pyx", line 161, in gryphon.execution.harness.harness.Harness.tick (/home/alexv/.pyxbld/temp.linux-x86_64-2.7/pyrex/gryphon/execution/harness/harness.c:3195)
File "/opt/Projects/gryphon/gryphon/lib/util/profile.py", line 59, in inner
t, result = timeit.timeit(run_func, number=1)
File "/usr/lib/python2.7/timeit.py", line 237, in timeit
return Timer(stmt, setup, timer).timeit(number)
File "/usr/lib/python2.7/timeit.py", line 202, in timeit
timing = self.inner(it, self.timer)
File "/opt/Projects/gryphon/gryphon/lib/util/monkeypatch_timeit.py", line 14, in inner
retval = _func()
File "/opt/Projects/gryphon/gryphon/lib/util/profile.py", line 57, in run_func
return func(*args, **kwargs)
File "harness.pyx", line 169, in gryphon.execution.harness.harness.Harness.tick_algo (/home/alexv/.pyxbld/temp.linux-x86_64-2.7/pyrex/gryphon/execution/harness/harness.c:3394)
File "money_lt_issue.pyx", line 13, in strategies.money_lt_issue.MoneyLtIssue.tick (/home/alexv/.pyxbld/temp.linux-x86_64-2.7/pyrex/strategies/money_lt_issue.c:1228)
File "/opt/Projects/gryphon/gryphon/lib/arbitrage.py", line 234, in detect_crosses_between_many_orderbooks
crosses = sorted(crosses, key=lambda c: c.profit, reverse=True)
File "/home/alexv/.virtualenvs/gryphon2/local/lib/python2.7/site-packages/money/money.py", line 54, in __lt__
raise CurrencyMismatch(self.currency, other.currency, '<')
CurrencyMismatch: unsupported operation between money in 'EUR' and 'USD': '<'. Use XMoney for automatic currency conversion.
The text was updated successfully, but these errors were encountered:
Interesting, I do see the issue, when you have multiple crosses with different 'base' price currencies their profitability is recorded in different currencies, and the sort function on them fails. Should be an easy fix, I'll take a close look early next week if no one else gets to it before then. We should add some unit tests to tests/logic/libraries/arbitrage_test.py to catch this scenario in the future as well.
I am running this strategy :
When multiple crosses are detected (hence why I need to pass 3 orderbooks), this happens :
The text was updated successfully, but these errors were encountered: