Skip to content

Commit

Permalink
feat: Add analysis table
Browse files Browse the repository at this point in the history
  • Loading branch information
Gowtham1729 committed Dec 11, 2023
1 parent fef8725 commit a74348c
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
3 changes: 2 additions & 1 deletion applications/backend/django_server/news/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.contrib import admin

from .models import News, Ticker
from .models import News, Ticker, Analysis

admin.site.register(News)
admin.site.register(Ticker)
admin.site.register(Analysis)
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Generated by Django 4.2.7 on 2023-12-11 12:52

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("news", "0004_alter_news_img_src_url_alter_news_src_url"),
]

operations = [
migrations.CreateModel(
name="Analysis",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("category", models.CharField(max_length=100)),
("symbol", models.CharField(max_length=100)),
("date", models.DateField()),
("average_sentiment", models.FloatField()),
("total_news", models.IntegerField()),
("positive_news", models.IntegerField()),
("negative_news", models.IntegerField()),
("need_attention", models.BooleanField()),
],
options={
"unique_together": {("symbol", "date")},
},
),
]
21 changes: 21 additions & 0 deletions applications/backend/django_server/news/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,24 @@ class Ticker(models.Model):

def __str__(self):
return self.ticker


class Analysis(models.Model):
category = models.CharField(max_length=100)
symbol = models.CharField(max_length=100)

date = models.DateField()
average_sentiment = models.FloatField()
total_news = models.IntegerField()

positive_news = models.IntegerField()
negative_news = models.IntegerField()

need_attention = models.BooleanField()

class Meta:
unique_together = ("symbol", "date")

def __str__(self):
return f"{self.symbol} - {self.date}"

0 comments on commit a74348c

Please sign in to comment.