Documented the market system properly, squashed some bugs

This commit is contained in:
2022-11-11 07:20:00 +00:00
parent c3d908341a
commit afb0504dca
3 changed files with 163 additions and 38 deletions

View File

@@ -86,10 +86,7 @@ class Account(models.Model):
name += " (sandbox)"
return name
def save(self, *args, **kwargs):
"""
Override the save function to update supported symbols.
"""
def update_info(self, save=True):
client = self.get_client()
if client:
response = client.get_instruments()
@@ -99,6 +96,14 @@ class Account(models.Model):
self.supported_symbols = supported_symbols
self.instruments = response
self.currency = currency
if save:
self.save()
def save(self, *args, **kwargs):
"""
Override the save function to update supported symbols.
"""
self.update_info(save=False)
super().save(*args, **kwargs)
def get_client(self):