Implement strategies and posting trades

This commit is contained in:
2022-10-27 18:08:40 +01:00
parent 7e4f3f52d1
commit 061c6f6ca7
32 changed files with 1060 additions and 178 deletions

View File

@@ -1,3 +1,6 @@
{% include 'partials/notify.html' %}
<h1 class="title is-4">List of accounts</h1>
<div class="buttons">
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
@@ -14,6 +17,5 @@
</button>
</div>
{% include 'partials/notify.html' %}
{% include 'partials/account-list.html' %}

View File

@@ -0,0 +1,31 @@
{% include 'partials/notify.html' %}
{% load crispy_forms_tags %}
{% load crispy_forms_bulma_field %}
<form
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
{% if strategy_id is not None %}
hx-put="{% url 'strategies_action' type=type strategy_id=strategy_id %}"
{% else %}
hx-put="{% url 'strategies_action' type=type %}"
{% endif %}
hx-target="#strategies-table"
hx-swap="outerHTML">
{% csrf_token %}
{{ form|crispy }}
<button
type="button"
class="button is-light modal-close-button">
Cancel
</button>
<button type="submit" class="button is-info modal-close-button">Submit</button>
</form>

View File

@@ -1,3 +1,6 @@
<h1 class="title is-5">Add or edit a trade</h1>
<h1 class="subtitle">Updates will be posted to exchange!</h1>
{% include 'partials/notify.html' %}
{% load crispy_forms_tags %}

View File

@@ -1,4 +1,5 @@
{% include 'partials/notify.html' %}
<h1 class="title is-4">List of received callbacks</h1>
<table class="table is-fullwidth is-hoverable" id="callbacks-table">
<thead>
@@ -11,8 +12,8 @@
<th>sent</th>
<th>trade</th>
<th>exchange</th>
<th>item</th>
<th>currency</th>
<th>symbol</th>
<th>price</th>
<th>contract</th>
<th>actions</th>
</thead>
@@ -31,12 +32,12 @@
<td>{{ item.title }}</td>
<td>{{ item.message }}</td>
<td>{{ item.period }}</td>
<td>{{ item.timestamp_sent }}</td>
<td>{{ item.timestamp_trade }}</td>
<td>{{ item.market_exchange }}</td>
<td>{{ item.market_item }}</td>
<td>{{ item.market_currency }}</td>
<td>{{ item.market_contract }}</td>
<td>{{ item.sent }}</td>
<td>{{ item.trade }}</td>
<td>{{ item.exchange }}</td>
<td>{{ item.symbol }}</td>
<td>{{ item.price }}</td>
<td>{{ item.contract }}</td>
<td>
<div class="buttons">

View File

@@ -1,3 +1,8 @@
{% include 'partials/notify.html' %}
<h1 class="title is-4">List of active URL endpoints for receiving hooks.</h1>
<h1 class="subtitle">Add URLs here to receive Drakdoo callbacks. Make then unique!</h1>
<h1 class="subtitle">Warning: hooks can only trade in one direction.</h1>
<div class="buttons">
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
@@ -14,6 +19,5 @@
</button>
</div>
{% include 'partials/notify.html' %}
{% include 'partials/hook-list.html' %}

View File

@@ -1,19 +1,6 @@
<div class="buttons">
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-get="#"
hx-trigger="click"
hx-target="#modals-here"
class="button is-info">
<span class="icon-text">
<span class="icon">
<i class="fa-solid fa-plus"></i>
</span>
<span>Trade</span>
</span>
</button>
</div>
<h1 class="title is-4">Live positions from all exchanges</h1>
<h1 class="subtitle">Manual trades are editable under "Bot Trades" tab.</h1>
{% include 'partials/notify.html' %}
{% include 'partials/position-list.html' %}
{% include 'partials/position-list.html' %}

View File

@@ -0,0 +1,21 @@
{% include 'partials/notify.html' %}
<h1 class="title is-4">List of strategies</h1>
<div class="buttons">
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-get="{% url 'strategies_action' type=type %}"
hx-trigger="click"
hx-target="#modals-here"
class="button is-info">
<span class="icon-text">
<span class="icon">
<i class="fa-solid fa-plus"></i>
</span>
<span>Strategy</span>
</span>
</button>
</div>
{% include 'partials/strategy-list.html' %}

View File

@@ -15,5 +15,9 @@
</div>
{% include 'partials/notify.html' %}
<h1 class="title is-4">List of bot and manual trades. This may not reflect actual live trades.</h1>
<h1 class="subtitle">Trades deleted here will not be closed on the exchange.</h1>
{% include 'partials/trade-list.html' %}

View File

@@ -0,0 +1,20 @@
{% include 'partials/notify.html' %}
<h1 class="title">Live information</h1>
<table class="table is-fullwidth is-hoverable">
<thead>
<th>attribute</th>
<th>value</th>
</thead>
<tbody>
{% for key, item in items.items %}
<tr>
<th>{{ key }}</th>
<td>
{% if item is not None %}
{{ item }}
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>