-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #669 from bancorprotocol/revert-662-remove-sei-and…
…-tri-complete Revert "removed Sei and multi_triangle_complete - temporarily"
- Loading branch information
Showing
14 changed files
with
164 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,4 +45,5 @@ | |
"fantom": 5000, | ||
"mantle": 0, | ||
"linea": 0, | ||
"sei": 0, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
fastlane_bot/data/blockchain_data/sei/solidly_v2_event_mappings.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exchange,address |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
cid,strategy_id,last_updated,last_updated_block,descr,pair_name,exchange_name,fee,fee_float,address,anchor,tkn0_address,tkn1_address,tkn0_decimals,tkn1_decimals,exchange_id,tkn0_symbol,tkn1_symbol,timestamp,tkn0_balance,tkn1_balance,liquidity,sqrt_price_q96,tick,tick_spacing,exchange,pool_type,tkn0_weight,tkn1_weight,tkn2_address,tkn2_decimals,tkn2_symbol,tkn2_balance,tkn2_weight,tkn3_address,tkn3_decimals,tkn3_symbol,tkn3_balance,tkn3_weight,tkn4_address,tkn4_decimals,tkn4_symbol,tkn4_balance,tkn4_weight,tkn5_address,tkn5_decimals,tkn5_symbol,tkn5_balance,tkn5_weight,tkn6_address,tkn6_decimals,tkn6_symbol,tkn6_balance,tkn6_weight,tkn7_address,tkn7_decimals,tkn7_symbol,tkn7_balance,tkn7_weight | ||
0x1422169ab760ea6994358267b7d3783e8e7fa55c6a74b365b3fd3d17cbf4c6f1,0,,2354,dragonswap 0x027D2E627209f1cebA52ADc8A5aFE9318459b44B/0x7b75109369ACb528d9fa989E227812a6589712b9,0x027D2E627209f1cebA52ADc8A5aFE9318459b44B/0x7b75109369ACb528d9fa989E227812a6589712b9,dragonswap,0.003,0.003,0x01A34Dfa104F020FEE739268679338169945D5B1,,0x027D2E627209f1cebA52ADc8A5aFE9318459b44B,0x7b75109369ACb528d9fa989E227812a6589712b9,18,18,3,WSEI,DSWAP,0,0,0,,,,,dragonswap,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, | ||
0xbfd9612b2cb8035908dff18c040f64de75999cefd1020b5ce8a2e533c2ecd5dc,0,,2354,dragonswap 0x027D2E627209f1cebA52ADc8A5aFE9318459b44B/0xace5f7Ea93439Af39b46d2748fA1aC19951c8d7C,0x027D2E627209f1cebA52ADc8A5aFE9318459b44B/0xace5f7Ea93439Af39b46d2748fA1aC19951c8d7C,dragonswap,0.003,0.003,0x85CB6BFd781e1f42f4E79Efb6bf1F1fEfE4E9732,,0x027D2E627209f1cebA52ADc8A5aFE9318459b44B,0xace5f7Ea93439Af39b46d2748fA1aC19951c8d7C,18,6,3,WSEI,USDC,0,0,0,,,,,dragonswap,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, | ||
0xe3aead757d877a15316e4896d5c5ab7639adbcba1ff76e3434b4e0af90f6225e,0,,2354,dragonswap 0xace5f7Ea93439Af39b46d2748fA1aC19951c8d7C/0xF983afa393199D6902a1Dd04f8E93465915ffD8B,0xace5f7Ea93439Af39b46d2748fA1aC19951c8d7C/0xF983afa393199D6902a1Dd04f8E93465915ffD8B,dragonswap,0.003,0.003,0x72A788B0A83e18ce1757171321E82c03e4351498,,0xace5f7Ea93439Af39b46d2748fA1aC19951c8d7C,0xF983afa393199D6902a1Dd04f8E93465915ffD8B,6,6,3,USDC,USDT,0,0,0,,,,,dragonswap,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
address,decimals,symbol | ||
0x26841a0A5D958B128209F4ea9a1DD7E61558c330,18,WSEI | ||
0xace5f7Ea93439Af39b46d2748fA1aC19951c8d7C,6,USDC | ||
0x027D2E627209f1cebA52ADc8A5aFE9318459b44B,18,WSEI | ||
0x7b75109369ACb528d9fa989E227812a6589712b9,18,DSWAP | ||
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE,18,SEI | ||
0x9e7A8e558Ce582511f4104465a886b7bEfBC146b,18,JLY | ||
0x57eE725BEeB991c70c53f9642f36755EC6eb2139,18,WSEI | ||
0xF983afa393199D6902a1Dd04f8E93465915ffD8B,6,USDT |
5 changes: 5 additions & 0 deletions
5
fastlane_bot/data/blockchain_data/sei/uniswap_v2_event_mappings.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
exchange,address | ||
dragonswap,0x01A34Dfa104F020FEE739268679338169945D5B1 | ||
dragonswap,0x85CB6BFd781e1f42f4E79Efb6bf1F1fEfE4E9732 | ||
dragonswap,0x38BcEBb9A3fbF05B0Ab7ce9b485c9669578409fE | ||
dragonswap,0x72A788B0A83e18ce1757171321E82c03e4351498 |
1 change: 1 addition & 0 deletions
1
fastlane_bot/data/blockchain_data/sei/uniswap_v3_event_mappings.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exchange,address |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
""" | ||
Defines the Triangular arbitrage finder class | ||
[DOC-TODO-OPTIONAL-longer description in rst format] | ||
--- | ||
(c) Copyright Bprotocol foundation 2023-24. | ||
All rights reserved. | ||
Licensed under MIT. | ||
""" | ||
from typing import List, Any, Tuple, Union | ||
|
||
from fastlane_bot.modes.base_triangle import ArbitrageFinderTriangleBase | ||
from fastlane_bot.tools.cpc import CPCContainer | ||
from fastlane_bot.tools.optimizer import MargPOptimizer | ||
|
||
|
||
class ArbitrageFinderTriangleMultiComplete(ArbitrageFinderTriangleBase): | ||
""" | ||
Triangular arbitrage finder mode | ||
""" | ||
|
||
arb_mode = "multi_triangle_complete" | ||
|
||
def find_arbitrage(self, candidates: List[Any] = None, ops: Tuple = None, best_profit: float = 0, profit_src: float = 0) -> Union[List, Tuple]: | ||
""" | ||
see base.py | ||
""" | ||
|
||
if candidates is None: | ||
candidates = [] | ||
|
||
combos = self.get_comprehensive_triangles(self.flashloan_tokens, self.CCm) | ||
|
||
for src_token, miniverse in combos: | ||
try: | ||
CC_cc = CPCContainer(miniverse) | ||
O = MargPOptimizer(CC_cc) | ||
pstart = self.build_pstart(CC_cc, CC_cc.tokens(), src_token) | ||
r = O.optimize(src_token, params=dict(pstart=pstart)) | ||
trade_instructions_dic = r.trade_instructions(O.TIF_DICTS) | ||
if trade_instructions_dic is None or len(trade_instructions_dic) < 3: | ||
# Failed to converge | ||
continue | ||
trade_instructions_df = r.trade_instructions(O.TIF_DFAGGR) | ||
trade_instructions = r.trade_instructions() | ||
|
||
except Exception as e: | ||
self.ConfigObj.logger.info(f"[triangle multi] {e}") | ||
continue | ||
profit_src = -r.result | ||
|
||
# Get the cids | ||
cids = [ti["cid"] for ti in trade_instructions_dic] | ||
|
||
# Calculate the profit | ||
profit = self.calculate_profit(src_token, profit_src, self.CCm, cids) | ||
if str(profit) == "nan": | ||
self.ConfigObj.logger.debug("profit is nan, skipping") | ||
continue | ||
|
||
# Handle candidates based on conditions | ||
candidates += self.handle_candidates( | ||
best_profit, | ||
profit, | ||
trade_instructions_df, | ||
trade_instructions_dic, | ||
src_token, | ||
trade_instructions, | ||
) | ||
|
||
# Find the best operations | ||
best_profit, ops = self.find_best_operations( | ||
best_profit, | ||
ops, | ||
profit, | ||
trade_instructions_df, | ||
trade_instructions_dic, | ||
src_token, | ||
trade_instructions, | ||
) | ||
|
||
return candidates if self.result == self.AO_CANDIDATES else ops |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters