Skip to content

zkp2p/bloomberg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bloomberg

Discord bot for ZKP2P liquidity providers. Pulls live market data from the Peerlytics API and turns it into actionable rate, depth, and vault recommendations inside the chat.

What it does

/spreads <platform> <currency>

Slash command. Returns one embed with:

  • Live top of book (rate, depth, percentile snapshot) when Peerlytics has the front-of-book fields
  • Latest fill, 24h averages, 7d averages
  • FX mid in the footer

@bloomberg <message>

Mention the bot with plain text. It parses the message and replies with a recommendation. Three modes, picked from keywords:

Spread mode (default). Recommends a deposit rate. Surfaces top-of-book and the 30-min percentile snapshot.

Speed mode. Triggered by fast, vault, delegator. Lists the top three delegator vaults ranked by fulfilled intents, then volume routed, then TVL.

Diagnose mode. Triggered by not filling, stuck, or any user-supplied rate (I'm at 1.10, offering 8%). Classifies the rate against percentiles and recommends the median rate as a concrete target.

The parser handles:

  • Direction (offramp/onramp) from sell/withdraw/cashout vs buy/topup
  • Amount: $300, 5k usdc, 1100 eur, currency symbols, defaults to $300
  • 34 currency codes plus 30+ aliases (dollars, yen, ringgit, shekels, lira, forint)
  • Nine main platforms plus typos (revoult, paypall, cshapp, vnmo) and shortcuts (rev, pp)
  • User-supplied rates as either spreads (8%) or absolute (1.10)

Reaction feedback

Every @bloomberg reply is seeded with ✅ and ❌. Reactions log to a local SQLite file (feedback.db) along with the original message and parsed intent. Use the data to tune the regex on real misses instead of guessing.

.venv/bin/python inspect_feedback.py --misses

Setup

git clone https://github.com/zkp2p/bloomberg
cd bloomberg
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
cp .env.example .env  # fill in tokens
.venv/bin/python bot.py

Env vars:

Var Purpose
DISCORD_BOT_TOKEN Bot token from the Discord developer portal
PEERLYTICS_API_KEY Sent as X-API-Key to peerlytics.xyz
ENABLE_MESSAGE_CONTENT Set to 1 to enable the @bloomberg natural-language path (privileged intent; also flip the toggle in the dev portal)
ALLOWED_CHANNEL_IDS Optional comma-separated channel allowlist

Tests

.venv/bin/pip install pytest pytest-asyncio
.venv/bin/python -m pytest

Around 330 tests, no network or Discord gateway needed. HTTP responses and Discord state are stubbed in tests/conftest.py.

Deploy

deploy.sh rsyncs to a remote host, sets up the venv, writes a systemd unit, and tails logs. Configure with two env vars:

BLOOMBERG_HOST=pi@your-host bash deploy.sh
# optional: BLOOMBERG_REMOTE_DIR=bloomberg

Layout

bot.py              # the bot
inspect_feedback.py # review the feedback dataset
deploy.sh           # remote rsync + systemd
tests/              # parser, logic, API, handler, feedback tests

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors