33618/backend/src/db/seeders/20231127130745-sample-data.js
2025-08-25 14:31:25 +00:00

147 lines
2.2 KiB
JavaScript

const db = require('../models');
const Users = db.users;
const Predictions = db.predictions;
const SentimentData = db.sentiment_data;
const StockHistory = db.stock_history;
const PredictionsData = [
{
symbol: 'AAPL',
date: new Date('2023-10-02T00:00:00Z'),
predicted_price: 174,
model_used: 'LSTM',
},
{
symbol: 'TSLA',
date: new Date('2023-10-02T00:00:00Z'),
predicted_price: 253,
model_used: 'XGBoost',
},
{
symbol: 'GOOG',
date: new Date('2023-10-02T00:00:00Z'),
predicted_price: 2820,
model_used: 'Transformer',
},
];
const SentimentDataData = [
{
symbol: 'AAPL',
date: new Date('2023-10-01T00:00:00Z'),
sentiment_score: 0.75,
news_headline: "Apple's new product launch boosts market confidence",
},
{
symbol: 'TSLA',
date: new Date('2023-10-01T00:00:00Z'),
sentiment_score: -0.2,
news_headline: 'Tesla faces production challenges amid supply chain issues',
},
{
symbol: 'GOOG',
date: new Date('2023-10-01T00:00:00Z'),
sentiment_score: 0.6,
news_headline: "Google's AI advancements impress industry experts",
},
];
const StockHistoryData = [
{
symbol: 'AAPL',
date: new Date('2023-10-01T00:00:00Z'),
open: 172.36,
high: 174.56,
low: 171.89,
close: 173.45,
volume: 75000000,
},
{
symbol: 'TSLA',
date: new Date('2023-10-01T00:00:00Z'),
open: 250.12,
high: 255,
low: 248.5,
close: 252.3,
volume: 50000000,
},
{
symbol: 'GOOG',
date: new Date('2023-10-01T00:00:00Z'),
open: 2800,
high: 2825,
low: 2790,
close: 2810,
volume: 3000000,
},
];
// Similar logic for "relation_many"
module.exports = {
up: async (queryInterface, Sequelize) => {
await Predictions.bulkCreate(PredictionsData);
await SentimentData.bulkCreate(SentimentDataData);
await StockHistory.bulkCreate(StockHistoryData);
await Promise.all([
// Similar logic for "relation_many"
]);
},
down: async (queryInterface, Sequelize) => {
await queryInterface.bulkDelete('predictions', null, {});
await queryInterface.bulkDelete('sentiment_data', null, {});
await queryInterface.bulkDelete('stock_history', null, {});
},
};