Files
proxmox/docs/11-references/DBIS_CORE_API_REFERENCE.md

141 lines
4.3 KiB
Markdown
Raw Permalink Normal View History

# DBIS Core API Reference
**Last Updated:** 2026-01-31
**Status:** Active
**Purpose:** Master reference for DBIS Core Banking System APIs including exchange integrations
---
## Overview
The DBIS Core API Gateway exposes multiple API groups. Base URLs:
- **DBIS API Primary:** `https://dbis-api.d-bis.org` (VMID 10150)
- **DBIS API Secondary:** `https://dbis-api-2.d-bis.org` (VMID 10151)
All APIs require authentication via `zeroTrustAuthMiddleware` unless otherwise noted.
---
## Exchange Integrations
### Crypto.com OTC 2.0 API
**Base Path:** `/api/v1/crypto-com-otc`
**Documentation:** [exchange-docs.crypto.com/exchange/v1/rest-ws/index_OTC2.html](https://exchange-docs.crypto.com/exchange/v1/rest-ws/index_OTC2.html)
Institutional OTC trading integration with Crypto.com Exchange OTC 2.0 REST/WebSocket APIs.
#### Environment Variables (Optional)
| Variable | Required | Description |
|----------|----------|-------------|
| `CRYPTO_COM_API_KEY` | Yes (when using OTC) | API key from Crypto.com Exchange |
| `CRYPTO_COM_API_SECRET` | Yes (when using OTC) | API secret |
| `CRYPTO_COM_ENVIRONMENT` | No | `production` (default) or `uat` |
When credentials are not configured, OTC endpoints return `503 Service Unavailable`.
#### Reference Data
| Method | Path | Description |
|--------|------|-------------|
| GET | `/instruments` | Available OTC instruments (BTC_USD, ETH_USD, etc.) |
| GET | `/status` | Service connectivity and instrument count |
#### Quote Management
| Method | Path | Description |
|--------|------|-------------|
| GET | `/quote-requests` | Open quote requests (NEW/ACTIVE) |
| GET | `/quote-requests/history` | Quote request history (COMPLETED/REJECTED) |
| GET | `/quotes` | Open quotes (ACTIVE) |
| GET | `/quotes/history` | Quote history |
#### Deal Management
| Method | Path | Description |
|--------|------|-------------|
| GET | `/deals` | Open deals (not yet SETTLED) |
| GET | `/deals/history` | Closed deal history |
#### Settle Later
| Method | Path | Description |
|--------|------|-------------|
| GET | `/settle-later/limit` | Configured and used settle-later limit |
| GET | `/settle-later/unsettled` | Unsettled amounts by date/instrument |
| GET | `/settle-later/status` | Full monitoring status with alerts |
#### RFQ (Request for Quote)
| Method | Path | Description |
|--------|------|-------------|
| POST | `/rfq/request-quote` | Submit Request for Quote |
| POST | `/rfq/request-deal` | Execute deal from received quote |
#### FX Integration
When OTC is configured, `FxService.getMarketPrice()` automatically uses cached OTC prices when available. OTC prices are populated when quotes are received via WebSocket.
#### Database
- **Model:** `otc_trades` (Prisma)
- **Migration:** `npx prisma migrate dev --name add_otc_trades`
---
### Exchange Registry API
**Base Path:** `/api/v1/exchange`
**Purpose:** Unified price lookup with fallback across multiple exchange providers (Binance, Kraken, Oanda, FXCM). Optional OTC provider integration.
#### Endpoints
| Method | Path | Description |
|--------|------|-------------|
| GET | `/price` | Get market price for pair. Query: `pair` (e.g. BTC/USD), `amount` (optional) |
| GET | `/providers` | List enabled exchange providers |
#### Environment Variables (Optional)
| Variable | Required | Description |
|----------|----------|-------------|
| `OANDA_API_KEY` | Yes (for Oanda) | Oanda v20 API key |
| `OANDA_ACCOUNT_ID` | Yes (for Oanda) | Oanda account ID |
| `OANDA_ENVIRONMENT` | No | `practice` (default) or `live` |
| `FXCM_API_TOKEN` | Yes (for FXCM) | FXCM API token |
Binance and Kraken use public ticker APIs (no credentials required).
---
## Other DBIS Core APIs
### FX API
**Base Path:** `/api/fx`
- `POST /orders` - Submit FX order
- `GET /trades/:id` - Get FX trade by ID
### Ledger API
**Base Path:** `/api/ledger`
### Accounts API
**Base Path:** `/api/accounts`
### Payments API
**Base Path:** `/api/payments`
---
## Related Documentation
- [Crypto.com OTC Module](../../dbis_core/src/core/exchange/crypto-com-otc/README.md) - Module README
- [MASTER_SECRETS_INVENTORY.md](../04-configuration/MASTER_SECRETS_INVENTORY.md) - All exchange, ramp, DeFi credentials
- [RPC_ENDPOINTS_MASTER.md](../04-configuration/RPC_ENDPOINTS_MASTER.md) - Domain mappings for dbis-api.d-bis.org
- [INTEGRATIONS_QUICK_REFERENCE.md](../../INTEGRATIONS_QUICK_REFERENCE.md) - Integrations status