比较两个命令列表中的字符串:python-binance
Python -Binance-找到具有USDT和BUSD市场的货币。
我想使我的代码比较USDT和BUSD市场书籍,并且只有两个市场中的回报货币。
search_busd/search_usdt函数返回字典列表。
'''
[{'symbol': 'BNBBUSD', 'bidPrice': '213.00000000', 'bidQty': '111.38000000', 'askPrice': '213.10000000', 'askQty': '65.38800000'}, .......
'''
market_book = client.get_orderbook_tickers()
def search_USDT(market_book):
return [element for element in market_book if element['symbol'].endswith('USDT')]
def search_BUSD(market_book):
return [element for element in market_book if element['symbol'].endswith('BUSD')]
for element in search_USDT(market_book):
print(element['symbol'], element['symbol'][:-4])
Python-binance - find currencies that have both USDT and BUSD markets.
I want to make my code compare the USDT and BUSD market books and only return currencies that are in both markets.
The search_BUSD/search_USDT functions return a list of dictionaries.
'''
[{'symbol': 'BNBBUSD', 'bidPrice': '213.00000000', 'bidQty': '111.38000000', 'askPrice': '213.10000000', 'askQty': '65.38800000'}, .......
'''
market_book = client.get_orderbook_tickers()
def search_USDT(market_book):
return [element for element in market_book if element['symbol'].endswith('USDT')]
def search_BUSD(market_book):
return [element for element in market_book if element['symbol'].endswith('BUSD')]
for element in search_USDT(market_book):
print(element['symbol'], element['symbol'][:-4])
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试以下操作:
Try this: