Browse Source

Merge branch 'feature/cherry-picked-to-master' of MQL-Development/market-data-service into master

muhammad.uzair 9 tháng trước cách đây
mục cha
commit
1c9e28cde4
2 tập tin đã thay đổi với 11 bổ sung7 xóa
  1. 6 5
      README.md
  2. 5 2
      schema.sql

+ 6 - 5
README.md

@@ -474,7 +474,7 @@ cp .env .env.backup
 cp ecosystem.config.js ecosystem.config.js.backup
 
 # Pull latest changes
-git pull origin main
+git pull origin master
 
 # Install any new dependencies
 npm install --production
@@ -506,7 +506,7 @@ sudo systemctl stop nginx
 
 # Update code
 git fetch origin
-git reset --hard origin/main
+git reset --hard origin/master
 
 # Install dependencies
 npm install --production
@@ -679,18 +679,19 @@ CORS_ORIGIN=*
 
 ### Symbols
 - `GET /api/symbols` - Get all symbols (with filtering)
-- `GET /api/symbols/search` - Search symbols by name
+- `GET /api/symbols/search?q=EURUSD` - Search symbols by name
 - `GET /api/symbols/:id` - Get symbol by ID
 - `POST /api/symbols` - Create new symbol
 - `PUT /api/symbols/:id` - Update symbol
 - `DELETE /api/symbols/:id` - Delete symbol (soft delete)
 
 ### Candles
-- `GET /api/candles` - Get candles with filtering
-- `GET /api/candles/ohlc` - Get OHLC data
+- `GET /api/candles?symbolId=1&startTime=2025-01-01T00:00:00Z&endTime=2025-01-02T00:00:00Z&limit=100&offset=0` - Get candles with filtering
+- `GET /api/candles/ohlc?symbolId=1&period=1h&limit=100` - Get OHLC data
 - `GET /api/candles/:symbolId/latest` - Get latest candle for symbol
 - `POST /api/candles` - Create new candle
 - `POST /api/candles/bulk` - Bulk create candles
+- `DELETE /api/candles/cleanup/:symbolId?keep=1000` - Clean up old candles, keep latest N (default 1000)
 
 ### Live Prices
 - `GET /api/live-prices` - Get all live prices

+ 5 - 2
schema.sql

@@ -29,7 +29,8 @@ CREATE TABLE candles_1h (
     volume NUMERIC(20,8),
     trades_count INT,
     quote_volume NUMERIC(20,8),
-    created_at TIMESTAMPTZ DEFAULT NOW()
+    created_at TIMESTAMPTZ DEFAULT NOW(),
+    updated_at TIMESTAMPTZ DEFAULT NOW()
 );
 
 CREATE UNIQUE INDEX idx_candles_symbol_time ON candles_1h(symbol_id, open_time);
@@ -44,7 +45,9 @@ CREATE TABLE live_prices (
     ask NUMERIC(18,8),
     bid_size NUMERIC(18,8),
     ask_size NUMERIC(18,8),
-    last_updated TIMESTAMPTZ DEFAULT NOW()
+    last_updated TIMESTAMPTZ DEFAULT NOW(),
+    created_at TIMESTAMPTZ DEFAULT NOW(),
+    updated_at TIMESTAMPTZ DEFAULT NOW()
 );
 
 CREATE INDEX idx_live_prices_price ON live_prices(price);