TOTALUM // TRADING-ALGO v0.1
The algorithm
that listens to two exchanges.
Pulls Coinbase + Revolut X market data and account history. Normalizes to a single shape. Computes P&L, market analysis, and trade signals as pure functions the backend can call.
Coinbase
LIVERevolut X
SAMPLEGenerated · 5:16:11 PM
PAIR
BTC-USD
BUY
$71,492.80
▼ 1.65%
PAIR
ETH-USD
SELL
$2,801.51
▼ 3.39%
PAIR
SOL-USD
BUY
$124.27
▼ 4.52%
PAIR
XRP-USD
SELL
$1.00
▼ 1.28%
[01]
PORTFOLIO
TOTAL VALUE
$111,869.71
Cost basis
$86,609.30
Realized P&L
$36.90
Unrealized P&L
$9,589.74
Unreal. %
+11.07%
POSITIONS3 open
SYMBOLQTYAVG ENTRYLASTVALUEP&L
BTC-USD1.0560$60,149.62$71,492.80$75,496.40$11,978.40 / +18.86%
ETH-USD6.1300$3,146.12$2,801.51$17,173.26-$2,112.44 / -10.95%
SOL-USD28.4000$134.00$124.27$3,529.38-$276.22 / -7.26%
[02]
SIGNALS
REVOLUT X · SIGNAL
BTC-USD
BUYstrong
Score
0.76
Strength
strong
Ref price
$71,492.80
- ›Price moved 4.55% over the analysis window
REVOLUT X · SIGNAL
ETH-USD
SELLstrong
Score
-0.97
Strength
strong
Ref price
$2,801.51
- ›Price moved -3.74% over the analysis window
- ›Order-book ask-heavy (imbalance -0.44)
REVOLUT X · SIGNAL
SOL-USD
BUYstrong
Score
0.81
Strength
strong
Ref price
$124.27
- ›Volume spike 2.75× the trailing average
- ›Price moved 8.95% over the analysis window
- ›RSI overbought at 80.9
REVOLUT X · SIGNAL
XRP-USD
SELLmoderate
Score
-0.35
Strength
moderate
Ref price
$1.00
- ›Order-book ask-heavy (imbalance -0.44)
[03]
MARKET INTELLIGENCE
BTC-USD
COINBASE READ
VOLUME
0.08×
normal
MOMENTUM
-1.65%
59h window
RSI 14
32.3
neutral
OB IMBALANCE
-0.17
ask-heavy
DEPTH (TOP 10)
bid 0.64spread 0.0 bpsask 0.91
ETH-USD
COINBASE READ
VOLUME
0.06×
normal
MOMENTUM
-3.39%
59h window
RSI 14
28.1
oversold
OB IMBALANCE
-0.17
ask-heavy
DEPTH (TOP 10)
bid 13.29spread 0.0 bpsask 18.64
SOL-USD
COINBASE READ
VOLUME
0.15×
normal
MOMENTUM
-4.52%
59h window
RSI 14
26.2
oversold
OB IMBALANCE
-0.25
ask-heavy
DEPTH (TOP 10)
bid 3,364.85spread 1.2 bpsask 5,599.77
XRP-USD
COINBASE READ
VOLUME
0.10×
normal
MOMENTUM
-1.28%
59h window
RSI 14
37.6
neutral
OB IMBALANCE
-0.10
ask-heavy
DEPTH (TOP 10)
bid 90,717.61spread 0.7 bpsask 110,400.20
[04]
ALGORITHM MAP
01→
IMPORT
coinbase.ts + revolut.ts pull tickers, candles, order book, balances, fills.
src/lib/trading/coinbase.ts · revolut.ts
02→
NORMALIZE
Maps raw responses to a single canonical shape (PriceTick, OHLCVCandle, OrderBook, Trade…).
src/lib/trading/normalize.ts
03→
CALCULATE
FIFO P&L (realized + unrealized), average entry price, portfolio value, mark-to-market.
src/lib/trading/portfolio.ts
04→
ANALYZE
Volume spike ratio, price momentum, RSI(14), order-book imbalance.
src/lib/trading/market-analysis.ts
05
SIGNAL
Weighted vote → BUY · SELL · HOLD with strength, score, and human reasons.
src/lib/trading/signals.ts