fix(api): add GET /api/charts/[id] and fix batch prediction
- Add GET handler to /api/charts/[id] route to fetch chart metadata - Fix batch prediction to use regular /predict endpoint with database candles - Remove /predict/batch usage (was designed for file-based predictions) - Make volume field optional in CandleData model (database candles don't have volume) - Convert timestamps to ISO dates for batch requests Known issue: TA-Lib indicators failing with 'input array type is not double' - May need to ensure candle data is float64/double type before processing
This commit is contained in:
parent
6d0d67e39b
commit
f850728d44
4 changed files with 24 additions and 10 deletions
|
|
@ -512,18 +512,12 @@ export default function Home() {
|
|||
throw new Error('No candles found for this chart');
|
||||
}
|
||||
|
||||
const startTime = candlesData[0].time;
|
||||
const endTime = candlesData[candlesData.length - 1].time;
|
||||
|
||||
// Make batch prediction request
|
||||
const response = await fetch('/api/predict/batch', {
|
||||
// Use regular predict endpoint with all candles from the database
|
||||
const response = await fetch('/api/predict', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
pair: chartData.name,
|
||||
timeframe: '1h', // TODO: Get from chart metadata
|
||||
start_time: startTime,
|
||||
end_time: endTime,
|
||||
candles: candlesData,
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue