Skip to content

roger-link/gobaby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GoBaby Coin Scorer & 4-Coin Rebalancer

A quant-driven selector for grid-style swing trading.
Ranks USD pairs on Coinbase by volatility, liquidity, and short-term trend.

Outputs

  • scores.csv β€” full universe with metrics
  • skipped.csv β€” failed or illiquid coins
  • recommendations.csv β€” top 4 rebalance picks

No API key required. Uses public Coinbase endpoints.


πŸš€ Quick Start

macOS (Apple Silicon)

Install prerequisites
brew install asdf coreutils git openssl@3 ca-certificates

Enable asdf
echo '. "$(brew --prefix asdf)/libexec/asdf.sh"' >> ~/.zshrc
exec zsh

Install Ruby
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
asdf install ruby 3.2.4
asdf set ruby 3.2.4
ruby -v

Project setup
git clone gobaby cd gobaby bundle install

Run
ruby gobaby.rb --input coins.txt

Example output:
=== REBALANCE PICKS (4) ===
NOICE-USD hyper-vol score=46.6 vol30d=29.4 range=39.8 trend7d=0.0 vol24h=$2.6M
USELESS-USD hyper-vol score=21.7 vol30d=11.9 range=19.7 trend7d=1.4 vol24h=$14.3M
ALICE-USD mid-vol score=13.7 vol30d=8.6 range=9.5 trend7d=2.9 vol24h=$2.5M
SQD-USD hyper-vol score=13.6 vol30d=13.9 range=15.2 trend7d=18.3 vol24h=$10.3M


πŸͺ™ coins.txt

Example file:

core

BTC-USD
ETH-USD

alts

ALICE-USD
SUI-USD
NOICE-USD
USELESS-USD

Lines starting with # are ignored.


βš™οΈ How It Works

Data sources
β€’ Coinbase /products for USD markets
β€’ /products/{id}/candles for daily OHLCV (60 days)
β€’ /products/{id}/stats for 24 h volume and price

Metrics

  • realized_vol_30d_pct = standard deviation of 30 day returns Γ—100
  • avg_daily_range_pct = mean (high-low)/close Γ—100
  • trend_7d_abs_pct = absolute 7 day price change
  • vol24h_usd = 24 h USD volume

Score formula
score = vol30d + 0.35 Γ— avg_range + 0.5 Γ— log10(vol24h_usd) – 0.5 Γ— trend7d

Categories

  • hyper-vol β‰₯ 12 % vol or β‰₯ 18 % range
  • mid-vol 6–12 % vol or 8–18 % range
  • high-liquidity β‰₯ $10 M 24 h volume
  • excluded > 40 % 7 day trend (breakout)

🧠 Usage

Standard run: ruby score_gbt_universe.rb --input coins.txt
Limit coins: ruby score_gbt_universe.rb --input coins.txt --max 50
Verbose: LOG_LEVEL=debug ruby score_gbt_universe.rb --input coins.txt

Outputs

  • scores.csv β€” all scored coins
  • recommendations.csv β€” rebalance set
  • skipped.csv β€” unlisted / failed

⏱️ Automate Runs

Daily cron example:
15 7 * * * cd /path/to/gbt-scorer && LOG_LEVEL=info ruby score_gbt_universe.rb --input coins.txt >> run.log 2>&1

Weekly rebalance rules:
β€’ Replace coins if score drops > 50 %
β€’ trend > 30 %
β€’ 24 h volume < $1 M


🧩 Constants (in script)

DAYS_BACK = 60
WEIGHT_VOL = 1.0
WEIGHT_RANGE = 0.35
WEIGHT_LIQ = 0.50
WEIGHT_TREND = 0.50
HYPER_VOL_MIN = 12.0
HYPER_RANGE_MIN = 18.0
HIGH_LIQ_USD_MIN = 10_000_000.0
MAX_TREND_ABS_PCT = 40.0


βš–οΈ Safety

Public data only (no API keys).
Retries + throttling built in.
Strict JSON parsing.
No writes outside project folder.


πŸ—“οΈ Weekly Rebalance Routine β€” GoBabyTrade + gobaby.rb

This guide outlines your weekly trading rhythm using the gobaby.rb script to score coins, select top performers, and manage your GoBabyTrade trader setup efficiently.


βš™οΈ Overview

You’ll rebalance your active coins once per week.
Each week, the script re-evaluates volatility, liquidity, and trend data to suggest the top 4 coins to trade.

The goal is to:

  • Stay aligned with the most active, profitable market conditions
  • Avoid over-trading
  • Let open positions close naturally through the trader’s profit logic

πŸ“… Weekly Schedule

Day Task Description
Sunday (Rebalance Day) Run the script Run ruby gobaby.rb and review recommendations.csv for the week’s top 4 coins.
Compare vs current active coins Identify any coins you are currently trading that aren’t in the new top 4.
Adjust trader configuration Use Option 1 (default) or Option 3 (faster exit) to offboard old coins.
Monday–Saturday Monitor trader performance Let the trader automatically buy/sell; optionally check open lots midweek.
End of week (Saturday night) Review progress Note profits realized and remaining open lots; prepare for next rebalance.

🧩 Step-by-Step Each Sunday

1. Run the Scoring Script

Run this command from your project folder: ruby gobaby.rb

The script will:

  • Fetch 30 days of price and volume data from Coinbase
  • Compute volatility, range, and trend metrics for each coin
  • Rank and score all coins, saving three output files:
    • scores.csv β€” full list of ranked coins
    • skipped.csv β€” coins that couldn’t be scored
    • recommendations.csv β€” your 4 best picks for the next week

