lstm-price-prediction-guide
Guide to LSTM-based cryptocurrency price prediction. Covers data preprocessing, feature engineering, LSTM architecture, training, evaluation, and deployment…
от nirholas★ 289 звёзд на GitHub
Установить lstm-price-prediction-guide в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
LSTM Price Prediction Guide
A guide to building LSTM (Long Short-Term Memory) neural networks for cryptocurrency price prediction. Covers the full pipeline from data collection to model deployment.
Reference notebook
The companion repo is nirholas/lstm-bitcoin-prediction.ipynb, a single self-contained Jupyter notebook that predicts the daily BTC/USD close. It fetches 2000 daily candles from the public CryptoCompare histoday endpoint (no key), holds out the last 10% by time with no shuffling, builds overlapping 7-day windows normalised to each window's first entry, and trains a Keras Sequential of LSTM(20), Dropout(0.25), Dense(1) with MAE loss and Adam for 50 epochs at batch size 4 (np.random.seed(42)). It then plots actual against predicted prices and daily returns. The repo is proprietary (all rights reserved): read it, do not copy it. The deeper multi-feature pipeline below is a larger design than the notebook.
Pipeline Overview
Data Collection → Feature Engineering → Preprocessing → Model Training → Evaluation → Deployment
│ │ │ │ │ │
CoinGecko, Indicators, Normalize, LSTM layers, RMSE/MAE, REST API
Binance API Sentiment, Volume Sequence data Dropout, Dense Backtesting or MCP
Data Collection
import pandas as pd
from cryptodatapy import DataRequest
# Fetch historical OHLCV data
dr = DataRequest(
tickers=['BTC'],
fields=['open', 'high', 'low', 'close', 'volume'],
freq='1h',
start_date='2023-01-01',
source='binance'
)
data = dr.fetch()
Feature Engineering
Technical Indicators
import ta
def add_features(df):
# Moving averages
df['sma_7'] = ta.trend.sma_indicator(df['close'], window=7)
df['sma_25'] = ta.trend.sma_indicator(df['close'], window=25)
df['ema_12'] = ta.trend.ema_indicator(df['close'], window=12)
# RSI
df['rsi'] = ta.momentum.rsi(df['close'], window=14)
# MACD
macd = ta.trend.MACD(df['close'])
df['macd'] = macd.macd()
df['macd_signal'] = macd.macd_signal()
# Bollinger Bands
bb = ta.volatility.BollingerBands(df['close'])
df['bb_upper'] = bb.bollinger_hband()
df['bb_lower'] = bb.bollinger_lband()
# Volume indicators
df['volume_sma'] = df['volume'].rolling(window=20).mean()
df['volume_ratio'] = df['volume'] / df['volume_sma']
# Returns
df['returns'] = df['close'].pct_change()
df['log_returns'] = np.log(df['close'] / df['close'].shift(1))
return df.dropna()
Feature List
| Feature | Type | Description |
|---|---|---|
| SMA (7, 25, 50) | Trend | Simple moving averages |
| EMA (12, 26) | Trend | Exponential moving averages |
| RSI (14) | Momentum | Relative strength index |
| MACD | Momentum | Moving average convergence |
| Bollinger Bands | Volatility | Price channels |
| Volume Ratio | Volume | Relative volume |
| Returns | Price | Percentage returns |
| ATR | Volatility | Average true range |
Data Preprocessing
from sklearn.preprocessing import MinMaxScaler
import numpy as np
# Scale features to [0, 1]
scaler = MinMaxScaler()
scaled_data = scaler.fit_transform(features)
# Create sequences for LSTM
def create_sequences(data, seq_length=60):
X, y = [], []
for i in range(seq_length, len(data)):
X.append(data[i - seq_length:i])
y.append(data[i, 0]) # Predict close price
return np.array(X), np.array(y)
X, y = create_sequences(scaled_data, seq_length=60)
# Train/validation/test split (70/15/15)
train_size = int(len(X) * 0.7)
val_size = int(len(X) * 0.15)
X_train, y_train = X[:train_size], y[:train_size]
X_val, y_val = X[train_size:train_size+val_size], y[train_size:train_size+val_size]
X_test, y_test = X[train_size+val_size:], y[train_size+val_size:]
LSTM Model
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import LSTM, Dense, Dropout
from tensorflow.keras.callbacks import EarlyStopping
model = Sequential([
LSTM(128, return_sequences=True, input_shape=(X_train.shape[1], X_train.shape[2])),
Dropout(0.2),
LSTM(64, return_sequences=True),
Dropout(0.2),
LSTM(32, return_sequences=False),
Dropout(0.2),
Dense(16, activation='relu'),
Dense(1) # Price prediction
])
model.compile(optimizer='adam', loss='mse', metrics=['mae'])
history = model.fit(
X_train, y_train,
validation_data=(X_val, y_val),
epochs=100,
batch_size=32,
callbacks=[EarlyStopping(patience=10, restore_best_weights=True)]
)
Evaluation
from sklearn.metrics import mean_squared_error, mean_absolute_error
predictions = model.predict(X_test)
# Inverse transform to get actual prices
predictions_inv = scaler.inverse_transform(...)
actual_inv = scaler.inverse_transform(...
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл lstm-price-prediction-guide?
Guide to LSTM-based cryptocurrency price prediction. Covers data preprocessing, feature engineering, LSTM architecture, training, evaluation, and deployment. Includes TensorFlow/Keras implementation with technical indicators and sentiment features.
Как установить скилл lstm-price-prediction-guide?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл lstm-price-prediction-guide запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…