S
S
Sem_ua2015-02-22 00:50:00
API
Sem_ua, 2015-02-22 00:50:00

How to create an algorithm for all possible operations between the shaft. couples?

Given:
World currencies (fiat): 5 pcs.
Crypto-currency (crypt): 5 pcs.
There are 22 currency pairs on the exchange:
BTC/USD
BTC/EUR
BTC/RUR
BTC/CNH
BTC/GBP
LTC/BTC
LTC/USD
LTC/RUR
LTC/EUR
LTC/CNH
LTC/GBP
NMC/BTC
NMC/USD
NVC/BTC
NVC/USD
USD/RUR
EUR/USD
EUR/RUR
USD/CNH
GBP/USD
PPC/BTC
PPC/USD
Of which with fiat: 23 pairs
with crypto: 21 pairs
Actually the question. How to calculate all possible interaction options? This refers to intra-exchange arbitrage trading from 3 currency pairs and up to 5, say. Is it possible to write some algorithm

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Deerenaros, 2015-02-22
@Deerenaros

It is also the currency in Africa. Crypto or not, it doesn't matter. We just take everyone in a bunch and form combinations of ce from n to k.
Actually, exhaustive enumeration is needed .
Although specifically in this case, two cycles may be enough:

currencies = ["usd", "btc", "rub", "gbp"]

while len(currencies) > 0:
    a = currencies[0]
    for b in currencies:
        if a != b:
            print "%s / %s" % (a, b)
    currencies = currencies[1:]

S
Spetros, 2015-02-22
@Spetros

How to calculate all possible interaction options?

A couple of cycles - one nested within the other.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question