2. Identify Coin Changes

Compare your current trader coins with the new top 4:

  • Coins in both lists β†’ keep trading
  • Coins dropped from the top 4 β†’ prepare to phase out
  • Coins new in the top 4 β†’ enable them in GoBabyTrade

3. Offboard Old Coins

You have three main strategies depending on how aggressively you want to rotate.

🟩 Option 1 β€” Smooth Transition (Recommended)

Let open lots sell naturally but stop adding new ones.

Steps:

  1. Go to Menu β†’ Select Currencies
  2. Uncheck Add for that coin (leave Sell checked)
  3. Click Spread Funds Equally
  4. Click Save All Settings

βœ… Pros: Keeps profit-taking logic intact.
⚠️ Cons: Takes longer to exit positions.


🟨 Option 3 β€” Accelerated Exit (Faster Rotation)

Lower your profit target so existing lots close sooner.

Steps:

  1. Go to Menu β†’ Edit Strategy
  2. Find Profit Goal (Per Trade)
  3. Temporarily reduce (e.g., from 5% β†’ 2%)
  4. Click Save All Settings

βœ… Pros: Speeds up liquidation while staying within system logic.
⚠️ Cons: May cap upside if coins rebound quickly.


πŸŸ₯ Option 2 β€” Manual Close (Emergency Only)

Force-sell all or some open lots immediately.

Steps:

  1. Go to Menu β†’ My Trader
  2. Locate the coin and click Close to sell all, or expand (+) to close specific lots.
  3. When prompted, check β€œStop the trader from purchasing more.”
  4. After sell orders complete, return to Select Currencies β†’ Spread Funds Equally β†’ Save All Settings.

βœ… Pros: Frees capital right away.
⚠️ Cons: Bypasses profit logic and may realize losses.


πŸ“ˆ Example Weekly Cycle

  1. Sunday: Run ruby gobaby.rb, rebalance your coins using the top 4 picks.
  2. Monday–Friday: Let GoBabyTrade operate autonomously β€” no manual trades.
  3. Saturday: Review profits and open positions. If funds are low, adjust allocations.
  4. Sunday (next week): Repeat β€” run the script, update your coins, rebalance again.

πŸ’‘ Tips

  • Always keep at least one high-liquidity coin in rotation (e.g., SOL, BTC, ETH).
  • Avoid switching coins more than once per week β€” let volatility cycles play out.
  • Keep around 10–20% of USDC in reserve to handle new entries or ladder buys.
  • Move realized profits back to USDC monthly to maintain compounding stability.

βœ… Summary

Running the script weekly + letting GoBabyTrade manage entries/exits allows:

  • Maximum exposure to active market cycles
  • Controlled downside via volatility scoring
  • Passive compounding without over-managing

This rhythm is designed for a low-time, high-consistency approach β€” just one rebalance per week.


🧾 Tracking Your Weekly Progress

Adding a simple weekly tracking routine helps you measure results, refine your strategy, and stay consistent over time.

🎯 Goal

To understand how your GoBabyTrade portfolio performs week over week β€” how much profit you’re realizing, which coins perform best, and how your volatility-based selections behave in real market cycles.


πŸͺœ Steps to Track Weekly Results

  1. After running ruby gobaby.rb each Sunday:

    • Note the 4 recommended coins from recommendations.csv.
    • Copy the list into your tracking file (see format below).
  2. At the end of each week (Saturday):

    • Open GoBabyTrade β†’ My Trader.
    • Record your realized profit for the week.
    • Estimate your average daily gain % (divide weekly gain by 7 and portfolio size).
    • Add any short notes β€” e.g., β€œSOL was strongest, SHIB low volume week.”
  3. Update your CSV log or sheet:

    • Use the format below in a local file like history.csv or a Google Sheet.
    • Optionally automate appending this data from Ruby (future improvement).

πŸ“˜ Example: history.csv

week_start, top_4_picks, total_profit_usd, avg_daily_gain_pct, notes
2025-10-13, "DOGE,SUI,L3,XCN", 312.50, 0.42, "SUI strong trend; DOGE flat."
2025-10-20, "SHIB,SOL,ALGO,XCN", 287.10, 0.37, "Lower volatility this week."
2025-10-27, "SOL,SUI,L3,TRB", 425.75, 0.55, "SOL breakout; strong mid-vol performance."

πŸ’‘ Tip: Keep history.csv in the same folder as gobaby.rb for easy version control and future automation.


πŸ“Š What to Watch Over Time

Metric Why It Matters
Weekly profit/loss (realized) Tracks overall compounding progress
Average daily return % Shows consistency of your results
Funds tied in open lots Measures liquidity efficiency
Coin overlap week-to-week Reveals stability in your selections
Top performers (by name) Helps identify which coins are β€œkeepers”

πŸ” Review Every Month

At the end of each month:

  • Sum the last 4 weeks’ realized profits
  • Check if your average daily gain aligns with your expectations (e.g., ~0.4–0.5%)
  • Look for coins appearing in multiple top-4 selections β€” these are statistically resilient picks
  • Use your notes to tune parameters or decide when to adjust your grid size or profit goal

βœ… Outcome

By tracking weekly, you’ll:

  • Quantify real returns instead of guessing
  • Spot early signs of underperformance
  • Build confidence in your data-driven rebalancing
  • Create a permanent performance log you can use to refine your model

πŸ“œ License

MIT License β€” use at your own risk.
Crypto trading involves substantial risk.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages