Begin implementing MEXC

This commit is contained in:
Mark Veidemanis 2024-12-03 14:12:42 +00:00
parent 761b084704
commit 4079207a05
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
6 changed files with 34 additions and 15 deletions

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
from core.lib.schemas import alpaca_s, drakdoo_s, oanda_s # noqa from core.lib.schemas import alpaca_s, drakdoo_s, oanda_s, mexc_s # noqa

View File

@ -0,0 +1 @@
from pydantic import BaseModel, Field

View File

@ -176,10 +176,12 @@ class Account(models.Model):
if client: if client:
response = client.get_instruments() response = client.get_instruments()
supported_symbols = client.get_supported_assets(response) supported_symbols = client.get_supported_assets(response)
currency = client.get_account()["currency"] acct_info = client.get_account()
log.debug(f"Supported symbols for {self.name}: {supported_symbols}") log.debug(f"Supported symbols for {self.name}: {supported_symbols}")
self.supported_symbols = supported_symbols self.supported_symbols = supported_symbols
self.instruments = response self.instruments = response
if "currency" in acct_info.keys():
currency = acct_info["currency"]
self.currency = currency self.currency = currency
if save: if save:
self.save() self.save()

View File

@ -311,7 +311,10 @@
{% endif %} {% endif %}
{% if user.is_authenticated %} {% if user.is_authenticated %}
<a class="button" href="{% url 'logout' %}">Logout</a> <form method="POST" action="{% url 'logout' %}" style="display:inline;">
{% csrf_token %}
<button type="submit" class="button">Logout</button>
</form>
{% endif %} {% endif %}
</div> </div>

View File

@ -30,7 +30,7 @@ class AccountInfo(LoginRequiredMixin, OTPRequiredMixin, ObjectRead):
"sandbox", "sandbox",
"supported_symbols", "supported_symbols",
"initial_balance", "initial_balance",
"instruments", #"instruments",
] ]
def get_object(self, **kwargs): def get_object(self, **kwargs):