Your crypto portfolio, understood.
A self-hosted Telegram bot that tracks every trade, runs proper FIFO accounting, and answers portfolio questions in plain English — powered by AI, deployed on AWS in minutes.
The spreadsheet stops working at some point.
Most people who actively trade crypto across multiple exchanges, wallets, and P2P platforms end up with a mess of rows that nobody can fully trust. They know roughly what they hold, but:
- You can't easily compute accurate realized PnL with proper FIFO cost basis.
- FX gains/losses — buying BTC with RUB, selling for EUR — are invisible.
- There's no quick way to ask "if I sell 1 BTC right now, what's my profit?"
- Spreadsheet maintenance is manual, error-prone, and never up to date.
Ledgent replaces the spreadsheet with a conversational interface that stores every transaction, runs the accounting engine automatically, and lets you ask questions in plain English.
One bot. Four jobs.
Ledger engine, AI advisor, goal-based virtual funds, and real-time smart price alerting.
Ledger & accounting
- Natural-language transaction entry — type "Bought 0.01 BTC for 800 USDT" and the bot parses, validates, and stores it.
- FIFO cost basis — each asset tracked as individual lots, oldest consumed first on sells.
- Multi-currency support — RUB, EUR, USD, USDT, BTC, ETH and any mix.
- Realized PnL decomposed into asset price gains and FX rate movements.
- Live unrealized PnL via CoinGecko (5-min cache).
/set BTC Ledger 1.5Balance reconciliation — snap a location to reality.
AI advisor
/askMulti-turn conversation with full portfolio context — open lots in FIFO order, live prices, realized PnL, recent transactions./sim sellExact FIFO sell simulation — per-lot breakdown, cost basis, proceeds, net PnL. No LLM math involved./strategyEvaluates your next move against your saved DCA strategy./context setPersistent instruction injected into every advisor call ("ignore reconciliation entries from May 2025").- Pluggable LLM backend — Claude, Gemini, OpenAI — selectable at deploy time.
Virtual funds
/fund createNamed sub-portfolios — pension, education, anything you allocate to over time./fund allocRecord monthly allocations with an auto-fetched BTC rate./fundsOverview of every fund with P&L, avg cost, days since last contribution.- Built on top of the same FIFO engine — no separate accounting universe.
Price alerts & monitoring
/alert BTC > 75000Target price triggers — alert when an asset crosses above or below your target./alert SOL 5%Relative percent movements — monitor large shifts relative to a custom baseline price.- Automatic volatility warnings — auto-alert when held assets shift by >= 5% in 24 hours.
- Smart 12h suppression — avoids alert spam on minor oscillations, unless price moves by an additional >= 2% absolute delta.
/alertsManage active alerts — list, review, and clear set alert conditions in Telegram.
Serverless, single-table, self-hosted.
One Lambda for the webhook reply, another for the heavy lifting, one DynamoDB table holding everything. No always-on compute.
Telegram ──▶ API Gateway (HTTP) ──▶ Lambda (webhook, ~100ms)
│
async self-invoke (fire & forget)
│
Lambda (processor, up to 60s)
│
┌──────────────┼──────────────┐
▼ ▼ ▼
DynamoDB Anthropic CoinGecko
(single table) (Haiku 4.5) (price feed)The advisor knows your lots.
Same FIFO engine the bot uses to log trades — exposed through plain-English questions and exact simulations.
Deploy in minutes.
One Terraform apply provisions Lambda, DynamoDB, API Gateway, IAM, and EventBridge. The Telegram webhook gets registered automatically.
git clone https://github.com/smerio/ledgent cp .env.example .env # fill in tokens cp terraform/terraform.tfvars.example terraform/terraform.tfvars cd terraform && terraform init && terraform apply # Telegram webhook is set automatically; bot is live
Prerequisites: an AWS account, a Telegram bot token from @BotFather, and an LLM API key.
Open source. Self-hosted. Yours.
Ledgent isn't a service you sign up for. It's code you run, in your own AWS account, in front of your own Telegram bot.
MIT licensed
Fork it, change it, run it however you want. No strings, no telemetry, no upsell.
Your AWS, your data
Every transaction lives in your DynamoDB table. Nothing routes through a Ledgent server because there is no Ledgent server.
Built in the open
Full Terraform configuration, Python source, prompts and tests — all on GitHub. Pull requests welcome.
Questions, answered.
How much does it actually cost to run?
Roughly $1–5 per month on AWS for a single-user workload (Lambda invocations + DynamoDB reads/writes; no always-on compute). On top of that, $0.01–0.05 per day for LLM calls when you use the bot actively, assuming Claude Haiku 4.5.
Both numbers track usage — if you stop typing to the bot, both go to zero.
Where does my data live?
In your own DynamoDB table, in your own AWS account. The bot processes messages through your Lambda. There is no Ledgent backend, no third-party aggregator, and no analytics. The only outbound calls are to your chosen LLM provider (Claude / Gemini / OpenAI) and to CoinGecko for live prices.
Which assets and currencies are supported?
BTC, ETH, USDT, RUB, EUR, USD out of the box, and arbitrary combinations between them — the FIFO engine and FX decomposition don't care which pair you trade. Adding a new asset means a config entry, not a code change.
Can I swap the LLM provider?
Yes. The parser and advisor are LLM-agnostic — select Claude, Gemini, or OpenAI at deploy time via the LLM_PROVIDER environment variable. Bring your own API key.
Who is Ledgent not for?
If you want a polished mobile app with charts, this isn't it — it's a Telegram bot. If you trade at high frequency, the FIFO model isn't designed for that pattern. And if you're not comfortable managing your own AWS account and running terraform apply, you'll want a hosted service instead.
Why Telegram specifically?
Two reasons. First, the chat UI is the data-entry tool — typing "Bought 0.01 BTC for 800 USDT" beats opening a spreadsheet. Second, Telegram bots have a clean webhook model that maps perfectly to a Lambda function, which is what makes the cost profile so low.
Do the 15-minute scheduled price alerts cost anything?
No. The scheduled checks are triggered every 15 minutes by AWS EventBridge Scheduler. At ~2,880 triggers per month, this falls entirely within the AWS EventBridge Free Tier (14M free invocations/month) and Lambda Free Tier (1M free requests/month). Spot prices are fetched from CoinGecko's free public price feed API, making the alerting system add $0.00 incremental cost.