Update interval list to include 148m and extend mock API to return sample 148m candle

This commit is contained in:
DiTus
2026-03-18 22:22:04 +01:00
parent 15881b7db8
commit 1b6e307a79
2 changed files with 34 additions and 21 deletions

View File

@ -5,26 +5,39 @@ const PORT = 8000;
const HOST = '20.20.20.20';
app.get('/api/v1/candles', (req, res) => {
res.json({
candles: [
{
time: Math.floor(Date.now() / 1000) - 86400,
open: 27000,
high: 27500,
low: 26900,
close: 27300,
volume: 1000
},
{
time: Math.floor(Date.now() / 1000) - 75600,
open: 27300,
high: 27800,
low: 27200,
close: 27700,
volume: 1200
}
]
});
const { interval } = req.query;
// Return mock candle data; include a sample for 148m interval
const mockCandles = [
{
time: Math.floor(Date.now() / 1000) - 86400,
open: 27000,
high: 27500,
low: 26900,
close: 27300,
volume: 1000
},
{
time: Math.floor(Date.now() / 1000) - 75600,
open: 27300,
high: 27800,
low: 27200,
close: 27700,
volume: 1200
}
];
// For demonstration, add a dummy 148m candle if requested
if (interval === '148m') {
mockCandles.push({
time: Math.floor(Date.now() / 1000) - 64800, // example older candle
open: 27200,
high: 27600,
low: 27000,
close: 27400,
volume: 1100
});
}
res.json({ candles: mockCandles });
});
});
app.get('/api/v1/stats', (req, res) => {