Add external API server, configure fetch URLs, fix stats endpoint, update API config
This commit is contained in:
51
api-server.js
Normal file
51
api-server.js
Normal file
@ -0,0 +1,51 @@
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
|
||||
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
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/api/v1/stats', (req, res) => {
|
||||
res.json({
|
||||
change_24h: 2.5,
|
||||
high_24h: 28000,
|
||||
low_24h: 26500
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/api/v1/ta', (req, res) => {
|
||||
res.json({
|
||||
trend: { direction: 'up', signal: 'buy' },
|
||||
levels: {
|
||||
resistance: 28000,
|
||||
support: 26500,
|
||||
position_in_range: 60
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(PORT, HOST, () => {
|
||||
console.log(`API server listening on http://${HOST}:${PORT}`);
|
||||
});
|
||||
Reference in New Issue
Block a user