Отдельно разберём TaskGroup, который пришел на замену gather в Python 3.11.
Ключевые отличия
▫️create_task() возвращает объект asyncio.Task, у которого есть соответствюущие методы управления. То есть у нас больше контроля
▫️это контекстный менеджер, который гарантирует что все таски будут остановлены по выходу из контекста
▫️ошибка автоматически отменяет незавершенные задачи,
▫️except* передает нам ExceptionGroup, в котором каждую ошибку можно обработать отдельно
import asyncio
import random
async def do_it() -> str:
if random.random() < 0.1:
raise ValueError('Oops')
delay = random.uniform(0.5, 1.5)
await asyncio.sleep(delay)
return delay
async def main():
try:
async with asyncio.TaskGroup() as tg:
for _ in range(10):
tasks.append(tg.create_task(do_it()))
for t in tasks:
print(t.result())
except *ValueError as e:
for err in e.exceptions:
print(err)
asyncio.run(main())
Рекомендую изучить страницу Coroutines and Tasks из документации, где представлено больше интересных примеров и механизмов
- таймауты
- отмена задач
- создание задач из другого потока
#async
SEC Accepts Grayscale's DOGE ETF Application
The U.S. SEC has accepted Grayscale and NYSE's 19b-4 application for a DOGE ETF. This marks a significant step in the integration of Dogecoin into mainstream finance. Read more.
In other news, GameStop is considering an investment in Bitcoin and other cryptocurrencies while evaluating alignment with its business strategy. More details can be found here.
Coinbase reports over a 130% revenue surge, reaching $2.3 billion for Q4, exceeding expectations. Full report reveals strong market performance.
Additionally, Frodobots successfully raised $6M for a Solana-based robotics network. Learn more.
#DOGE#ETF#GameStop#Bitcoin#Crypto#Coinbase#Revenue#Solana#DeFi#AI # VC
Bitcoin and Ethereum ETF Trends
BTC ETF saw $157M outflow; ETH ETF gained $13M inflow. In 24 hours, 94K traders liquidated, totaling $169M, with the largest being $1.3M on Bybit for BTC/USDT. Notably, 4,135 #BTC ($399.8M) moved from #Coincheck to an unknown wallet. Gamestop plans to invest $4.6B in Bitcoin, raising its stock prices. Meanwhile, 1723HK shares surged 631% this year, naming new directors with Bitcoin ecosystem expertise.
#BTC#ETH#ETF#Crypto#Gamestop#Coincheck#WhaleAlert#HongKong#Investment#StockMarket#Trading#Liquidation#MarketTrends#Blockchain#Finance#Innovation#Directors#Performance#News#AI#VC
ETH Deposits Surge on Bybit
Aave's ETH supply surpassed 2M for the first time. Mirana Ventures deposited $600M worth of ETH into Bybit, becoming the largest depositor since the hack. The firm sold $500M in Bitcoin and $100M in USDT to fund this. In addition, $130M in USDT transferred to Tether Treasury. Significant BTC movements reported as well. Full details in the links: Arkham, The Block, Whale Alert USDT Transfer.
#ETH#Aave#Bybit#Crypto#USDT#BTC#MiranaVentures#DeFi#Arkham#Treasury#GameStop#SEC#Uniswap#AlgorithmicTrading#Blockchain#Investments#Bitcoin#WhaleAlert#Fintech#VC
Roaring Kitty Hints at Comeback
🐦 Roaring Kitty, a key figure in the GameStop stock surge, teases a return. His recent tweet features a video, sparking nostalgia and speculation about upcoming moves. Kitty symbolizes retail investor resistance against Wall Street, igniting the meme stock revolution in 2021.
🔗Roaring Kitty's tweet
🔗 Whale Alert: $102M in #BTC transferred Details here
🔗 Bithumb launches new ARDR & QKC trading Read more
#GameStop#RoaringKitty#memeStocks#BTC#Crypto#VC#RetailInvestors#WhaleAlert#SouthKorea#Trading#Bithumb#ARDR#QKC#Investing#MarketNews#Finance#Nostalgia#Tease#Speculation