TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #397 · 12 ное.

Использование Pydantic сегодня стало нормой, и это правильно. Но иногда на ревью вижу, что используют его не всегда корректно. Например, метод BaseModel.model_dump() по умолчанию не преобразует стандартные типы, такие как datetime, UUID или Decimal, в простой сериализуемый для JSON вид. Тогда пишут кастмоный сериализатор для этих типов чтобы функция json.dump() не падала с ошибкой. import uuid from datetime import datetime from decimal import Decimal from uuid import UUID from pydantic import BaseModel class MyModel(BaseModel): id: UUID date: datetime value: Decimal obj = MyModel( id=uuid.uuid4(), date=datetime.now(), value='1.23' ) print(obj.model_dump()) # не подходит для json.dump # { # 'id': UUID('4f8c1bc4-25fd-40cd-9dbe-2c73639b0dc1'), # 'date': datetime.datetime(2025, 12, 12, 12, 12, 12, 111111), # 'value': Decimal('1.23') # } # добавляем свой кастомный сериализатор json.dumps(obj.model_dump(), cls=MySerializer) # { # 'id': '4f8c1bc4-25fd-40cd-9dbe-2c73639b0dc1', # 'date': '2025-12-12T12:12:12.111111', # 'value': '1.23' # } В данном случае класс MySerializer обрабатывает datetime, UUID и Decimal. Например так: class MySerializer(json.JSONEncoder): def default(self, o): if isinstance(o, Decimal): return str(o) elif isinstance(o, datetime): return o.isoformat() elif isinstance(o, UUID): return str(o) return super().default(o) Специально для тех, кто всё еще так делает - в этом нет необходимости! Pydantic может это сделать сам, просто нужно добавить параметр mode="json". json.dumps(obj.model_dump(mode="json")) # { # 'id': '4f8c1bc4-25fd-40cd-9dbe-2c73639b0dc1', # 'date': '2012-12-12T12:12:12.111111', # 'value': '1.23' # } #pydantic#libs

Резултати

Пронајдени 6 слични објави

Пребарај: #ishares

当前筛选 #ishares清除筛选

Lookonchain | ꘜ Aug 13 Update: 10 #Bitcoin ETFs NetFlow: +917 $BTC(+$111.85M)🟢 #iShares(Blackrock) inflows 931 $BTC(+$113.59M) and currently holds 744,540 $BTC($90.83B). 9 #Ethereum ETFs NetFlow: +124,431 $ETH(+$582.96M)🟢 #iShares(Blackrock) inflows 70,802 $ETH($331.71M) and currently holds 3,270,483 $ETH($15.32B). https://x.com/lookonchain/status/1955298316041982211

Lookonchain | ꘜ Aug 12 Update: 10 #Bitcoin ETFs NetFlow: +1,586 $BTC(+$189.72M)🟢 #iShares(Blackrock) inflows 1,158 $BTC(+$138.58M) and currently holds 743,609 $BTC($88.97B). 9 #Ethereum ETFs NetFlow: +231,717 $ETH(+$1.03B)🟢 #iShares(Blackrock) inflows 149,168 $ETH($663.05M) and currently holds 3,199,681 $ETH($14.22B). https://x.com/lookonchain/status/1954903054597455910

Lookonchain | ꘜ Aug 11 Update: 10 #Bitcoin ETFs NetFlow: +3,308 $BTC(+$396.03M)🟢 #iShares(Blackrock) inflows 3,089 $BTC(+$369.73M) and currently holds 742,451 $BTC($88.88B). 9 #Ethereum ETFs NetFlow: +112,031 $ETH(+$470.76M)🟢 #iShares(Blackrock) inflows 62,936 $ETH($264.46M) and currently holds 3,050,513 $ETH($12.82B). https://x.com/lookonchain/status/1953811766271717410

SIGNAL

@finsignal · Post #3170 · 30.05.2024 г., 03:14

🐂🐂🐂🐂🐂🐂 According to analysts, a BTC-ETF called #iShares Bitcoin Trust from #BlackRock has surpassed #GTC from Grayscale in terms of the number of coins at its core. Accordingly, it is now the largest #BTC spot exchange-traded fund in the United States. Bloomberg analyst Eric Balchunas confirmed the leadership of the #BlackRock iShares Bitcoin Trust (BUT) among spot BTC ETFs. Recall that this exchange-traded fund bypassed Grayscale's GTC based on the trading results for the last day. As Eric noted, BlackRock is likely to occupy the top spot "for decades." The reason is a combination of low fees, serious liquidity and the excellent reputation of the iShares brand. 🐂🐂🐂🐂🐂🐂

Lookonchain | ꘜ Aug 14 Update: 10 #Bitcoin ETFs NetFlow: +452 $BTC(+$53.9M)🟢 #ARK21Shares inflows 299 $BTC(+$35.62M) and currently holds 45,656 $BTC($5.44B). 9 #Ethereum ETFs NetFlow: +154,179 $ETH(+$724.02M)🟢 #iShares(Blackrock) inflows 105,900 $ETH($497.3M) and currently holds 3,376,382 $ETH($15.86B). https://x.com/lookonchain/status/1955636055992049670

Crypto M - Crypto News

@CryptoM · Post #65251 · 12.04.2026 г., 10:15

🚀 Bitcoin ETFs See Strong Inflows as Market Interest Grows US spot Bitcoin ETFs experienced significant net inflows exceeding $786 million last week, marking their most robust performance since February. According to NS3.AI, BlackRock's iShares Bitcoin Trust attracted approximately $612 million. Meanwhile, Morgan Stanley's newly launched MSBT fund garnered around $46 million within its initial three trading days. #Bitcoin#ETFs#BlackRock#MorganStanley#CryptoInvestment#MarketInterest#MSBT#iShares#Inflow#BTC