def find_routes(primaries, currencies, pairs):
"""
Find all permutations of trade routes for pairs
"""
discovered = []
for c in currencies:
for p in permutations(c, 3):
# We want to end with the beginning currency
p = p + (p[0],)
if not p in discovered and \
has_two_primary(primaries, p) and \
valid_pairs(pairs, p):
discovered.append(p)
yield p
评论列表
文章目录