← All posts
GuidesJuly 24, 20264 min read

Open-source examples for building on the Veltra trade history API

Four runnable examples for the Veltra wallet trade history API: PnL tracking, copy-trade backtesting, ML wallet scoring, and new-trade alerts. Copy, run, ship.

ExamplesOpen SourceAPIDevelopers

We just open-sourced veltra-examples — a set of small, complete, copy-paste-ready projects that show how to build real tools on top of the Veltra wallet trade history API. Each one clones, runs with npm install && npm start, and is meant to be lifted straight into your own project.

The idea is simple: the API hands you a wallet’s complete, parsed buy and sell history from one endpoint, so instead of documentation you can read a working program that already does the thing you want.

What's in it

  • pnl-tracker — realized FIFO cost-basis profit and loss per token, a win rate, and open positions. Real accounting, not a SOL-in/SOL-out estimate.
  • copy-trade-backtester — "if I had copied this wallet, what would I have made?" Replays a wallet’s history with a finite bankroll, a fixed position size, and slippage on every fill.
  • trade-scoring — a machine-learning pipeline that extracts features from a wallet’s history and trains a model to score how skilled it is, with a mode for labeling your own wallets.
  • wallet-watcher — poll a wallet and get alerted the moment it makes a new trade, in your terminal or forwarded to a Discord or Slack webhook.

One endpoint, many tools

Every example is built on a single call: GET /v1/wallets/{address}/history. It returns each trade as a clean row — side, token, mint, SOL value, token amount, DEX, and timestamp — with no transaction decoding on your end. That one stream of "who bought and sold what, for how much, where, and when" is enough to compute cost basis, backtest a copy strategy, train a scoring model, or watch for new activity.

Not using JavaScript? The repo also ships a curl cookbook — streaming, pagination, multichain, error handling, and jq one-liners — that translates cleanly into any language.

Start with a single call

curl -N "https://veltrabot.com/v1/wallets/{address}/history" \
  -H "Authorization: Bearer YOUR_API_KEY"

Built to be copied

  • Each example is an independent folder — copy the one you need, ignore the rest. No monorepo tooling to learn.
  • Every example does real work on top of the data rather than just reprinting the API response.
  • The trading-style examples are honest historical simulations, not live execution, and say plainly what they do and do not model.
  • Each ships its own tests, and CI runs typecheck plus tests for all of them.

Get the code

The full source is on GitHub at https://github.com/QuirkyTurtle11/veltra-examples — MIT licensed. Grab an API key and the free trial is enough to run every example.

Start pulling trade history
100,000 trades free. No card required.
Get your API key

More from the blog