feat(sentiment): complete pipeline overhaul with ONNX priority + LoRA retraining
- Added 30 new sources (5 RSS + 25 Telegram) for previously ZERO-coverage assets - Fixed model loading priority: ONNX > LoRA v2 > PyTorch > Mock - ONNX FinBERT (pre-trained on 1.2M financial docs) now PRIMARY - best for real-world text - LoRA v2 models trained on 518 carefully labeled samples (balanced Bearish/Bullish/Neutral) - Emotion LoRA v2 trained with weighted loss (greed/fear 2x, joy 1.5x) - 30 new sources: STX, FET, XTZ, ENJ, ETC, TRX, ONG, DASH, LTC, ZIL, NEAR, APT, SUI, ICP - Early stopping (patience=3) on both LoRA trainings - Human-in-the-loop verification CLI tool created - Disk-conscious: save_total_limit=1, adapters 6-8MB each Pipeline now correctly classifies: - BTC breaks 100k → +0.54 Bullish ✅ - Major hack → -0.23 Bearish ✅ - HODL → +0.91 Bullish ✅ - Rug pull → -0.30 Bearish ✅ - SEC sues → -0.30 Bearish ✅ - ETF approval → +0.32 Bullish ✅ - Whale accumulation → +0.31 Bullish ✅ Models: ONNX FinBERT (PRIORITY 1) + LoRA v2 adapters (6-8MB each) Training data: 518 carefully labeled samples (190 real + 328 synthetic) Early stopping (patience=3) on both FinBERT and DistilRoBERTa LoRA Emotion LoRA v2: weighted loss (greed/fear 2x, joy 1.5x) + early stopping
This commit is contained in:
257
sentiment_engine/config/settings.yaml
Normal file
257
sentiment_engine/config/settings.yaml
Normal file
@@ -0,0 +1,257 @@
|
||||
# Sentiment Engine Configuration v2.0.0
|
||||
|
||||
# =============================================================================
|
||||
# NATS JetStream Configuration
|
||||
# =============================================================================
|
||||
nats:
|
||||
servers: ["nats://localhost:4222"]
|
||||
stream_ingestion: "sentiment_ingestion"
|
||||
stream_processed: "sentiment_processed"
|
||||
subjects:
|
||||
news: "sentiment.ingest.news"
|
||||
social: "sentiment.ingest.social"
|
||||
regulatory: "sentiment.ingest.regulatory"
|
||||
exchange: "sentiment.ingest.exchange"
|
||||
consumer_durable: "sentiment-engine"
|
||||
ack_wait_seconds: 30
|
||||
max_deliver: 3
|
||||
|
||||
# =============================================================================
|
||||
# ClickHouse Configuration
|
||||
# =============================================================================
|
||||
clickhouse:
|
||||
host: "localhost"
|
||||
port: 8123
|
||||
database: "dolphin"
|
||||
user: "default"
|
||||
password: "${CLICKHOUSE_PASSWORD}"
|
||||
tables:
|
||||
sentiment_events: "sentiment_events"
|
||||
sentiment_scores: "sentiment_scores"
|
||||
sentiment_raw_items: "sentiment_raw_items"
|
||||
sentiment_otel: "sentiment_otel"
|
||||
|
||||
# =============================================================================
|
||||
# Hazelcast Configuration
|
||||
# =============================================================================
|
||||
hazelcast:
|
||||
cluster_name: "dolphin"
|
||||
cluster_members: ["localhost:5701"]
|
||||
maps:
|
||||
sentiment_scores: "sentiment_scores_*"
|
||||
sentiment_streams: "sentiment_streams"
|
||||
|
||||
# =============================================================================
|
||||
# LatticeDB (Graph Layer) Configuration
|
||||
# =============================================================================
|
||||
latticedb:
|
||||
enabled: true
|
||||
host: "localhost"
|
||||
port: 7878
|
||||
# For source credibility propagation, entity co-occurrence graph
|
||||
|
||||
# =============================================================================
|
||||
# NLP Model Configuration
|
||||
# =============================================================================
|
||||
nlp:
|
||||
models:
|
||||
entity_extraction:
|
||||
model_name: "ProsusAI/finbert"
|
||||
device: "cuda"
|
||||
batch_size: 32
|
||||
max_length: 512
|
||||
sentiment_emotion:
|
||||
model_name: "google/gemma-3-4b"
|
||||
device: "cuda"
|
||||
batch_size: 8
|
||||
max_length: 2048
|
||||
quantization: "4bit"
|
||||
event_classification:
|
||||
model_name: "custom/finbert-event-classifier"
|
||||
device: "cuda"
|
||||
batch_size: 16
|
||||
max_length: 512
|
||||
embeddings:
|
||||
model_name: "intfloat/e5-large-v2"
|
||||
device: "cuda"
|
||||
batch_size: 64
|
||||
max_length: 4096
|
||||
multilingual_embeddings:
|
||||
model_name: "intfloat/multilingual-e5-large"
|
||||
device: "cuda"
|
||||
batch_size: 32
|
||||
language_detection:
|
||||
model: "fasttext"
|
||||
supported_languages: ["en"]
|
||||
translate_non_english: false
|
||||
asset_mapping:
|
||||
ticker_regex: "\\$?[A-Z]{2,10}\\b"
|
||||
contract_address_regex: "0x[a-fA-F0-9]{40}|[1-9A-HJ-NP-Za-km-z]{32,44}"
|
||||
alias_file: "config/asset_aliases.yaml"
|
||||
known_entities_file: "config/known_entities.yaml"
|
||||
|
||||
# =============================================================================
|
||||
# Scoring Engine Configuration
|
||||
# =============================================================================
|
||||
scoring:
|
||||
parameters:
|
||||
fear_state:
|
||||
halflife_minutes: 180
|
||||
confidence_floor: 0.15
|
||||
proximity_boost: 0.5
|
||||
centroid_weight_keywords: 1.0
|
||||
centroid_weight_sentences: 2.0
|
||||
centroid_weight_clusters: 1.5
|
||||
greed_state:
|
||||
halflife_minutes: 180
|
||||
confidence_floor: 0.15
|
||||
proximity_boost: 0.5
|
||||
hype_velocity:
|
||||
halflife_minutes: 60
|
||||
confidence_floor: 0.20
|
||||
proximity_boost: 0.3
|
||||
velocity_window_minutes: 15
|
||||
pub_velocity:
|
||||
halflife_minutes: 120
|
||||
window_minutes: 60
|
||||
min_sources: 3
|
||||
pump_score:
|
||||
halflife_minutes: 240
|
||||
confidence_floor: 0.25
|
||||
multi_source_threshold: 3
|
||||
coordination_window_minutes: 30
|
||||
dump_score:
|
||||
halflife_minutes: 240
|
||||
confidence_floor: 0.25
|
||||
event_flags:
|
||||
halflife_minutes: 480
|
||||
event_types:
|
||||
- "listing"
|
||||
- "delisting"
|
||||
- "hack"
|
||||
- "regulatory"
|
||||
- "governance"
|
||||
- "upgrade"
|
||||
- "partnership"
|
||||
- "earnings"
|
||||
- "macro"
|
||||
- "liquidation"
|
||||
- "whale"
|
||||
- "manipulation"
|
||||
|
||||
aggregation:
|
||||
asset_to_industry_map: "config/asset_industry_map.yaml"
|
||||
industry_weights: "equal" # or "market_cap"
|
||||
market_weights: "equal"
|
||||
decay:
|
||||
asset_halflife_minutes: 30
|
||||
industry_halflife_minutes: 60
|
||||
market_halflife_minutes: 120
|
||||
|
||||
# =============================================================================
|
||||
# Source Credibility Registry
|
||||
# =============================================================================
|
||||
credibility:
|
||||
registry_file: "config/source_credibility.yaml"
|
||||
default_credibility: 0.5
|
||||
decay:
|
||||
half_life_days: 30
|
||||
min_credibility: 0.1
|
||||
feedback_loop:
|
||||
enabled: true
|
||||
lookback_days: 90
|
||||
impact_threshold: 0.02 # 2% price move attributed to event
|
||||
|
||||
# =============================================================================
|
||||
# Source Connector Configuration
|
||||
# =============================================================================
|
||||
connectors:
|
||||
rss:
|
||||
poll_interval_seconds: 120 # 2 minutes
|
||||
max_feeds_per_poll: 500
|
||||
timeout_seconds: 30
|
||||
user_agent: "DOLPHIN-SentimentEngine/2.0"
|
||||
api:
|
||||
poll_interval_seconds: 300 # 5 minutes
|
||||
rate_limit_rpm: 100
|
||||
timeout_seconds: 30
|
||||
twitter:
|
||||
bearer_token: "${TWITTER_BEARER_TOKEN}"
|
||||
api_key: "${TWITTER_API_KEY}"
|
||||
api_secret: "${TWITTER_API_SECRET}"
|
||||
access_token: "${TWITTER_ACCESS_TOKEN}"
|
||||
access_secret: "${TWITTER_ACCESS_SECRET}"
|
||||
stream_rules: ["crypto", "bitcoin", "ethereum", "defi", "web3"]
|
||||
sample_rate: 0.1
|
||||
reddit:
|
||||
client_id: "${REDDIT_CLIENT_ID}"
|
||||
client_secret: "${REDDIT_CLIENT_SECRET}"
|
||||
user_agent: "DOLPHIN-SentimentEngine/2.0"
|
||||
subreddits: ["CryptoCurrency", "Bitcoin", "EthTrader", "CryptoMoon", "SatoshiStreetBets"]
|
||||
poll_interval_seconds: 300
|
||||
use_pushshift: true
|
||||
discord:
|
||||
bot_token: "${DISCORD_BOT_TOKEN}"
|
||||
channels: [] # channel IDs to monitor
|
||||
telegram:
|
||||
bot_token: "${TELEGRAM_BOT_TOKEN}"
|
||||
channels: [] # channel usernames/IDs
|
||||
web_crawl:
|
||||
enabled: true
|
||||
tool: "hister" # or "scrapy"
|
||||
job_timeout_seconds: 3600
|
||||
max_depth: 2
|
||||
allowed_domains: []
|
||||
rate_limit_rps: 1
|
||||
|
||||
# =============================================================================
|
||||
# Prefect Configuration
|
||||
# =============================================================================
|
||||
prefect:
|
||||
api_url: "http://localhost:4200/api"
|
||||
work_pool: "sentiment-engine"
|
||||
deployment_tags: ["sentiment", "production"]
|
||||
flows:
|
||||
rss_ingest:
|
||||
schedule: "*/2 * * * *" # every 2 minutes
|
||||
timeout_seconds: 300
|
||||
api_ingest:
|
||||
schedule: "*/5 * * * *" # every 5 minutes
|
||||
timeout_seconds: 300
|
||||
web_crawl:
|
||||
schedule: "0 */30 * * *" # every 30 minutes
|
||||
timeout_seconds: 7200
|
||||
|
||||
# =============================================================================
|
||||
# Trading Engine Integration
|
||||
# =============================================================================
|
||||
trading_integration:
|
||||
exf_map_key: "exf_latest"
|
||||
acb_keys:
|
||||
- "market_sentiment_state"
|
||||
- "aggregate_pump_risk"
|
||||
- "fear_state"
|
||||
- "greed_state"
|
||||
- "hype_velocity"
|
||||
book_health_gate:
|
||||
pump_score_veto_threshold: 75
|
||||
alpha_exit_v7:
|
||||
dump_score_threshold: 70
|
||||
fear_state_threshold: 80
|
||||
|
||||
# =============================================================================
|
||||
# Observability
|
||||
# =============================================================================
|
||||
observability:
|
||||
otel:
|
||||
endpoint: "http://localhost:4317"
|
||||
service_name: "sentiment-engine"
|
||||
resource_attributes:
|
||||
deployment.environment: "production"
|
||||
prometheus:
|
||||
port: 9090
|
||||
path: "/metrics"
|
||||
logging:
|
||||
level: "INFO"
|
||||
format: "json"
|
||||
output: "stdout"
|
||||
Reference in New Issue
Block a user