Source code for richy.coins.models

from django.core.cache import cache
from django.db import models
from django.utils.translation import gettext as _

from ..core.models import Item


[docs] class Coin(Item): item_type = Item.Type.COIN coin_id = models.CharField( _("Coin ID"), max_length=50, blank=True, null=True, unique=True ) def is_share(self): return False def is_index(self): return False def is_etf(self): return False def is_coin(self): return True
[docs] def update_cache(self): super().update_cache() from ..transactions.transactions import Performance cache.delete("coins-transaction-performance-and-assets") cache.delete("coins-transaction-profit-performance") Performance("coin", profit=False, use_cache=False).get_data() Performance("coin", profit=True, use_cache=False).get_data()