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

Резултати

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

Пребарај: #onchainanalysis

当前筛选 #onchainanalysis清除筛选
Crypto M - Crypto News

@CryptoM · Post #64550 · 09.04.2026 г., 07:24

🚀 Avalanche Team Deposits Significant AVAX Tokens to CEX On April 9, it was reported that the Avalanche team has deposited approximately $180 million worth of AVAX tokens to a centralized exchange (CEX) over the past six months. According to BlockBeats On-chain Detection, this amount represents about 1.88% of the total circulating supply of AVAX tokens. Currently, this percentage of the circulating supply is valued at around $73 million. #Avalanche#AVAX#CEX#CryptoNews#Blockchain#TokenDeposit#Cryptocurrency#OnChainAnalysis

Crypto M - Crypto News

@CryptoM · Post #64827 · 10.04.2026 г., 02:45

🚀 Significant RAVE Token Movement Detected Amid Price Surge On April 10, two addresses suspected to belong to the same entity transferred 18.58 million RAVE tokens to a centralized exchange (CEX) 10 hours prior to a significant price increase. According to BlockBeats On-chain Detection, this transaction occurred when the token's price was $0.43, totaling $8 million. The current value of these tokens has risen to $19.08 million. The funds for these transactions originated from two sources: a withdrawal from the CEX and the RAVE token deployment address. #RAVE#Cryptocurrency#TokenTransfer#PriceSurge#OnChainAnalysis#Blockchain#CEX#CryptoTrading

Crypto M - Crypto News

@CryptoM · Post #64852 · 10.04.2026 г., 04:23

🚀 ZEC Experiences Significant Price Surge Amid Whale Activity ZEC has seen a notable price increase since April 8, according to Hyperliquid data. The cryptocurrency accelerated from approximately $269, achieving a 43.1% rise over two days. As of today, the price peaked at $385 and is currently reported at $367.5, marking a 24-hour increase of 15.7%. According to BlockBeats On-chain Detection, during this surge, whales who shorted before April 8 have incurred significant losses. Among the whales opening new million-dollar positions today, most are following the upward trend, with only one address, 0x931, taking a contrary short position. This short position was opened with a 10x leverage, amounting to $3.44 million at an average price of $365.8, with a liquidation price of $411.5. Additionally, the address has set take-profit and stop-loss orders at $350 and $411, respectively. #ZEC#Cryptocurrency#PriceSurge#WhaleActivity#Blockchain#CryptoTrading#OnChainAnalysis#LeverageTrading

Crypto M - Crypto News

@CryptoM · Post #64661 · 09.04.2026 г., 13:04

🚀 Bitcoin's Current Volatility May Present a Generational Buying Opportunity Cryptocurrency analyst Ali Martinez recently shared an analysis on the X platform, suggesting that instead of debating whether Bitcoin has hit its bottom, attention should be focused on whether the current volatility presents a 'generational buying opportunity.' According to Odaily, Martinez identifies key 'value zones' for the current cycle based on long-term trend lines, on-chain liquidity, and cost distribution indicators. The UTXO Realized Price Distribution (URPD) indicates a significant concentration of holdings between $63,111 and $70,685, forming the primary support band. If Bitcoin falls below $63,111, the market may enter a liquidity vacuum. From a long-term perspective, Bitcoin is nearing a critical ascending trend line from the past decade, approximately between $56,000 and $60,000. Historically, this position has often marked the accumulation phase before significant price increases. In more extreme scenarios, the CVDD indicator suggests a structural bottom around $47,960, while the MVRV 0.8 range at approximately $43,647 indicates a market in an 'extreme pain' phase, typically associated with exhaustion of selling pressure. In the event of a black swan event, prices could briefly dip to an extreme range of around $36,657. Based on these zones, Martinez employs a dollar-cost averaging (DCA) strategy, gradually increasing positions across different support bands to reduce overall holding costs. He believes the market is currently in a phase of low sentiment, but potential opportunities are gradually emerging. #Bitcoin#Cryptocurrency#CryptoTrading#MarketAnalysis#Volatility#InvestmentOpportunity#DCA#OnChainAnalysis#CryptoMarket#TradingStrategy#BTC

Venture Village Wall 🦄

@venturevillagewall · Post #4216 · 22.02.2025 г., 10:00

Bybit Hack Linked to Lazarus Group A recent analysis suggests the Bybit hack, involving ~$1.5 billion, may have been conducted by the North Korean Lazarus Group. Arkham Intelligence reports that the group likely converts ERC-20 tokens to ETH, then to BTC, possibly funding nuclear programs. Research also points to potential links with a previous attack on Phemex. Investigators note that funds were moved to wallet 0x33d0...8F65 during the laundering process. Read more: Forklog #Bybit#LazarusGroup#CyberSecurity#Blockchain#Crypto#Hacking#NorthKorea#Financing#CryptoCrime#DeFi#Ethereum#Bitcoin#ERC20#Phemex#FundsLaundering#OnChainAnalysis#ArkhamIntelligence#ZachXBT#AI#VC