|
3 | 3 | import octobot_commons.symbols as symbols |
4 | 4 | import octobot_commons.os_util as os_util |
5 | 5 |
|
6 | | -import triangular_arbitrage.detector |
| 6 | +import triangular_arbitrage.detector as detector |
7 | 7 |
|
8 | 8 | if __name__ == "__main__": |
9 | 9 | benchmark = os_util.parse_boolean_environment_var("IS_BENCHMARKING", "False") |
|
14 | 14 | # start arbitrage detection |
15 | 15 | print("Scanning...") |
16 | 16 | exchange_name = "binance" |
17 | | - best_opportunities, best_profit = asyncio.run(triangular_arbitrage.detector.run_detection(exchange_name)) |
| 17 | + best_opportunities, best_profit = asyncio.run(detector.run_detection(exchange_name)) |
18 | 18 | def opportunity_symbol(opportunity): |
19 | 19 | return symbols.parse_symbol(str(opportunity.symbol)) |
20 | 20 |
|
| 21 | + def get_order_side(opportunity: detector.ShortTicker): |
| 22 | + return 'buy' if opportunity.reversed else 'sell' |
| 23 | + |
| 24 | + def get_symbol(opportunity: detector.ShortTicker): |
| 25 | + if opportunity.reversed: |
| 26 | + return str(symbols.Symbol(f"{opportunity.symbol.quote}/{opportunity.symbol.base}")) |
| 27 | + return str(opportunity.symbol) |
| 28 | + |
21 | 29 | # Display arbitrage detection result |
22 | 30 | print("-------------------------------------------") |
23 | | - print(f"[{exchange_name}] Start by selling {str(opportunity_symbol(best_opportunities[0]).base)} to {str(opportunity_symbol(best_opportunities[0]).quote)} then sell {str(opportunity_symbol(best_opportunities[1]).base)} to {str(opportunity_symbol(best_opportunities[1]).quote)} and finally sell {str(opportunity_symbol(best_opportunities[2]).base)} to {str(opportunity_symbol(best_opportunities[2]).quote)} to make a profit of {(best_profit - 1) * 100}%") |
| 31 | + print(f"New {round(best_profit, 4)}% {exchange_name} opportunity:") |
| 32 | + for i in range(3): |
| 33 | + print(f"{i+1}. {get_order_side(best_opportunities[i])} {get_symbol(best_opportunities[i])}") |
24 | 34 | print("-------------------------------------------") |
25 | 35 |
|
26 | 36 | if benchmark: |
|
0 commit comments