где ошибка индекса в коде
import ccxt
import pandas as pd
binance = ccxt.binance()
def df_ticker():
tickers = binance.fetch_tickers()
tickers_df = pd.DataFrame(tickers).T #Изменил строки и столбцы местами
tickers_df.drop(tickers_df.columns[-1], axis= 1 , inplace= True ) #delete colums
tickers_df = tickers_df.loc[tickers_df['low'] != 0.0] # sort columns
tickers_df = tickers_df.loc[tickers_df['quoteVolume'] > 3000] # sort columns
tickers_df.to_csv('ask.csv', index=False)
return tickers_df
market_symbols = df_ticker()['symbol'].tolist() # convert
print(len(market_symbols))
def get_crypto_combinations(market_symbols, base):
combinations = []
for sym1 in market_symbols:
sym1_token1 = sym1.split('/')[0]
sym1_token2 = sym1.split('/')[1]
if (sym1_token2 == base):
for sym2 in market_symbols:
sym2_token1 = sym2.split('/')[0]
sym2_token2 = sym2.split('/')[1]
if (sym1_token1 == sym2_token2):
for sym3 in market_symbols:
sym3_token1 = sym3.split('/')[0]
sym3_token2 = sym3.split('/')[1]
if ((sym2_token1 == sym3_token1) and (sym3_token2 == sym1_token2)):
combination = {
'base': sym1_token2,
'intermediate': sym1_token1,
'ticker': sym2_token1,
}
combinations.append(combination)
return combinations
wx_combinations_usdt = get_crypto_combinations(market_symbols, 'USDT')
print(wx_combinations_usdt)
Ошибка
Traceback (most recent call last):
File "/home/ramis/PycharmProjects/BinTest/ccxtMain.py", line 50, in <module>
wx_combinations_usdt = get_crypto_combinations(market_symbols, 'USDT')
File "/home/ramis/PycharmProjects/BinTest/ccxtMain.py", line 38, in get_crypto_combinations
sym3_token2 = sym3.split('/')[1]
IndexError: list index out of range