Begin adding order settings

This commit is contained in:
2023-02-15 18:33:38 +00:00
parent 1974b19157
commit 660aca44db
11 changed files with 220 additions and 19 deletions

View File

@@ -248,6 +248,9 @@
<a class="navbar-item" href="{% url 'strategies' type='page' %}">
Strategies
</a>
<a class="navbar-item" href="{% url 'ordersettings' type='page' %}">
Order Settings
</a>
<a class="navbar-item" href="{% url 'signals' type='page' %}">
Signals
</a>

View File

@@ -24,7 +24,7 @@
<td>{{ item.id }}</td>
<td>{{ item.user }}</td>
<td>{{ item.name }}</td>
<td>{{ item.description }}</td>
<td>{{ item.description|truncatechars:80 }}</td>
<td>
<a
href="{% url 'assetrules' type='page' group=item.id %}">

View File

@@ -0,0 +1,69 @@
{% load cache %}
{% load cachalot cache %}
{% get_last_invalidation 'core.OrderSettings' as last %}
{% include 'mixins/partials/notify.html' %}
{% cache 600 objects_ordersettings request.user.id object_list type last %}
<table
class="table is-fullwidth is-hoverable"
hx-target="#{{ context_object_name }}-table"
id="{{ context_object_name }}-table"
hx-swap="outerHTML"
hx-trigger="{{ context_object_name_singular }}Event from:body"
hx-get="{{ list_url }}">
<thead>
<th>id</th>
<th>user</th>
<th>name</th>
<th>description</th>
<th>TP</th>
<th>SL</th>
<th>TSL</th>
<th>size</th>
<th>actions</th>
</thead>
{% for item in object_list %}
<tr>
<td>{{ item.id }}</td>
<td>{{ item.user }}</td>
<td>{{ item.name }}</td>
<td>{{ item.description|truncatechars:80 }}</td>
<td>{{ item.take_profit_percent}}</td>
<td>{{ item.stop_loss_percent }}</td>
<td>{{ item.trailing_stop_loss_percent }}</td>
<td>{{ item.trade_size_percent }}</td>
<td>
<div class="buttons">
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-get="{% url 'ordersettings_update' type=type pk=item.id %}"
hx-trigger="click"
hx-target="#{{ type }}s-here"
hx-swap="innerHTML"
class="button">
<span class="icon-text">
<span class="icon">
<i class="fa-solid fa-pencil"></i>
</span>
</span>
</button>
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-delete="{% url 'ordersettings_delete' type=type pk=item.id %}"
hx-trigger="click"
hx-target="#modals-here"
hx-swap="innerHTML"
hx-confirm="Are you sure you wish to delete {{ item.name }}?"
class="button">
<span class="icon-text">
<span class="icon">
<i class="fa-solid fa-xmark"></i>
</span>
</span>
</button>
</div>
</td>
</tr>
{% endfor %}
</table>
{% endcache %}

View File

@@ -16,8 +16,6 @@
<th>description</th>
<th>account</th>
<th>enabled</th>
<th>TP</th>
<th>SL</th>
<th>actions</th>
</thead>
{% for item in object_list %}
@@ -37,8 +35,6 @@
</span>
{% endif %}
</td>
<td>{{ item.take_profit_percent }}</td>
<td>{{ item.stop_loss_percent }}</td>
<td>
<div class="buttons">
<button

View File

@@ -24,7 +24,7 @@
<td>{{ item.id }}</td>
<td>{{ item.user }}</td>
<td>{{ item.name }}</td>
<td>{{ item.description }}</td>
<td>{{ item.description|truncatechars:80 }}</td>
<td>{{ item.get_start_day_display }} at {{ item.start_time }}</td>
<td>{{ item.get_end_day_display }} at {{ item.end_time }}</td>
<td>