Skip to content

small-cactus/crypto-one

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CRYPTO-ONE

CRYPTO-ONE is a research-oriented crypto trading repository centered on a paired buy/sell transformer stack for 15-minute SOL market structure. The current active model work lives in crypto_one_ft/features/models_september, while the rest of the repository preserves earlier collector, database, wallet, and analytics experiments that fed into the current system design.

Quick Start

python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install -r requirements.txt
python3 start.py

That command path is the fastest clean run from a fresh clone. It executes the built-in configuration check plus the buy-side and sell-side transformer sanity tests that ship with the active model stack.

What This Repository Contains

Area Purpose
crypto_one_ft/features/models_september Active transformer models, feature builders, evaluation scripts, and live scoring loop
crypto_one_ft/legacy Earlier trading integrations, wallet automation, deployment helpers, and realtime collectors
legacy Database-backed crawl pipeline, swap analytics, price enrichment, and historical ML experiments
start.py Root-level verified entry point for the built-in architecture demo
.env.example Public-safe environment template for the live and collector paths

How The Active Stack Works

The active system is organized around a buy model and a sell model that share the same general workflow:

  1. Raw 15-minute candles are normalized and enriched with engineered market-structure features.
  2. The buy-side builder and sell-side builder convert those candles into hierarchical sequences with auxiliary targets and attention weights.
  3. Transformer models score those sequences for timing, expected return, ranking, hazard behavior, and confidence.
  4. The realtime loop combines market data, model outputs, and threshold logic to drive live decision support.

The design focus in the active stack is consistency between offline preparation and online inference. The same feature-engineering concepts appear across the builders, evaluators, and live scoring path so the model sees a stable representation of the market in every mode.

Architecture

Buy-side transformer

crypto_one_ft/features/models_september/transformer_model.py defines the buy-side hierarchical model. Its built-in sanity test shows the intended structure clearly:

  • input shape: [batch, minutes, sub_steps, features]
  • test configuration: 10 periods x 60 sub-steps x 5 features
  • prediction surface: ranking, returns, hazard timing, entry confidence, expected ROI, risk probability, and ROI quantiles

This model is designed for denser intraperiod sequences where the network first learns within-period structure and then reasons across longer history.

Sell-side transformer

crypto_one_ft/features/models_september/transformer_sell.py defines the paired sell model:

  • input shape: [batch, periods, feature_groups, features]
  • test configuration: 60 bars x 1 feature-group step x 76 features
  • prediction surface: setup bins, setup continuous values, ranking, returns, hazard timing, exit confidence, expected ROI, risk probability, and ROI quantiles

This side of the stack places more weight on bar-level context and explicit setup descriptors used to manage exits and post-entry trade behavior.

Shared orchestration

test_model_performance_both.py is the main junction point between the two models. It loads the paired outputs into one evaluator so thresholding, ranking behavior, and timing signals can be inspected together instead of in isolation.

trading.py is the realtime orchestration layer. It pulls in market data, applies the same general feature-preparation concepts, runs the buy and sell bundles, and then applies decision logic, thresholds, and execution-oriented helpers around those predictions.

Active Code Paths

File Role
crypto_one_ft/features/models_september/feature_builder_15m_buy.py Builds buy-side training sequences from 15-minute candle data
crypto_one_ft/features/models_september/feature_builder_15m_sell.py Builds sell-side training sequences from the same source format
crypto_one_ft/features/models_september/train_model.py Buy-side training entry point
crypto_one_ft/features/models_september/train_model_sell.py Sell-side training entry point
crypto_one_ft/features/models_september/test_model_performance_both.py Combined evaluation and threshold analysis
crypto_one_ft/features/models_september/trading.py Realtime market scoring and execution-oriented orchestration
crypto_one_ft/features/models_september/transformer_model.py Buy-side hierarchical transformer definition
crypto_one_ft/features/models_september/transformer_sell.py Sell-side hierarchical transformer definition
crypto_one_ft/features/models_september/augmentation_config.py Centralized data-augmentation presets
crypto_one_ft/features/models_september/predictive_features Pattern-prior and forecasting helpers used by the feature pipeline

Feature And Data Flow

The active builders expect a 15-minute aggregated candle dataset with exchange-style OHLCV columns. From there, the stack moves through four layers:

  1. Candle normalization prepare_new_kline_dataframe(...) standardizes timestamps, numeric columns, and market-structure fields.
  2. Engineered features The builders attach recent-low distance, support/resistance context, linear-fit trend features, directional-volume ratios, and predictive prior columns.
  3. Sequence extraction The dataset is converted into attention-weighted temporal windows with auxiliary metadata for training and evaluation.
  4. Model scoring The transformer heads produce ranking, return, hazard, confidence, and ROI-oriented outputs that are consumed by evaluation and live logic.

This flow is why the repository is script-heavy: each stage is exposed directly so the data path can be inspected, rerun, or replaced without having to unpack a large framework layer first.

Running The Main Modes

1. Architecture Demo

This is the root quick-start path:

python3 start.py

It runs:

  • quick_config_test.py
  • transformer_model.py
  • transformer_sell.py

2. Feature Building

Use a 15-minute aggregated candle file with the schema expected by the active builders:

python3 crypto_one_ft/features/models_september/feature_builder_15m_buy.py \
  --src /path/to/your_15m_candles.csv \
  --out /path/to/output/buy

python3 crypto_one_ft/features/models_september/feature_builder_15m_sell.py \
  --src /path/to/your_15m_candles.csv \
  --out /path/to/output/sell

The builders expect columns such as:

  • open_time
  • open
  • high
  • low
  • close
  • volume
  • quote_asset_volume
  • number_of_trades
  • taker_buy_base_asset_volume
  • taker_buy_quote_asset_volume

3. Training

python3 crypto_one_ft/features/models_september/train_model.py
python3 crypto_one_ft/features/models_september/train_model_sell.py

These scripts orchestrate the buy and sell training flows for the hierarchical transformer architecture.

4. Evaluation

python3 crypto_one_ft/features/models_september/test_model_performance_both.py

This evaluator combines the two model paths and is the main entry point for measuring ranking, return, and timing behavior together.

5. Live Scoring

python3 crypto_one_ft/features/models_september/trading.py

The live path is designed around external market data, runtime configuration, and environment-provided credentials. Use .env.example as the starting point for local configuration.

Environment Configuration

The repository uses environment variables for RPC access, data services, collector infrastructure, and wallet-aware integrations. Start with:

cp .env.example .env

Key groups:

Group Variables
Live model stack JUP_API_KEY, SPL_TOKEN_PROGRAM_ID
Solana execution RPC_URL, SECRET_KEY, PHANTOM_KEY_B58, EXPECTED_WALLET_ADDRESS
Collector pipeline HELIUS_API_KEY, DB_URL, DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD
External analytics COINMARKETCAP_API_KEY

Repository Layout

.
├── crypto_one_ft/
│   ├── features/models_september/   # active transformer stack
│   └── legacy/                      # earlier runtime and deployment work
├── legacy/                          # collectors, SQL, analytics, crawler pipeline
├── .env.example
├── requirements.txt
└── start.py

Development Notes

  • The active stack is Python-first and organized around explicit scripts rather than a packaged library.
  • The repository contains both current model work and preserved historical experiments, so reading by subsystem is more effective than reading by date.
  • The quickest way to understand the current architecture is to start with start.py, then open the files in the Active Code Paths table above.

About

Transformer-based crypto trading research stack for 15-minute SOL data, evaluation, and live scoring experiments.

Topics

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors