Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix keyerror for y_0 #694

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions fastlane_bot/events/managers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,8 @@ def get_strats_by_state(self, pairs: List[List[Any]], exchange_name: str) -> Lis
pool["cid"]
for pool in self.pool_data
if pool["exchange_name"] == exchange_name
and (pool["tkn0_address"], pool["tkn1_address"]) in pairs
or (pool["tkn1_address"], pool["tkn0_address"]) in pairs
and ((pool["tkn0_address"], pool["tkn1_address"]) in pairs
or (pool["tkn1_address"], pool["tkn0_address"]) in pairs)
]
strategies = []
for cid in cids:
Expand All @@ -597,7 +597,7 @@ def get_strats_by_state(self, pairs: List[List[Any]], exchange_name: str) -> Lis
]

# Fetching token addresses and converting them
tkn0_address, tkn1_address = pool_data["tkn0"], pool_data["tkn1"]
tkn0_address, tkn1_address = pool_data["tkn0_address"], pool_data["tkn1_address"]

# Reconstructing the strategy object
strategy = [strategy_id, None, [tkn0_address, tkn1_address], [order0, order1]]
Expand Down
17 changes: 17 additions & 0 deletions fastlane_bot/events/managers/contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,19 @@ def get_token_info_from_contract(
tokens_filepath = os.path.normpath(
f"fastlane_bot/data/blockchain_data/{self.cfg.NETWORK}/tokens.csv"
)

self.log_path_exists("fastlane_bot")
self.log_path_exists("fastlane_bot/data")
self.log_path_exists("fastlane_bot/data/blockchain_data")
self.log_path_exists(f"fastlane_bot/data/blockchain_data/{self.cfg.NETWORK}")
self.log_path_exists(f"fastlane_bot/data/blockchain_data/{self.cfg.NETWORK}/tokens.csv")
self.log_path_exists(self.prefix_path)
self.log_path_exists(f"{self.prefix_path}fastlane_bot")
self.log_path_exists(f"{self.prefix_path}fastlane_bot/data")
self.log_path_exists(f"{self.prefix_path}fastlane_bot/data/blockchain_data")
self.log_path_exists(f"{self.prefix_path}fastlane_bot/data/blockchain_data/{self.cfg.NETWORK}")
self.log_path_exists(f"{self.prefix_path}fastlane_bot/data/blockchain_data/{self.cfg.NETWORK}/token_detail")

token_data = pd.read_csv(tokens_filepath)
extra_info = glob(
os.path.normpath(
Expand Down Expand Up @@ -367,6 +380,10 @@ def __init__(self, addr):
def __str__(self):
return self.message

def log_path_exists(self, path):
exists = os.path.exists(os.path.normpath(path))
self.cfg.logger.info(f"Filepath: {path}. Exists: {exists}")

def _get_and_save_token_info_from_contract(
self,
contract: Contract,
Expand Down
Loading