BitcoinFTM (Bitcoin Financial Trade Manager) is a legacy PHP application for monitoring exchange data, estimating cross-exchange arbitrage opportunities, and simulating trading activity per client account.
The project appears to have been built around 2013-2014 for the now-defunct GetDemCoins/Lit2Bit environment.
This repository is a historical codebase, not a production-ready modern trading system.
- Language/runtime is legacy PHP with
mysql_*APIs. - Several exchange adapters target APIs that are now deprecated or offline.
- "Live" trading paths are incomplete or intentionally disabled in multiple adapters.
- Sensitive credentials are currently committed in tracked files and should be rotated immediately.
- Session-based login and dashboard (
btcftm/index.php,btcftm/controls.php) - Multi-panel UI for:
- market snapshots
- order books
- spread matrix
- charting
- buy/sell simulation
- transfer simulation
- arbitrage simulation
- portfolio/account views
- Arbitrage engine that:
- loads active markets from DB
- builds a market order book (MOB)
- computes best bid/ask spread opportunities
- fans opportunities to observers/bots
- JSON endpoints used by frontend polling:
btcftm/master-json.phpbtcftm/test-chart-json.phpbtcftm/ajax-orderbooks.phpbtcftm/ajax-market-buysell.phpbtcftm/ajax-transfer.phpbtcftm/ajax-arbitrage.php
- Cron scripts for market ingestion and history resampling:
cron/add-live-data.phpcron/add-orderbook-data.phpcron/resample-live-data.php
- Browser loads
btcftm/controls.phpafter login. controls.phpbootstrapsArbitragewith historical market mode and emits initial JSON.- Frontend (
btcftm/js/*.js) pollsmaster-json.phpand updates panels every ~15s. - Order books are refreshed via
ajax-orderbooks.phpand weighted depth calculations are performed in JS. - Trade actions call AJAX endpoints, which mutate balances in
privatemarketsand append totransactions. - Background cron jobs ingest ticker/orderbook data into exchange tables and resample into period tables.
btcftm/: main web appcore/: arbitrage engine, market adapters, observers, DB-driven domain objectspartials/: panel templatesjs/,css/,jquery/: frontend code and vendor librariesjson/: JSON writers/helpers
cron/: ingestion + resampling entrypoints and sample task wrappersclasses/: exchange ticker/orderbook fetch helpers used by cron utilitiesutils/: DB + exchange utility classes used by cron scriptsarchive/: older experiments and historical scripts
There are no migrations in this repository. The application expects an existing MySQL schema with at least:
clientstraderbotsmarketscurrenciesprivatemarketstransactionshoneypot
Market history tables are exchange-specific and convention-based, e.g.:
<exchange>_ticker<exchange>_orderbook<exchange>_history_<scale>
Examples of scales used by cron/task files:
half_hourshoursdaysweeksbiweeksmonths
Examples of exchange prefixes used in code:
mtgoxbitstampbtce_btcusdbitfinex_btcusdkraken_btcusdcryptotrade_btcusdcampbx_btcusdbitfinex_ltcbtcbtce_ltcbtc
- PHP 5.6 era runtime (or older PHP that still supports
mysql_*extension) - MySQL/MariaDB with pre-seeded schema/data
- PHP extensions: curl + mysql
Modern PHP 7/8 will fail without significant refactoring because mysql_* APIs were removed.
- Update DB credentials in
btcftm/core/config/db_config.php. - Review runtime flags in
btcftm/core/config/config.php:live(keep0for simulation)observers- logging flags
- honeypot rate
- Ensure market/currency/client rows exist and are marked active where needed.
From repository root:
php -S 127.0.0.1:8000 -t btcftmOpen:
http://127.0.0.1:8000/index.php
Use a valid row in clients to sign in.
The project includes shell wrappers in cron/tasks/ that call hosted cron endpoints.
Typical flow:
add-live-data.phpwrites latest tickers to<exchange>_ticker.add-orderbook-data.phpwrites compact order book snapshots to<exchange>_orderbook.resample-live-data.phprolls raw ticker data into period tables (history_hours,history_days, etc.).
cron/tasks/calls.txt documents intended schedule frequencies.
- Hardcoded credentials and API secrets exist in tracked files (
btcftm/config.php,btcftm/core/config/db_config.php). - Login uses MD5 password checks and direct SQL interpolation.
- Most SQL queries are string-concatenated with minimal sanitization.
- "Live" trading code paths are inconsistent and in places intentionally blocked.
- Uses deprecated
mysql_*API and global mutable state. - Missing schema migrations and test automation.
- Several classes contain TODOs or incomplete methods.
- Many exchange integrations target legacy endpoints that may no longer respond.
- Remove and rotate all exposed secrets immediately.
- Migrate DB layer to PDO or MySQLi with prepared statements.
- Add reproducible schema migrations and seed data.
- Split simulation and live-trading responsibilities.
- Add integration tests around pricing math and transaction writes.
- Re-validate every exchange adapter against current APIs.
No explicit project license file is present in this repository.
If you intend to reuse or distribute this code, add a license first.