2022-03-19 16:33:01 +00:00
|
|
|
from django.db import models
|
|
|
|
from django.utils import timezone
|
|
|
|
|
|
|
|
class AccountingDay(models.Model):
|
|
|
|
day = models.DateTimeField(primary_key=True, auto_now=False, auto_now_add=False)
|
|
|
|
|
|
|
|
# Every field is denominated in Sats with (3 decimals for millisats)
|
|
|
|
# Total volume contracted
|
|
|
|
contracted = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
2022-03-20 23:32:25 +00:00
|
|
|
# Number of contracts
|
|
|
|
num_contracts = models.BigIntegerField(default=0, null=False, blank=False)
|
2022-03-19 16:33:01 +00:00
|
|
|
# Net volume of trading invoices settled (excludes disputes)
|
|
|
|
net_settled = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
|
|
|
# Net volume of trading invoices paid (excludes rewards and disputes)
|
|
|
|
net_paid = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
|
|
|
# Sum of net settled and net paid
|
|
|
|
net_balance = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
|
|
|
# Total volume of invoices settled
|
2022-03-20 23:32:25 +00:00
|
|
|
inflow = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
2022-03-19 16:33:01 +00:00
|
|
|
# Total volume of invoices paid
|
2022-03-20 23:32:25 +00:00
|
|
|
outflow = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
2022-03-19 16:33:01 +00:00
|
|
|
# Total cost in routing fees
|
2022-03-20 23:32:25 +00:00
|
|
|
routing_fees = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
2022-03-19 16:33:01 +00:00
|
|
|
# Total inflows minus outflows and routing fees
|
2022-03-20 23:32:25 +00:00
|
|
|
cashflow = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
|
|
|
# Balance on earned rewards (referral rewards, slashed bonds and solved disputes)
|
|
|
|
outstanding_earned_rewards = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
2022-03-19 16:33:01 +00:00
|
|
|
# Balance on pending disputes (not resolved yet)
|
2022-03-20 23:32:25 +00:00
|
|
|
outstanding_pending_disputes = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
|
|
|
# Rewards claimed lifetime
|
|
|
|
lifetime_rewards_claimed = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
|
|
|
# Balance change from last day on earned rewards (referral rewards, slashed bonds and solved disputes)
|
|
|
|
earned_rewards = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
|
|
|
# Balance change on pending disputes (not resolved yet)
|
2022-03-21 12:13:57 +00:00
|
|
|
disputes = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
2022-03-20 23:32:25 +00:00
|
|
|
# Rewards claimed on day
|
|
|
|
rewards_claimed = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
|
|
|
|
2022-03-19 16:33:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
class AccountingMonth(models.Model):
|
|
|
|
month = models.DateTimeField(primary_key=True, auto_now=False, auto_now_add=False)
|
|
|
|
|
|
|
|
# Every field is denominated in Sats with (3 decimals for millisats)
|
|
|
|
# Total volume contracted
|
|
|
|
contracted = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
2022-03-20 23:32:25 +00:00
|
|
|
# Number of contracts
|
|
|
|
num_contracts = models.BigIntegerField(default=0, null=False, blank=False)
|
2022-03-19 16:33:01 +00:00
|
|
|
# Net volume of trading invoices settled (excludes disputes)
|
|
|
|
net_settled = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
|
|
|
# Net volume of trading invoices paid (excludes rewards and disputes)
|
|
|
|
net_paid = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
|
|
|
# Sum of net settled and net paid
|
|
|
|
net_balance = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
|
|
|
# Total volume of invoices settled
|
2022-03-20 23:32:25 +00:00
|
|
|
inflow = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
2022-03-19 16:33:01 +00:00
|
|
|
# Total volume of invoices paid
|
2022-03-20 23:32:25 +00:00
|
|
|
outflow = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
2022-03-19 16:33:01 +00:00
|
|
|
# Total cost in routing fees
|
2022-03-20 23:32:25 +00:00
|
|
|
routing_fees = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
2022-03-19 16:33:01 +00:00
|
|
|
# Total inflows minus outflows and routing fees
|
2022-03-20 23:32:25 +00:00
|
|
|
cashflow = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
|
|
|
# Balance on earned rewards (referral rewards, slashed bonds and solved disputes)
|
|
|
|
outstanding_earned_rewards = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
2022-03-19 16:33:01 +00:00
|
|
|
# Balance on pending disputes (not resolved yet)
|
2022-03-20 23:32:25 +00:00
|
|
|
outstanding_pending_disputes = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
|
|
|
# Rewards claimed lifetime
|
|
|
|
lifetime_rewards_claimed = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
|
|
|
# Balance change from last day on earned rewards (referral rewards, slashed bonds and solved disputes)
|
|
|
|
earned_rewards = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
|
|
|
# Balance change on pending disputes (not resolved yet)
|
2022-03-19 16:33:01 +00:00
|
|
|
pending_disputes = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
2022-03-20 23:32:25 +00:00
|
|
|
# Rewards claimed on day
|
|
|
|
rewards_claimed = models.DecimalField(max_digits=15, decimal_places=3, default=0, null=False, blank=False)
|
2022-03-19 16:33:01 +00:00
|
|
|
|
|
|
|
class Dispute(models.Model):
|
|
|
|
pass
|