Add sentiment_engine with CryptoSentimentCalibrator fixes - improved keyword lists, lowered FinBERT threshold, added neutral handling
This commit is contained in:
57
sentiment_engine/run_labeling.py
Normal file
57
sentiment_engine/run_labeling.py
Normal file
@@ -0,0 +1,57 @@
|
||||
import asyncio
|
||||
import json
|
||||
import sys
|
||||
sys.path.insert(0, 'src')
|
||||
|
||||
from labeling_pipeline import LabelingPipelineRunner
|
||||
|
||||
async def main():
|
||||
runner = LabelingPipelineRunner()
|
||||
|
||||
real_events = [
|
||||
{'text': 'Bitcoin hits new all-time high of $108,000 as institutional inflows surge. BlackRock IBIT ETF sees record $1.2B daily inflow.', 'source_id': 'bloomberg', 'source_type': 'news', 'credibility': 0.95},
|
||||
{'text': 'Ethereum Dencun upgrade goes live on mainnet. Proto-Danksharding (EIP-4844) activates, reducing L2 transaction fees by 90%.', 'source_id': 'ethereum_foundation', 'source_type': 'news', 'credibility': 0.98},
|
||||
{'text': 'SEC approves spot Bitcoin ETFs for 11 issuers including BlackRock, Fidelity, ARK. Trading begins Thursday.', 'source_id': 'sec_gov', 'source_type': 'news', 'credibility': 1.0},
|
||||
{'text': 'Major hack: Radiant Capital loses $50M in exploit. Attacker exploits rounding error in lending market. Funds moved to Tornado Cash.', 'source_id': 'peckshield', 'source_type': 'news', 'credibility': 0.95},
|
||||
{'text': 'Binance delists Monero (XMR), Zcash (ZEC), and 4 other privacy coins. Cites regulatory compliance review.', 'source_id': 'binance', 'source_type': 'news', 'credibility': 0.9},
|
||||
{'text': 'MicroStrategy buys additional 12,000 BTC at $61M. Total holdings now 190,000 BTC. Stock MSTR up 15% premarket.', 'source_id': 'microstrategy', 'source_type': 'news', 'credibility': 0.95},
|
||||
{'text': 'Solana network experiences 5-hour outage. Validators restart cluster. SOL drops 8% on news.', 'source_id': 'solana_foundation', 'source_type': 'news', 'credibility': 0.9},
|
||||
{'text': 'SEC sues Kraken for operating unregistered securities exchange. Alleged commingling of customer funds.', 'source_id': 'sec_gov', 'source_type': 'news', 'credibility': 1.0},
|
||||
{'text': 'Circle USDC depegs to $0.97 after SVB exposure revealed. $3.3B reserves stuck at SVB. Arbitrage bots profit.', 'source_id': 'circle', 'source_type': 'news', 'credibility': 0.95},
|
||||
{'text': 'Bitcoin ETF inflows hit record $2.1B in single week. IBIT alone sees $1.2B. Cumulative AUM passes $50B.', 'source_id': 'bloomberg', 'source_type': 'news', 'credibility': 0.9},
|
||||
{'text': 'Arbitrum DAO approves $200M ARB grant program for gaming ecosystem. Voting passes with 92% approval.', 'source_id': 'arbitrum_dao', 'source_type': 'news', 'credibility': 0.85},
|
||||
{'text': 'EigenLayer restaking TVL hits $20B. ETH restaking becomes largest DeFi category. Points season 2 announced.', 'source_id': 'eigenlayer', 'source_type': 'news', 'credibility': 0.85},
|
||||
{'text': 'Curve Finance hit by $50M exploit. Vyper compiler bug affects multiple pools. CRV drops 20%.', 'source_id': 'peckshield', 'source_type': 'news', 'credibility': 0.95},
|
||||
{'text': 'Coinbase lists Pepe (PEPE) and Bonk (BONK) memecoins. Trading opens with 100x volume spike.', 'source_id': 'coinbase', 'source_type': 'news', 'credibility': 0.85},
|
||||
{'text': 'SEC charges Uniswap Labs with operating unregistered securities exchange. UNI drops 15%.', 'source_id': 'sec_gov', 'source_type': 'news', 'credibility': 1.0},
|
||||
{'text': 'Bitcoin hits $100,000 for first time ever. MicroStrategy, ETFs, and sovereign buying drive rally.', 'source_id': 'coindesk', 'source_type': 'news', 'credibility': 0.95},
|
||||
{'text': 'Hyperliquid DEX launches HYPE token airdrop. $1.2B TVL locked. Points program drives volume.', 'source_id': 'hyperliquid', 'source_type': 'news', 'credibility': 0.85},
|
||||
{'text': 'Pump.fun revenue hits $100M in 30 days. Memecoin factory launches 50k tokens/day. SOL fees surge.', 'source_id': 'pumpfun', 'source_type': 'news', 'credibility': 0.85},
|
||||
{'text': 'dYdX chain migration to Cosmos complete. V4 mainnet launches with 0.02s block times. DYDX token migration.', 'source_id': 'dydx', 'source_type': 'news', 'credibility': 0.85},
|
||||
{'text': 'Wintermute market maker loses $20M in exploit. Private key compromise suspected. Funds returned.', 'source_id': 'wintermute', 'source_type': 'news', 'credibility': 0.9},
|
||||
{'text': 'OKX delists USDT trading pairs in EEA region. MiCA compliance cited. USDT/USD pairs remain.', 'source_id': 'okx', 'source_type': 'news', 'credibility': 0.9},
|
||||
{'text': 'Ethereum Pectra upgrade activated. EIP-7702 account abstraction live. EOAs can now batch transactions.', 'source_id': 'ethereum_foundation', 'source_type': 'news', 'credibility': 0.95},
|
||||
]
|
||||
|
||||
samples = []
|
||||
for i, event in enumerate(real_events):
|
||||
samples.append({
|
||||
'id': f'label_{i+1:02d}',
|
||||
'raw_text': event['text'],
|
||||
'source_id': event['source_id'],
|
||||
'source_type': event['source_type'],
|
||||
'credibility': event['credibility']
|
||||
})
|
||||
|
||||
with open('data/to_label_verified.jsonl', 'w') as f:
|
||||
for s in samples:
|
||||
f.write(json.dumps(s) + '\n')
|
||||
|
||||
results = await runner.run_on_dataset('data/to_label_verified.jsonl', 'data/labeled_verified.jsonl')
|
||||
|
||||
print(f'Labeled {len(results)} samples')
|
||||
for r in results:
|
||||
print(f" {r['labels']['sentiment']} | {r['labels']['event_type']} | verified={r['verified']} conf={r['confidence']['verification']:.2f}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user