Skip to main content

Crate rungbot_core

Crate rungbot_core 

Source
Expand description

rungbot-core — the ladder, as pure logic.

This crate contains the entire strategy and nothing else. It reads no clock, opens no file, makes no network call and generates no randomness, so it compiles unchanged to wasm32-unknown-unknown for a Cloudflare Worker and to a native binary for the CLI. The strategy therefore exists in exactly one place.

use std::collections::BTreeMap;
use rungbot_core::{analyze, Coin, Config, Price, Settings, Venue};

let cfg = Config::new(
    vec![Coin {
        symbol: "BTC".into(),
        venue: Venue::Binance,
        pair: "BTCUSDT".into(),
        name: "Bitcoin".into(),
        entry: Some(61_000.0),
        bands: None,
    }],
    Settings::default(),
)
.unwrap();

let mut prices = BTreeMap::new();
prices.insert("BTC".to_string(), Price { price: 54_900.0, chg_24h: Some(-12.0) });

let out = analyze(&cfg, &prices, &BTreeMap::new(), 1_700_000_000.0);
assert_eq!(out.buys.len(), 1);
assert_eq!(out.buys[0].rung, 1);

Re-exports§

pub use analyze::analyze;
pub use analyze::analyze_with;
pub use analyze::CoinState;
pub use analyze::Outcome;
pub use analyze::Price;
pub use analyze::Row;
pub use analyze::Side;
pub use analyze::Skip;
pub use analyze::SkipReason;
pub use analyze::State;
pub use analyze::Steer;
pub use analyze::Trade;
pub use config::Coin;
pub use config::Config;
pub use config::ConfigError;
pub use config::Settings;
pub use config::Trail;
pub use config::Venue;
pub use decisions::Decision;
pub use decisions::Kind as DecisionKind;
pub use indicators::compute as compute_kpi;
pub use indicators::CoinKpi;
pub use indicators::KpiThresholds;
pub use indicators::Phase;
pub use ladder::buy_rung_for;
pub use ladder::ladder_increment;
pub use ladder::rung_threshold;
pub use ladder::sell_rung_for;
pub use ladder::Bands;
pub use notices::Notices;
pub use notices::Verdict as NoticeVerdict;
pub use regime::assess;
pub use regime::market_label;
pub use regime::running_from_series;
pub use regime::Market;
pub use regime::Regime;
pub use regime::RegimeConfig;
pub use research::brief;
pub use research::gate;
pub use research::screen;
pub use research::Candidate;
pub use research::ScreenConfig;
pub use research::ValueFacts;
pub use research::Verdict;
pub use sellpolicy::BullState;
pub use sellpolicy::PolicySell;
pub use sellpolicy::SellPolicyConfig;
pub use time::iso8601;
pub use time::iso8601_micros;
pub use time::utc_day;

Modules§

analyze
The ladder itself: prices plus prior state become the trades this run would make.
config
The watchlist and the ladder’s tunables — types and validation only.
decisions
The decision log — so the tool can answer “why did nothing happen?”
deploy
The deploy layer’s planning maths: where fresh capital rests as limit-buy zones.
fmt
Number formatting shared by the core’s human-readable strings.
housekeeping
The arithmetic behind a live run’s housekeeping, with no venue and no file in sight.
indicators
Market-cycle indicators, per coin.
ladder
Ladder arithmetic: which rung a move has reached, and how much that rung trades.
names
Names a user typed, checked against the names a command knows: flags and config keys.
notices
Notification dedupe: one message per new signal, one reminder a day, never a loop.
pymath
Two pieces of float arithmetic that must match the reference implementation bit for bit.
pyrandom
CPython’s random.Random, reproduced bit for bit.
regime
Market regime and per-coin strength — the steering layer that sits above the ladder.
research
The opportunity screen: which deeply-dislocated coins have a business under them.
scenarios
The dashboard’s scenario model: how today’s book would evolve under the price paths of past cycles, and what the sell side does along the way.
sellpolicy
The bull-market sell policy: sell right, not early.
time
Calendar maths, without a date crate.
watch
The watchers: read-only checks that mail a person when the book needs a decision.
yaml
A dependency-free reader for the nested-mapping subset a rungbot config uses.

Constants§

VERSION
The crate version, so a Worker and a binary can report the same number.