Closed wukan1986 closed 6 years ago
I have encountered this as well.
This is noted in the docstring of line 35 of bellman_ford.py:
Note: the loop_from_source parameter, when set to True, currently outputs a less than ideal path from source to the beginning of the arbitrage opportunity.
To my knowledge, there exists no graph theory algorithm which would allow return to the source currency after exiting an arbitrage cycle with the entire trading path no more than one iteration over each complete circuit. I have been testing some algorithms to combat this problem; I am currently working on one on my remote branch which requires a complete refactoring of the code.
For the time being, to prevent this issue, do the following:
When calling the bellman_ford
function, as shown in multiple_coins_one_exchange.py, set the parameter loop_from_source
to False
. Like so:
paths = bellman_ford(graph, 'BTC', unique_paths=True, loop_from_source=False)
Also, @wukan1986 and @Sotacan, I apologize for the late response; I had my GitHub notification settings incorrectly configured so I did not see this issue until yesterday.
any update? @wukan1986 @Sotacan any ideal ?
@kkkttts I believe what I was trying to do may be mathematically impossible due to several edge cases. loop_from_source
now defaults to False
. It is recommended that you do not use it.
Hi, Thank you for your work. I test the multiple_coins_one_exchange.py, modify the 'binance' to 'bitstamp'
the output is:
Starting with 100 in BTC
line 2 to 3 is bad path. line 4 to 6 is good path,but it repeat twice. line 7 to 9 same like 4 to 6 line 10 to 12, line 13 to 15 are bad duplicate paths.