- PostgreSQL.
- Rust.
- Node.js and npm.
-
Database Configuration
-
Install PostgreSQL and create a database.
-
Create a
.envfile in the project root with your database URL:
# .env file
DATABASE_URL=postgresql://user:password@localhost:5432/your_database
SYNC_CONC_MARKETS=30
SYNC_DB_CHUNK=60000
Run the following commands to set up the database:
sqlx database create
sqlx migrate runTo populate the database tables, use the sync binary. You can backfill all tables or target specific exchanges and time ranges.
Quick Backfill (All Tables)
cargo run --bin sync
Backfill for the Last 24 Hours
cargo run --bin sync init --hours 24
Backfill Between Specific Timestamps
Use Unix timestamps (in milliseconds) to specify a range:
cargo run --bin sync init --between 1724544000000 1724630400000Target a Single Exchange
Add the --exchange flag to target a specific exchange (case-insensitive).
Backfill markets for the paradex exchange:
cargo run --bin sync markets --exchange paradex
Backfill funding for the extended exchange for the last 168 hours:
cargo run --bin sync funding --exchange extended --since-last 168Recommendation: Use cargo run --bin sync to backfill all tables unless specific data is needed.
Start the backend after backfilling the database:
cargo run --bin backend# .env file
VITE_API_URL=http://localhost:8080
VITE_API_ENDPOINT=/api/funding-matrix
VITE_REFRESH_INTERVAL=30000
In a separate terminal, navigate to the frontend directory and run:
cd frontend
npm install
npm run devExtending to New Exchanges To add support for a new exchange:
- Use the
--exchangeflag with the new exchange name in sync commands. - Ensure the exchange is supported in the backend configuration.
- Exchange names are case-insensitive.
- Verify the
.envfile has the correct database URL. - Refer to the project documentation or open an issue for support.
- Fork the repository.
- Create a new branch (
git checkout -b feature-name). - Commit your changes (
git commit -m "Add feature"). - Push to the branch (
git push origin feature-name). - Open a pull request.
