From 328f4973ced1f992d19b968186817b5140a4bb3b Mon Sep 17 00:00:00 2001 From: luxagraf Date: Wed, 21 Jul 2021 16:35:13 -0400 Subject: trad: added price calulator --- app/trading/migrations/0014_luxtrade_notes_html.py | 18 ++++++ app/trading/models.py | 2 + app/trading/templates/trading/list.html | 64 +++++++++++++++++++--- 3 files changed, 76 insertions(+), 8 deletions(-) create mode 100644 app/trading/migrations/0014_luxtrade_notes_html.py (limited to 'app/trading') diff --git a/app/trading/migrations/0014_luxtrade_notes_html.py b/app/trading/migrations/0014_luxtrade_notes_html.py new file mode 100644 index 0000000..d73f404 --- /dev/null +++ b/app/trading/migrations/0014_luxtrade_notes_html.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.5 on 2021-07-21 15:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('trading', '0013_alter_luxoptionstrade_fees'), + ] + + operations = [ + migrations.AddField( + model_name='luxtrade', + name='notes_html', + field=models.TextField(blank=True, null=True), + ), + ] diff --git a/app/trading/models.py b/app/trading/models.py index 551a4de..40762db 100644 --- a/app/trading/models.py +++ b/app/trading/models.py @@ -124,6 +124,7 @@ class LuxTrade(models.Model): ) status = models.IntegerField(choices=STATUS, default=2) notes = models.TextField(null=True, blank=True) + notes_html = models.TextField(null=True, blank=True) is_wanderer = models.BooleanField(default=True) pl = models.FloatField(null=True) @@ -181,6 +182,7 @@ class LuxTrade(models.Model): self.close_date = timezone.now() if self.status == 1 and not self.pl: self.pl = round((self.close_price*self.shares)-(self.entry_price*self.shares), 2) + self.notes_html = markdown_to_html(self.notes) super(LuxTrade, self).save() diff --git a/app/trading/templates/trading/list.html b/app/trading/templates/trading/list.html index ac735e3..539ba49 100644 --- a/app/trading/templates/trading/list.html +++ b/app/trading/templates/trading/list.html @@ -32,8 +32,16 @@ ${{object.goal_dollars}} {{object.goal_percent}} {{object.risk_reward}} - - {{object.notes}} + + + + + {% if object.notes %} +
+ {{object.notes_html|safe}} +
+ {% endif %} + {% endfor %} @@ -53,12 +61,13 @@ $ Goal % Goal Risk/Reward + Price Calc Notes {% for object in watch_trades %} - {{object.symbol}} + {{object.symbol}} {{object.date|date:"m-d-Y"}} ${{object.entry_price}} ${{object.stop_price}} @@ -69,8 +78,16 @@ ${{object.goal_dollars}} {{object.goal_percent}} {{object.risk_reward}} - - {{object.notes}} + + + + + {% if object.notes %} +
+ {{object.notes_html|safe}} +
+ {% endif %} + {% endfor %} @@ -119,8 +136,14 @@ ${{object.risk_total}} ${{object.profit_goal}} {{object.risk_reward}} - - {{object.notes}} + + + {% if object.notes %} +
+ {{object.notes_html|safe}} +
+ {% endif %} + {% endfor %} @@ -161,7 +184,13 @@ ${{object.goal_dollars}} ${{object.realized_dollars}} {{object.realized_percent}} - {{object.notes}} + + {% if object.notes %} +
+ {{object.notes_html|safe}} +
+ {% endif %} + {% endfor %} @@ -182,3 +211,22 @@ {% endblock %} + + + {% block js %} + + + {% endblock %} -- cgit v1.2.3-70-g09d2