NLP សម្រាប់ការវិភាគទីផ្សារ — ការដំណើរការព័ត៌មាន និងអារម្មណ៍សង្គម
ការដំណើរការភាសាធម្មជាតិបានក្លាយជាកត្តាសំខាន់នៅក្នុងការជួញដូរ crypto។ ការប្រកាសព័ត៌មាន អារម្មណ៍សង្គម និងព័ត៌មានច្បាប់ផ្លាស់ប្តូរទីផ្សារមុនពេលសញ្ញានៅលើខ្សែសង្ក្រាន្តបង្ហាញ។ មគ្គុទ្ទេសក៍នេះនឹងណែនាំអ្នកពីការដកយកព័ត៌មានដែលអាចអនុវត្តបានពីអត្ថបទដែលមិនមានរចនាសម្ព័ន្ធ — បច្ចេកទេសដូចគ្នាដែលដំណើរការពិន្ទុអារម្មណ៍នៅក្នុង Smart Money API។
ការយល់ដឹងសំខាន់៖ អារម្មណ៍តែម្យ៉ាងអាចទស្សន៍ទាយតែ 48% នៃការផ្លាស់ប្តូររយៈពេលខ្លី។ ប៉ុន្តែនៅពេលដែលរួមបញ្ចូលជាមួយការយល់ព្រមពីអ្នកជំនាញ និងអត្រាការផ្តល់មូលនិធិ? ការជួញដូរដែលបញ្ជាក់ដោយអារម្មណ៍សម្រេចបានភាពត្រឹមត្រូវ 61%។ នោះជាអានុភាពនៃសញ្ញាពហុរូបភាព។
មូលដ្ឋាននៃការវិភាគអារម្មណ៍
វិធីសាកសព្វពាក្យ ធៀបនឹងវិធីសាកសព្វដោយម៉ាស៊ីនរៀន
វិធីសាកសព្វពាក្យ៖ វចនានុក្រមនៃពាក្យវិជ្ជមាន/វិជ្ជមាន (VADER, TextBlob)។ លឿន អាចបកស្រាយបាន ប៉ុន្តែពិបាកជាមួយការបន្លំ និងបរិបទ។
from nltk.sentiment import SentimentIntensityAnalyzer
analyzer = SentimentIntensityAnalyzer()
texts = [
"Bitcoin surged 15% on bullish institutional adoption news",
"Crash incoming — expect 40% dump based on fundrat neg",
"Mixed signals but whales are accumulating ETH"
]
for text in texts:
scores = analyzer.polarity_scores(text)
print(f"{text[:40]}... → {scores['compound']:.2f}")
លទ្ធផល៖ ពិន្ទុ Compound មានពី -1 (អវិជ្ជមានបំផុត) ដល់ +1 (វិជ្ជមានបំផុត)។ ពិន្ទុ 0.65 បង្ហាញអារម្មណ៍វិជ្ជមាន -0.42 បង្ហាញអារម្មណ៍អវិជ្ជមាន។
វិធីសាកសព្វដោយម៉ាស៊ីនរៀន៖ ហ្វឹកហាត់ឧបករណ៍ចាត់ថ្នាក់ (Naive Bayes, SVM) ឬប្រើឧបករណ៍បំលែងដែលបានហ្វឹកហាត់រួច (BERT, RoBERTa)។ កាន់តែត្រឹមត្រូវ ប៉ុន្តែត្រូវការទិន្នន័យដែលបានសម្គាល់។
ការដំណើរការព័ត៌មាន Cryptocurrency
ការប្រមូលព័ត៌មានពេលវេលាពិត
ទាញចំណងជើងពីប្រភពសំខាន់ៗ (CoinTelegraph, BlockBeats, Cointelegraph RSS, Reddit)៖
import feedparser
from datetime import datetime, timedelta
feeds = [
"https://cointelegraph.com/feed",
"https://www.coindesk.com/arc/outboundfeeds/rss/",
]
articles = []
for feed_url in feeds:
feed = feedparser.parse(feed_url)
for entry in feed.entries[:10]:
articles.append({
"title": entry.title,
"published": entry.published_parsed,
"summary": entry.summary,
})
ការស្គាល់អង្គភាពដែលបានដាក់ឈ្មោះ (NER) សម្រាប់ Crypto Assets
ដកយកថាតើ tokens/វេទិកាណាដែលត្រូវបានលើកឡើង៖
import spacy
nlp = spacy.load("en_core_web_sm")
crypto_entities = {"Bitcoin", "BTC", "Ethereum", "ETH", "Solana", "SOL"}
text = "Bitcoin surged 12% as Ethereum whales accumulated large amounts"
doc = nlp(text)
for token in doc:
if token.text in crypto_entities:
print(f"{token.text} found")
ការជីកយកអារម្មណ៍សង្គម
ការរួមបញ្ចូល Twitter/X API
តាមដានការលើកឡើង អារម្មណ៍ និងការចូលរួមសម្រាប់ទ្រព្យសម្បត្តិជាក់លាក់៖
import tweepy
from transformers import pipeline
sentiment_pipeline = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")
client = tweepy.Client(bearer_token=TWITTER_BEARER)
query = "Bitcoin -is:retweet lang:en"
tweets = client.search_recent_tweets(query=query, max_results=100)
sentiments = []
for tweet in tweets.data:
result = sentiment_pipeline(tweet.text)[0]
sentiments.append({
"text": tweet.text,
"label": result["label"],
"score": result["score"]
})
avg_sentiment = sum(s["score"] for s in sentiments) / len(sentiments)
print(f"Bitcoin sentiment: {avg_sentiment:.2f}")
Reddit Community Sentiment
Monitor r/cryptocurrency, r/btc, r/ethtrader for retail sentiment shifts:
import praw
reddit = praw.Reddit(client_id=ID, client_secret=SECRET, user_agent=AGENT)
subreddit = reddit.subreddit("cryptocurrency")
for post in subreddit.hot(limit=50):
if post.created_utc > (time.time() - 86400):
sentiment = sentiment_pipeline(post.title)[0]
signal_strength = post.score * sentiment["score"]
Building a Production Sentiment Engine
Transformer-Based Sentiment (BERT)
Pre-trained BERT models are far more accurate than lexicon-based approaches:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_name = "ProsusAI/finbert"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
def get_finbert_sentiment(text):
inputs = tokenizer(text, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
probabilities = torch.softmax(logits, dim=1)
sentiment_idx = torch.argmax(probabilities)
confidence = probabilities[0, sentiment_idx].item()
return {"sentiment": ["negative", "neutral", "positive"][sentiment_idx], "confidence": confidence}
Real-Time Sentiment Aggregation
Combine multiple signals into a daily sentiment score:
def compute_daily_sentiment(symbol):
news_articles = fetch_recent_news(symbol)
news_sentiments = [get_finbert_sentiment(a["title"]) for a in news_articles]
news_score = np.mean([s["confidence"] for s in news_sentiments])
tweets = fetch_tweets_last_6h(symbol)
twitter_sentiments = [get_finbert_sentiment(t) for t in tweets]
twitter_score = np.mean([s["confidence"] for s in twitter_sentiments])
reddit_posts = fetch_reddit_hot(symbol)
reddit_sentiments = [get_finbert_sentiment(p) for p in reddit_posts]
reddit_score = np.mean([s["confidence"] for s in reddit_sentiments])
composite = (news_score * 0.4 + twitter_score * 0.35 + reddit_score * 0.25)
return composite
Integrating with Smart Money API
Add sentiment as a feature to your confirmation system:
def confirm_with_sentiment(symbol, direction):
response = requests.get(
f"https://api.smartmoneyapi.com/v1/confirm?symbol={symbol}&direction={direction}",
headers={"X-API-Key": API_KEY}
)
smart_money = response.json()
sentiment_score = compute_daily_sentiment(symbol)
if (direction == "long" and sentiment_score > 0.55):
boost = 0.05
elif (direction == "short" and sentiment_score < 0.45):
boost = 0.05
else:
boost = 0
final_composite = min(smart_money["composite"] + boost, 1.0)
return {"composite": final_composite, "sentiment_boost": boost}
បច្ចេកទេស NLP កម្រិតខ្ពស់
ការវិភាគអារម្មណ៍ដោយផ្អែកលើផ្នែក
ជំនួសអារម្មណ៍ទូទៅ សូមដកយកអារម្មណ៍អំពីផ្នែកជាក់លាក់៖ "បច្ចេកវិទ្យា Bitcoin គឺអស្ចារ្យ ប៉ុន្តែការអនុវត្តយឺត។" ដកយកមតិដោយផ្អែកលើលក្ខណៈពិសេស។
ការរកឃើញសារធាតុបណ្តាល
កំណត់អត្ថាធិប្បាយបណ្តាល៖ "ដោយសារ XYZ តម្លៃនឹងផ្លាស់ប្តូរ។" បណ្តុះបណ្តាលឧបករណ៍ចំណាត់ថ្នាក់ដើម្បីបែងចែកព័ត៌មានដែលមានគោលដៅពីព័ត៌មានមូលដ្ឋាន។
អារម្មណ៍តាមលំដាប់ពេលវេលា
តាមដានការផ្លាស់ប្តូរអារម្មណ៍តាមពេលវេលា។ ការប្តូរភ្លាមៗពី +0.65 ទៅ -0.45 គឺជាសញ្ញាបញ្ច្រាសដែលគួរកត់សម្គាល់។
ផ្សំអារម្មណ៍ជាមួយសញ្ញាប្រាក់ឆ្លាត
Smart Money API ផ្តល់ពិន្ទុភាពជឿជាក់ដែលបានផ្ទៀងផ្ទាត់ជាមួយការព្រមព្រៀងរបស់ត្រីវាសីនិងម៉ែត្រលើខ្សែសង្វាក់។ បន្ថែមការវិភាគអារម្មណ៍ដើម្បីបញ្ជាក់ពីអត្ថប្រយោជន៍របស់អ្នកនិងបង្កើនអត្រាឈ្នះដោយ 4-6%។
ចាប់ផ្តើមដោយឥតគិតថ្លៃ →