Три способа выполнить множество задач с asyncio
Функция для примера:
async def do_it(n):
await asyncio.sleep(random.uniform(0.5, 1))
return n
1. Последовательный вызов
async def main():
for i in range(100):
result = await do_it(i)
Такой вызов имеет смысл только тогда, когда результат одной задачи требуется для вызова следующей.
Если они независимы, то это антипаттерн, так как аналогичен простому синхронному вызову по очереди.
2. Упорядоченный результат
async def main():
tasks = [do_it(i) for i in range(100)]
results = await asyncio.gather(*tasks)
Выполняет корутины конкурентно и возвращает результат в виде списка.
Полезен когда требуется получить результаты в том же порядке в котором задачи отправлены.
3. Результат по мере готовности
tasks = [asyncio.create_task(do_it(i)) for i in range(100)]
for cor in asyncio.as_completed(tasks):
result = await cor
Так же выполняет корутины конкурентно, но не гарантирует порядок. Результат возвращается по мере готовности, каждый отдельно.
Полезен когда нужно обработать любой ответ как можно скорее.
#async
🚨NASDAQ Tokenization is here.
The SEC just approved NASDAQ’s move to 24/7 trading with T+0 settlement for major indices. It’s no longer a crypto experiment – this is institutional-grade, on-chain access to the US stock market.
S&P Dow Jones Indices just licensed data for perpetual futures on Hyperliquid, bypassing traditional brokers.
This isn’t niche. It’s the future of trading. Don't get left behind.
👇Watch the breakdown now:
🔗https://www.youtube.com/watch?v=qMNRqfVgqPE
#NASDAQTokenization#CryptoFinance#Blockchain
🚀 Orderly Network Announces Management Transition for OmniVault
Orderly Network has announced that Vovega will take over management responsibilities for OmniVault from Kronos. According to Foresight News, the transition will maintain the current management authorization and style, continuing to operate under a fully hedged strategy framework. The focus will remain on minimizing net exposure and drawdowns, aiming to provide depositors with more stable returns.
The transition is scheduled for April 12, with a temporary suspension of deposits and withdrawals at 13:00, resumption at 16:00, and formal completion at 17:00.
#OrderlyNetwork#OmniVault#ManagementTransition#HedgingStrategy#CryptoFinance#StableReturns
🚀 Tokenized RWA Market Expected to Reach $400 Billion by 2030
The distributed tokenized real-world asset (RWA) market is projected to expand significantly, growing from approximately $29 billion today to $400 billion by 2030. According to NS3.AI, a report by Keyrock and Securitize highlights this anticipated growth, noting that RWA perpetual futures volumes have increased 40 times over six months, reaching $67 billion in monthly volume. Additionally, the report indicates that tokenized Treasury bills offered higher returns than DeFi's benchmark stablecoin lending rate on 98% of days in the first quarter of 2026.
#TokenizedAssets#RWA#DeFi#Blockchain#FinancialMarkets#TreasuryBills#DigitalFinance#CryptoFinance#InvestmentTrends#FinTech