Vim�UnDo��~����(e����n~�����Q߄"&^A�K_�&����]���('    SupportMinerService.update_wallets(5�_�����^A�C�        bitcoin.usd_value,5�_�����^A�D�'=from apscheduler.schedulers.blocking import BlockingScheduler	import osimport logging
import djangodjango.setup()Efrom coinmine.worker.support_miner.service import SupportMinerService%from coinmine.coin.models import Coin,from coinmine.user.models import UserProfile8logger = logging.getLogger("worker.support_miner.clock")scheduler = BlockingScheduler()Spolling_interval_secs = int(os.getenv("SUPPORT_MINER_POLLING_INTERVAL_SECS", 1800))def job(polling_interval_secs):W    logger.info("Support Miner Polling Interval {} secs".format(polling_interval_secs))2    logger.info("Running Support Miner Worker...")    default_fee = float(        os.getenv(U            "FEE_PERCENTAGE_DECIMAL", UserProfile.lookup_fee(UserProfile.GENERAL_FEE)	        )    )0    bitcoin = Coin.objects.get(short_name="btc")'    SupportMinerService.update_credits(.        SupportMinerService.filtered_miners(),        polling_interval_secs,        default_fee,    )# scheduler.add_job(R#    lambda: job(polling_interval_secs), "interval", seconds=polling_interval_secs# )# scheduler.start()5�_�����^A�F�0    bitcoin = Coin.objects.get(short_name="btc")5�_�����^A�G�5�_�����^A�J�%from coinmine.coin.models import Coin5��
VimŸUnDoх‰o‘з RЭSїЉ“ѓГ3Mž€>Š*G–hђпся-$;                "coin_short_name": coin.short_name.upper(),#YYYY^rTJ$_аџџџџ^ORѕѕ5_аџџџџ^ORѕ5_а
џџџџ^OUѕ	Kclass SupportMinerReport:5_а
џџџџ^OWѕ	K
class Report:5_аџџџџ^OrѕKѕK5_аџџџџ^OuѕP/            MineOSMiner.objects.select_related(5_аAџџџџ^OwѕPA            .filter(config__wallet__coin__short_name__in=["btc"])5_а	џџџџ^OzѕS                "status", "config", "config__wallet", "owner", "owner__userprofile"5_а
	џџџџ^O{ѕ
            )5_а	
3џџџџ^O|ѕN3            len(MineOSMiner.objects.select_related(5_а
$џџџџ^OѕN$            len(MineOSMiner.objects.5_а
џџџџ^O‚ѕN#            len(MineOSMiner.objects5_а
џџџџ^O‡ѕB        return len(SupportMiner.objects.filter(wallet__coin=coin))5_а
џџџџ^O‹ѕM from django.db.models import Sumfrom decimal import Decimal0from coinmine.devices.models import SupportMiner<from coinmine.balance_adjustment.models.credit import Credit,from coinmine.user.models import UserProfile.from coinmine.worker.utils import ServiceUtilsclass BTCModeReport:3    def __init__(self, accumulated_period_seconds):#        self.service = ServiceUtilsD        self.accumulated_period_seconds = accumulated_period_seconds&    def _get_miners_count(self, coin):&        return len(MineOSMiner.objects             .exclude(owner=None)B            .filter(config__wallet__coin__short_name__in=["btc"]))'    def _get_total_credits(self, coin):        return (T            Credit.objects.filter(coin=coin, support_miner__isnull=False).aggregate(/                Sum("amount_in_smallest_units").            )["amount_in_smallest_units__sum"]            or Decimal(0)        ) * coin.smallest_unit+    def _get_total_credits_usd(self, coin):=        return self._get_total_credits(coin) * coin.usd_value&    def _get_coin_per_day(self, coin):         return coin.coin_per_day%    def _get_usd_per_day(self, coin):1        return coin.coin_per_day * coin.usd_value@    def _get_tier_rates(self, coin, accumulated_period_seconds):         rate = coin.coin_per_day        result = {}0        for fee in UserProfile.USER_FEE_CHOICES:            fee_id = fee[0]            fee_rate = fee[1]3            fee_name = UserProfile.fee_name(fee_id)T            units_earned_per_second = self.service.adjusted_units_earned_per_second(2                rate, coin.smallest_unit, fee_rate
            )O            units_earned = units_earned_per_second * accumulated_period_seconds@            coin_earned = self.service.smallest_unit_to_decimal(0                units_earned, coin.smallest_unit
            )5            usd_earned = coin_earned * coin.usd_value             result[fee_name] = {%                "fee_rate": fee_rate,+                "coin_earned": coin_earned,)                "usd_earned": usd_earned,
            }        return result    def generate(self, coins):G        report = {"accounting_period": self.accumulated_period_seconds}        for coin in coins:!            report[coin.name] = {<                "miner_count": self._get_miners_count(coin),,                "usd_value": coin.usd_value,3                "coin_short_name": coin.short_name,?                "total_credits": self._get_total_credits(coin),G                "total_credits_usd": self._get_total_credits_usd(coin),=                "coin_per_day": self._get_coin_per_day(coin),;                "usd_per_day": self._get_usd_per_day(coin),3                "tier_rates": self._get_tier_rates(9                    coin, self.accumulated_period_seconds                ),
            }        return report5_а0џџџџ^O˜ѕO0from coinmine.devices.models import SupportMiner5_аџџџџ^OЄѕOfrom coinmine.5_а%џџџџ^OГѕO3from coinmine.mineosminer.models imoprt MineOSMiner5_а$џџџџ^OЗѕO4from coinmine.mineosminer.models imoport MineOSMiner5_а<џџџџ^OМѕO<                config__wallet__coin__short_name__in=["btc"]5_аџџџџ
 V
^O<	ѕ+    def _get_total_credits_usd(self, coin):=        return self._get_total_credits(coin) * coin.usd_value5_аDџџџџDEV^OL
ѕCD?                "total_credits": self._get_total_credits(coin),G                "total_credits_usd": self._get_total_credits_usd(coin),5_а%џџџџDDV^OЌѕ$&J         rate = coin.coin_per_day5_а%џџџџDDV^Oѕ%'K        ѕ%'J5_а&џџџџEEV^O;ѕ%&        smallest_units = 5_а1џџџџDDV^Oѕ
J3    def __init__(self, accumulated_period_seconds):5_а
CџџџџDDV^Oѕ
K        ѕ
J5_а)џџџџEEV^O$ѕKѕK5_аџџџџFFV^O'ѕL*        self.btc_usd_value = btc_usd_value5_аџџџџFFV^O'ѕL!        self.btc_ = btc_usd_value5_а %џџџџFFV^O,ѕL.        self.btc_smallest_unit = btc_usd_value5_а! 2џџџџFFV^O-ѕL;        self.btc_smallest_unit = btc_smallest_unitusd_value5_а "!0џџџџFFV^Owѕ/1L2                rate, coin.smallest_unit, fee_rate5_а!#"0џџџџFFV^Oxѕ/1L                 rate, , fee_rate5_а"$#4џџџџFFV^Oѕ35L0                units_earned, coin.smallest_unit5_а#%$4џџџџFFV^Oѕ35L                units_earned, 5_а$&%6'џџџџFFV^O”ѕ57L5            usd_earned = coin_earned * coin.usd_value5_а%'&6&џџџџFFV^O”
ѕ57L'            usd_earned = coin_earned * 5_а&('!џџџџFFV^O ѕ "L         return coin.coin_per_day5_а')(џџџџV^O %ѕ'    def _get_total_credits(self, coin):        return (T            Credit.objects.filter(coin=coin, support_miner__isnull=False).aggregate(/                Sum("amount_in_smallest_units").            )["amount_in_smallest_units__sum"]            or Decimal(0)        ) * coin.smallest_unit5_а(*)џџџџV^O &ѕ5_а)+*џџџџV^O -ѕ from django.db.models import Sumfrom decimal import Decimal5_а*,+џџџџV^O /ѕ<from coinmine.balance_adjustment.models.credit import Credit5_а+-,: џџџџV^PUѕ9;@=                "coin_per_day": self._get_coin_per_day(coin),5_а,.-:!џџџџV^PVѕ9;@'                "coin_per_day": (coin),5_а-0.:%џџџџV^PXѕ9;@&                "coin_per_day": coin),5_а.1/0;џџџџV^Peѕ:<@;                "usd_per_day": self._get_usd_per_day(coin),ѕ;<@5_а021;AџџџџV^Pfѕ:<@]                "usd_per_day": coin.coin_per_day * coin.usd_valueself._get_usd_per_day(coin),5_а132џџџџV^Pjѕ&    def _get_coin_per_day(self, coin):        return coin.btc_per_day%    def _get_usd_per_day(self, coin):1        return coin.coin_per_day * coin.usd_value5_а243џџџџV^Plѕ5_а354,џџџџ,:V^P lѕ+,    def generate(self, coins):G        report = {"accounting_period": self.accumulated_period_seconds}        for coin in coins:!            report[coin.name] = {<                "miner_count": self._get_miners_count(coin),,                "usd_value": coin.usd_value,3                "coin_short_name": coin.short_name,2                "coin_per_day": coin.coin_per_day,B                "usd_per_day": coin.coin_per_day * coin.usd_value,3                "tier_rates": self._get_tier_rates(9                    coin, self.accumulated_period_seconds                ),
            }        return report5_а465џџџџ,,V^P oѕ+ѕ+5_а576)џџџџ*)v)^P"(ѕ:2                "coin_per_day": coin.coin_per_day,5_а687(џџџџ*)v)^P";ѕ:B                "usd_per_day": coin.coin_per_day * coin.usd_value,5_а7982џџџџ*)v)^P"Eѕ:A                "usd_per_day": coin.btc_per_day * coin.usd_value,5_а8:92џџџџ*)v)^P"Eѕ:2                "usd_per_day": coin.btc_per_day * 5_а9<:Dџџџџ*)v)^P"Lѕ:D                "usd_per_day": coin.btc_per_day * self.btc_usd_value5_а:=;<#"џџџџ3&39v9^P& ѕ"$:@    def _get_tier_rates(self, coin, accumulated_period_seconds):5_а<>=#+џџџџ3&39v9^P&"ѕ"$:H    def _get_tier_rates(self, coin_per_day, accumulated_period_seconds):5_а=?>#Nџџџџ3&39v9^P&/ѕ:3from coinmine.mineosminer.models import MineOSMiner,from coinmine.user.models import UserProfile.from coinmine.worker.utils import ServiceUtilsclass BTCModeReport:U    def __init__(self, accumulated_period_seconds, btc_usd_value, btc_smallest_unit):#        self.service = ServiceUtilsD        self.accumulated_period_seconds = accumulated_period_seconds*        self.btc_usd_value = btc_usd_value2        self.btc_smallest_unit = btc_smallest_unit    def generate(self, coins):G        report = {"accounting_period": self.accumulated_period_seconds}        for coin in coins:!            report[coin.name] = {<                "miner_count": self._get_miners_count(coin),,                "usd_value": coin.usd_value,3                "coin_short_name": coin.short_name,1                "coin_per_day": coin.btc_per_day,E                "usd_per_day": coin.btc_per_day * self.btc_usd_value,3                "tier_rates": self._get_tier_rates(9                    coin, self.accumulated_period_seconds                ),
            }        return report&    def _get_miners_count(self, coin):        return len(;            MineOSMiner.objects.exclude(owner=None).filter(X                config__wallet__coin__short_name__in=["btc"], config__btc_mode_coin=coin
            )	        )l    def _get_tier_rates(self, coin_per_day, coin_smallest_unit, coin_usd_value, accumulated_period_seconds):        rate = coin.btc_per_day        result = {}0        for fee in UserProfile.USER_FEE_CHOICES:            fee_id = fee[0]            fee_rate = fee[1]3            fee_name = UserProfile.fee_name(fee_id)T            units_earned_per_second = self.service.adjusted_units_earned_per_second(6                rate, self.btc_smallest_unit, fee_rate
            )O            units_earned = units_earned_per_second * accumulated_period_seconds@            coin_earned = self.service.smallest_unit_to_decimal(4                units_earned, self.btc_smallest_unit
            )9            usd_earned = coin_earned * self.btc_usd_value             result[fee_name] = {%                "fee_rate": fee_rate,+                "coin_earned": coin_earned,)                "usd_earned": usd_earned,
            }        return result5_а>@?*џџџџ&9v9^P&:ѕ)*        rate = coin.btc_per_day5_а?A@2џџџџ&9v9^P&<ѕ13?6                rate, self.btc_smallest_unit, fee_rate5_а@BA2џџџџ&9v9^P&Aѕ13?>                coin_per_day, self.btc_smallest_unit, fee_rate5_аACB2џџџџ&9v9^P&Bѕ13?(                coin_per_day, , fee_rate5_аBDC6џџџџ&9v9^P&Kѕ57?4                units_earned, self.btc_smallest_unit5_аCGD6џџџџ&9v9^P&Lѕ57?                units_earned, 5_аDHEG8'џџџџ&9v9^P&Zѕ79?9            usd_earned = coin_earned * self.btc_usd_value5_аGIH8'џџџџ&9v9^P&Zѕ79?'            usd_earned = coin_earned * 5_аHJI"џџџџ"?V^P&kѕ!"    def _get_tier_rates(
        self,        coin_per_day,        coin_smallest_unit,        coin_usd_value,#        accumulated_period_seconds,    ):        result = {}0        for fee in UserProfile.USER_FEE_CHOICES:            fee_id = fee[0]            fee_rate = fee[1]3            fee_name = UserProfile.fee_name(fee_id)T            units_earned_per_second = self.service.adjusted_units_earned_per_second(:                coin_per_day, coin_smallest_unit, fee_rate
            )O            units_earned = units_earned_per_second * accumulated_period_seconds@            coin_earned = self.service.smallest_unit_to_decimal(0                units_earned, coin_smallest_unit
VimЯUnDoеВU>Kњж.w`±ЋDzљЯють.Й} ]Иџ=@3•й     def run(self, coin, period):
^s«@_–¤¤¤¤^s∆Яхх5Б_–¤¤¤¤^s∆ћх    def __init__(self, coin)5Б_–¤¤¤¤^s∆”х        х5Б_–¤¤¤¤^s∆№х    def run(self)5Б_–¤¤¤¤^s∆Ёхх5Б_–¤¤¤¤^s∆ях5Б_–¤¤¤¤^s∆вх1        coin = Coin.objects.get(short_name="hns")5Б_–	@¤¤¤¤^s∆дхW        logger.info("Running {} Accounting ({} secs)...".format(coin.name, hns_period))5Б_–
	¤¤¤¤^s∆их    def run(self):5Б_–	
¤¤¤¤V^s∆ух    def __init__(self, coin):        self.coin = coin5Б_–
¤¤¤¤V^s∆хх    def run(self, period):5Б_–
D¤¤¤¤V^s∆ъх\        logger.info("Running {} Accounting ({} secs)...".format(self.coin.name, hns_period))5Б_–
A¤¤¤¤V^s∆ыхX        logger.info("Running {} Accounting ({} secs)...".format(.coin.name, hns_period))5Б_–
?¤¤¤¤V^s∆ыхclass BaseCoinAccounting:     def run(self,coin,  period):W        logger.info("Running {} Accounting ({} secs)...".format(coin.name, hns_period)).        CoinAccountingService.update_balances(8            CoinAccountingService.filtered_miners(coin),            coin.coin_per_day,            hns_period,C            float(UserProfile.lookup_fee(UserProfile.GENERAL_FEE)),	        )5Б_–¤¤¤¤V^s«х
х
5Б_–¤¤¤¤V^s«х5Б_–¤¤¤¤V^s«хх5Б_–¤¤¤¤V^s«х
5Б_–¤¤¤¤V^s«х,from celery.utils.log import get_task_logger"logger = get_task_logger(__name__)class BaseCoinAccounting:     def run(self, coin, period):W        logger.info("Running {} Accounting ({} secs)...".format(coin.name, hns_period)).        CoinAccountingService.update_balances(8            CoinAccountingService.filtered_miners(coin),            coin.coin_per_day,            hns_period,C            float(UserProfile.lookup_fee(UserProfile.GENERAL_FEE)),	        )5Б_–O¤¤¤¤V^s«х	W        logger.info("Running {} Accounting ({} secs)...".format(coin.name, hns_period))5Б_–
¤¤¤¤V^s«х            hns_period,5Б_–¤¤¤¤V^s«&ххх5Б_–¤¤¤¤V^s«+хх5Б_–
¤¤¤¤V^s«?х	     def run(self, coin, period):5Б_–
¤¤¤¤V^s«?х,from celery.utils.log import get_task_logger,from coinmine.user.models import UserProfileCfrom coinmine.accounting.services.coin import CoinAccountingService"logger = get_task_logger(__name__)class BaseCoinAccounting:    def run( coin, period):S        logger.info("Running {} Accounting ({} secs)...".format(coin.name, period)).        CoinAccountingService.update_balances(8            CoinAccountingService.filtered_miners(coin),            coin.coin_per_day,            period,C            float(UserProfile.lookup_fee(UserProfile.GENERAL_FEE)),	        )5Бз™
Vim�UnDo�]�Vԉ����ɬ	��t��(X����^j�\�!^P&g_�����^P��5�_�����^P��    �5�_�����^P��9    def _get_tier_rates(self, accumulated_period_seconds)5�_�G����^P��G    def _get_tier_rates(self, coin_per_day, accumulated_period_seconds)5�_�*����^P��H    def _get_tier_rates(self, coin_per_day, accumulated_period_seconds):5�_�!����^P���5�_�����^P��class BaseReport:@    def _get_tier_rates(self, coin, accumulated_period_seconds):%        rate = self.coin.coin_per_day        result = {}0        for fee in UserProfile.USER_FEE_CHOICES:            fee_id = fee[0]            fee_rate = fee[1]3            fee_name = UserProfile.fee_name(fee_id)T            units_earned_per_second = self.service.adjusted_units_earned_per_second(7                rate, self.coin.smallest_unit, fee_rate
            )O            units_earned = units_earned_per_second * accumulated_period_seconds@            coin_earned = self.service.smallest_unit_to_decimal(5                units_earned, self.coin.smallest_unit
            ):            usd_earned = coin_earned * self.coin.usd_value             result[fee_name] = {%                "fee_rate": fee_rate,+                "coin_earned": coin_earned,)                "usd_earned": usd_earned,
            }        return result5�_�	����^P��%        rate = self.coin.coin_per_day5�_�
	����^P��
7                rate, self.coin.smallest_unit, fee_rate5�_�	
'����^P��:            usd_earned = coin_earned * self.coin.usd_value5�_�
����^P��5                units_earned, self.coin.smallest_unit5�_�
����^P���5�_�
����^P��5�_�
����^P��,from coinmine.user.models import UserProfileclass BaseReport:@    def _get_tier_rates(self, coin, accumulated_period_seconds):         rate = coin.coin_per_day        result = {}0        for fee in UserProfile.USER_FEE_CHOICES:            fee_id = fee[0]            fee_rate = fee[1]3            fee_name = UserProfile.fee_name(fee_id)T            units_earned_per_second = self.service.adjusted_units_earned_per_second(2                rate, coin.smallest_unit, fee_rate
            )O            units_earned = units_earned_per_second * accumulated_period_seconds@            coin_earned = self.service.smallest_unit_to_decimal(0                units_earned, coin.smallest_unit
            )5            usd_earned = coin_earned * coin.usd_value             result[fee_name] = {%                "fee_rate": fee_rate,+                "coin_earned": coin_earned,)                "usd_earned": usd_earned,
            }        return result5�_�����'5v<^P&b�"�5�_�"����"9V^P&f�!"@    def _get_tier_rates(self, coin, accumulated_period_seconds):         rate = coin.coin_per_day        result = {}0        for fee in UserProfile.USER_FEE_CHOICES:            fee_id = fee[0]            fee_rate = fee[1]3            fee_name = UserProfile.fee_name(fee_id)T            units_earned_per_second = self.service.adjusted_units_earned_per_second(2                rate, coin.smallest_unit, fee_rate
            )O            units_earned = units_earned_per_second * accumulated_period_seconds@            coin_earned = self.service.smallest_unit_to_decimal(0                units_earned, coin.smallest_unit
            )5            usd_earned = coin_earned * coin.usd_value             result[fee_name] = {%                "fee_rate": fee_rate,+                "coin_earned": coin_earned,)                "usd_earned": usd_earned,
            }        return result5��
Example #5
0
Vim�UnDo�a���;�U�to��xaK;Ptg���Ǭz8�����^t�L_�����^s���
5�_�����^s����5�_�����^s���
6period = settings.SUPPORT_MINER_ACCOUNTING_PERIOD_SECS5�_�����^s����
5�_�����^s���;hns_period = accounting_configuration.handshake_period_secs5�_�	����^s���
6period = settings.SUPPORT_MINER_ACCOUNTING_PERIOD_SECS5�_�		����^s���
	period = 5�_�
	:����^s���	�5�_�	
����^s���+from celery.decorators import periodic_task,from celery.utils.log import get_task_loggerfrom datetime import timedelta from django.conf import settings,from coinmine.user.models import UserProfileTfrom coinmine.accounting.services.support_miner import SupportMinerAccountingService>from coinmine.accounting.models import AccountingConfiguration"logger = get_task_logger(__name__)=accounting_configuration = AccountingConfiguration.get_solo();period = accounting_configuration.support_miner_period_secsT@periodic_task(run_every=timedelta(seconds=period), name="accounting.support_miner")def support_miner_accounting():O    logger.info("Running Support Miner Accounting ({} secs)...".format(period))1    SupportMinerAccountingService.update_credits(8        SupportMinerAccountingService.filtered_miners(),        period,?        float(UserProfile.lookup_fee(UserProfile.GENERAL_FEE)),    )5�_�
����^s��� from django.conf import settings5�_�
����^t�7�
�
�
5�_�
����66V6^t�8�
7 period = settings.SUPPORT_MINER_ACCOUNTING_PERIOD_SECS5�_�

����66V6^t�9�
;period = accounting_configuration.support_miner_period_secs5�_�����66V6^t�A��5�_�����
6
6V6^t�J�=accounting_configuration = AccountingConfiguration.get_solo()5�_�����66V6^t�K�>from coinmine.accounting.models import AccountingConfiguration5�_�����^s���� from django.conf import settings5��
Example #6
0
Vim�UnDo�"#LfO�][脛��6�����%���d�@4((((^N�k_�3����33 v ^�w�23"        btc_mode_coin.btc_per_day,5�_�����V^���%    btc_mode_coin = Coin.objects.get(;        name__iexact=os.getenv("BTC_MODE_COIN", "ethereum")    )5�_�����V^���C    sats_general = BTCModeService._adjusted_sats_earned_per_second(F        btc_mode_coin.btc_per_day, btc_coin.smallest_unit, general_fee    )C    sats_founder = BTCModeService._adjusted_sats_earned_per_second(F        btc_mode_coin.btc_per_day, btc_coin.smallest_unit, founder_fee    )5�_�����#V^���	    logger.info(        "current_payout "H        "coin={} period_secs={} sats_founder={} sats_general={}".format(%            btc_mode_coin.short_name,"            polling_interval_secs,1            sats_founder * polling_interval_secs,1            sats_general * polling_interval_secs,	        )    )5�_�����V^���5�_�����V^���A    founder_fee = UserProfile.lookup_fee(UserProfile.FOUNDER_FEE)5�_�	����^���"'�'�&5�_�
	����^���/5�_�	
����^���1�05�_�
����^���2    �15�_�
����$V^���%2	    logger.info(        "current_payout "H        "coin={} period_secs={} sats_founder={} sats_general={}".format(%            btc_mode_coin.short_name,"            polling_interval_secs,1            sats_founder * polling_interval_secs,1            sats_general * polling_interval_secs,	        )    )5�_�
����$V^��	� 2)                btc_mode_coin.short_name,5�_�
����$V^���3�3�25�_�����V^��
�8B   sats_general = BTCModeService._adjusted_sats_earned_per_second(5�_�����V^���85�_�����V^��C    sats_general = BTCModeService._adjusted_sats_earned_per_second(F        btc_mode_coin.btc_per_day, btc_coin.smallest_unit, general_fee    )C    sats_founder = BTCModeService._adjusted_sats_earned_per_second(F        btc_mode_coin.btc_per_day, btc_coin.smallest_unit, founder_fee    )5�_�����V^��$4�4�35�_�����#V^��$:C    sats_general = BTCModeService._adjusted_sats_earned_per_second(F        btc_mode_coin.btc_per_day, btc_coin.smallest_unit, general_fee    )C    sats_founder = BTCModeService._adjusted_sats_earned_per_second(F        btc_mode_coin.btc_per_day, btc_coin.smallest_unit, founder_fee    )5�_�����#V^��5�_�����"V^��9J            btc_mode_coin.btc_per_day, btc_coin.smallest_unit, general_fee5�_�����"V^��9H            c_mode_coin.btc_per_day, btc_coin.smallest_unit, general_fee5�_�!����"V^�� "9J            btc_mode_coin.btc_per_day, btc_coin.smallest_unit, founder_fee5�_�!����"V^�� "9H            c_mode_coin.btc_per_day, btc_coin.smallest_unit, founder_fee5�_�!����"V^�� "9A            coin.btc_per_day, btc_coin.smallest_unit, founder_fee5�_�!����"V^�� "9?            coin.btc_per_day, c_coin.smallest_unit, founder_fee5�_�����"V^��9A            coin.btc_per_day, btc_coin.smallest_unit, general_fee5�_�����"V^��9?            coin.btc_per_day, c_coin.smallest_unit, general_fee5�_�����"V^��9=from apscheduler.schedulers.blocking import BlockingScheduler	import osimport logging
import djangodjango.setup();from coinmine.worker.btc_mode.service import BTCModeService%from coinmine.coin.models import Coin,from coinmine.user.models import UserProfile3logger = logging.getLogger("worker.btc_mode.clock")scheduler = BlockingScheduler()Npolling_interval_secs = int(os.getenv("BTC_MODE_POLLING_INTERVAL_SECS", 1800))def job(polling_interval_secs):R    logger.info("BTC Mode Polling Interval {} secs".format(polling_interval_secs))-    logger.info("Running BTC Mode Worker...")A    general_fee = UserProfile.lookup_fee(UserProfile.GENERAL_FEE)I    default_fee = float(os.getenv("FEE_PERCENTAGE_DECIMAL", general_fee))1    btc_coin = Coin.objects.get(short_name="btc")    coins = Coin.objects.all()    for coin in coins:G        sats_general = BTCModeService._adjusted_sats_earned_per_second(=            coin.btc_per_day, coin.smallest_unit, general_fee	        )G        sats_founder = BTCModeService._adjusted_sats_earned_per_second(=            coin.btc_per_day, coin.smallest_unit, founder_fee	        )        logger.info(            "current_payout "L            "coin={} period_secs={} sats_founder={} sats_general={}".format(                 coin.short_name,&                polling_interval_secs,5                sats_founder * polling_interval_secs,5                sats_general * polling_interval_secs,
            )	        )"    BTCModeService.update_wallets()        BTCModeService.filtered_miners(),        btc_coin.usd_value,        btc_coin.smallest_unit,        polling_interval_secs,        default_fee,    )# scheduler.add_job(R#    lambda: job(polling_interval_secs), "interval", seconds=polling_interval_secs# )# scheduler.start()5�_�����V^��9�9�85�_� ����AAVA^� 
�9B     founder_fee = UserProfile.lookup_fee(UserProfile.FOUNDER_FEE)5�_�" ����^��9=            coin.btc_per_day, coin.smallest_unit, general_fee5�_� #!"!����^�� "9=            coin.btc_per_day, coin.smallest_unit, founder_fee5�_�"$#&����^Aд�9G        sats_general = BTCModeService._adjusted_sats_earned_per_second(5�_�#%$3����^Aж�9F        sats_general = BTCModeService.adjusted_sats_earned_per_second(5�_�$&% 4����^Aи�!9G        sats_founder = BTCModeService._adjusted_sats_earned_per_second(5�_�%'& &����^Aй�!9H        sats_founder = BTCModeService._adjusted_units_earned_per_second(5�_�&('����3V^N�j�3=from apscheduler.schedulers.blocking import BlockingScheduler	import osimport logging
import djangodjango.setup();from coinmine.worker.btc_mode.service import BTCModeService%from coinmine.coin.models import Coin,from coinmine.user.models import UserProfile3logger = logging.getLogger("worker.btc_mode.clock")scheduler = BlockingScheduler()Npolling_interval_secs = int(os.getenv("BTC_MODE_POLLING_INTERVAL_SECS", 1800))def job(polling_interval_secs):R    logger.info("BTC Mode Polling Interval {} secs".format(polling_interval_secs))-    logger.info("Running BTC Mode Worker...")A    general_fee = UserProfile.lookup_fee(UserProfile.GENERAL_FEE)I    default_fee = float(os.getenv("FEE_PERCENTAGE_DECIMAL", general_fee))A    founder_fee = UserProfile.lookup_fee(UserProfile.FOUNDER_FEE)1    btc_coin = Coin.objects.get(short_name="btc")    coins = Coin.objects.all()    for coin in coins:G        sats_general = BTCModeService.adjusted_units_earned_per_second(A            coin.btc_per_day, btc_coin.smallest_unit, general_fee	        )G        sats_founder = BTCModeService.adjusted_units_earned_per_second(A            coin.btc_per_day, btc_coin.smallest_unit, founder_fee	        )        logger.info(            "current_payout "L            "coin={} period_secs={} sats_founder={} sats_general={}".format(                 coin.short_name,&                polling_interval_secs,5                sats_founder * polling_interval_secs,5                sats_general * polling_interval_secs,
            )	        )"    BTCModeService.update_wallets()        BTCModeService.filtered_miners(),        btc_coin.usd_value,        btc_coin.smallest_unit,        polling_interval_secs,        default_fee,    )5�_�'(����V^N�j�# scheduler.add_job(R#    lambda: job(polling_interval_secs), "interval", seconds=polling_interval_secs# )# scheduler.start()5�_� "!!����^�� "9A            coin.btc_per_day, cbtc_oin.smallest_unit, founder_fee5�_�����V^Ū�5��
Example #7
0
Vim�UnDo���8�ƀ'q����Vؚvdw
’"@�d�
7w�9W    logger.info("Support Miner Polling Interval {} secs".format(polling_interval_secs))@AAAA^D<�_�����V^C�E�import logging5�_�	����V^C�G�	'�	
'5�_�����V^C�K�=from apscheduler.schedulers.blocking import BlockingScheduler	import os
import django5�_�����V^C�K�5�_�����V^C�L�django.setup()5�_�����V^C�O�#Efrom coinmine.worker.support_miner.service import SupportMinerService5�_�����V^C�T�#Ofrom coinmine.devices.services.support_miner.service import SupportMinerService5�_�	����V^C�W�#Bfrom coinmine.devices.services..service import SupportMinerService5�_�
	����V^C�X�#:from coinmine.devices.services. import SupportMinerService5�_�	
2����V^C�\�#9from coinmine.devices.services import SupportMinerService5�_�
;����V^C�^�#Cfrom coinmine.devices.services import SupportMinerAccountingService%from coinmine.coin.models import Coin,from coinmine.user.models import UserProfileimport logging8logger = logging.getLogger("worker.support_miner.clock")scheduler = BlockingScheduler()Spolling_interval_secs = int(os.getenv("SUPPORT_MINER_POLLING_INTERVAL_SECS", 1800))def job(polling_interval_secs):W    logger.info("Support Miner Polling Interval {} secs".format(polling_interval_secs))2    logger.info("Running Support Miner Worker...")    default_fee = float(        os.getenv(U            "FEE_PERCENTAGE_DECIMAL", UserProfile.lookup_fee(UserProfile.GENERAL_FEE)	        )    )0    bitcoin = Coin.objects.get(short_name="btc")'    SupportMinerService.update_credits(.        SupportMinerService.filtered_miners(),        bitcoin.usd_value,        polling_interval_secs,        default_fee,    )# scheduler.add_job(R#    lambda: job(polling_interval_secs), "interval", seconds=polling_interval_secs# )# scheduler.start()5�_�
����V^C�e�$'    SupportMinerService.update_credits(5�_�
����V^C�h�        bitcoin.usd_value,5�_�
����V^C�h�#Cfrom coinmine.devices.services import SupportMinerAccountingService%from coinmine.coin.models import Coin,from coinmine.user.models import UserProfileimport logging8logger = logging.getLogger("worker.support_miner.clock")scheduler = BlockingScheduler()Spolling_interval_secs = int(os.getenv("SUPPORT_MINER_POLLING_INTERVAL_SECS", 1800))def job(polling_interval_secs):W    logger.info("Support Miner Polling Interval {} secs".format(polling_interval_secs))2    logger.info("Running Support Miner Worker...")    default_fee = float(        os.getenv(U            "FEE_PERCENTAGE_DECIMAL", UserProfile.lookup_fee(UserProfile.GENERAL_FEE)	        )    )0    bitcoin = Coin.objects.get(short_name="btc")1    SupportMinerAccountingService.update_credits(.        SupportMinerService.filtered_miners(),        polling_interval_secs,        default_fee,    )# scheduler.add_job(R#    lambda: job(polling_interval_secs), "interval", seconds=polling_interval_secs# )# scheduler.start()5�_�����!V^C�k�# scheduler.add_job(R#    lambda: job(polling_interval_secs), "interval", seconds=polling_interval_secs# )# scheduler.start()5�_�����V^C�m�0    bitcoin = Coin.objects.get(short_name="btc")5�_�����V^C�n�Cfrom coinmine.devices.services import SupportMinerAccountingService%from coinmine.coin.models import Coin,from coinmine.user.models import UserProfileimport logging8logger = logging.getLogger("worker.support_miner.clock")scheduler = BlockingScheduler()Spolling_interval_secs = int(os.getenv("SUPPORT_MINER_POLLING_INTERVAL_SECS", 1800))def job(polling_interval_secs):W    logger.info("Support Miner Polling Interval {} secs".format(polling_interval_secs))2    logger.info("Running Support Miner Worker...")    default_fee = float(        os.getenv(U            "FEE_PERCENTAGE_DECIMAL", UserProfile.lookup_fee(UserProfile.GENERAL_FEE)	        )    )1    SupportMinerAccountingService.update_credits(Q        SupportMinerService.filtered_miners(), polling_interval_secs, default_fee    )5�_�����V^C�}�%from coinmine.coin.models import Coin5�_�����V^C��,from coinmine.user.models import UserProfile5�_�����V^C����5�_�����V^C���scheduler = BlockingScheduler()5�_�����V^C����5�_�����V^C���5�_�����V^C���import logging5�_�����V^C��	��5�_�����V^C����
5�_�����  V^C��
�def job(polling_interval_secs):5�_�����  V^C����5�_� ����""V^C���)from celery.task.schedules import crontab5�_�! ����!!V^C��� � 5�_� "!&����""V^C��
!Spolling_interval_secs = int(os.getenv("SUPPORT_MINER_POLLING_INTERVAL_SECS", 1800))5�_�!#""����""V^C�	�
!Npolling_interval_secs = settings."SUPPORT_MINER_POLLING_INTERVAL_SECS", 1800))5�_�"$#M����""V^C�

�
!Mpolling_interval_secs = settings.SUPPORT_MINER_POLLING_INTERVAL_SECS", 1800))5�_�#%$
����""V^C�)�!;    run_every=crontab(hour=0, minute=10, day_of_month="1"),�!5�_�$&%2����""V^C�*�!_    run_every=timedelta(seconds=accounting_period)crontab(hour=0, minute=10, day_of_month="1"),5�_�%'&3����""V^C�0�!Q    run_every=timedelta(seconds=accounting_period), minute=10, day_of_month="1"),5�_�&)'.����2.V2^C�2�.    # execute on the first day of every month.B    # after the interests calculation, prepping for the next month5�_�'+()����2.V2^C�;��5�_�),*+	����2.V2^C�B� %    name="create_balanced_snapshots",� 5�_�+-,'����2.V2^C�C� B    name="update_support_miner_balancescreate_balanced_snapshots",5�_�,.-'����2.V2^C�D� import loggingfrom datetime import timedelta from django.conf import settings)from celery.task.schedules import crontab+from celery.decorators import periodic_task,from coinmine.user.models import UserProfileCfrom coinmine.devices.services import SupportMinerAccountingService8logger = logging.getLogger("worker.support_miner.clock")Dpolling_interval_secs = settings.SUPPORT_MINER_POLLING_INTERVAL_SECS@periodic_task(3    run_every=timedelta(seconds=accounting_period),)    name="update_support_miner_balances",)9def update_support_miner_balances(polling_interval_secs):W    logger.info("Support Miner Polling Interval {} secs".format(polling_interval_secs))2    logger.info("Running Support Miner Worker...")    default_fee = float(        os.getenv(U            "FEE_PERCENTAGE_DECIMAL", UserProfile.lookup_fee(UserProfile.GENERAL_FEE)	        )    )1    SupportMinerAccountingService.update_credits(Q        SupportMinerService.filtered_miners(), polling_interval_secs, default_fee    )5�_�-/.
����2.V2^C�L�Dpolling_interval_secs = settings.SUPPORT_MINER_POLLING_INTERVAL_SECS5�_�.0/
����2.V2^C�M�/ = settings.SUPPORT_MINER_POLLING_INTERVAL_SECS5�_�/10����2.V2^C�U�)from celery.task.schedules import crontab5�_�021����2.V2^C�c�        os.getenv(5�_�132����2.V2^C�e�U            "FEE_PERCENTAGE_DECIMAL", UserProfile.lookup_fee(UserProfile.GENERAL_FEE)5�_�243����2.V2^C�g�	        )5�_�354����2.V2^C�g�import loggingfrom datetime import timedelta from django.conf import settings+from celery.decorators import periodic_task,from coinmine.user.models import UserProfileCfrom coinmine.devices.services import SupportMinerAccountingService8logger = logging.getLogger("worker.support_miner.clock")@accounting_period = settings.SUPPORT_MINER_POLLING_INTERVAL_SECS@periodic_task(X    run_every=timedelta(seconds=accounting_period), name="update_support_miner_balances")9def update_support_miner_balances(polling_interval_secs):W    logger.info("Support Miner Polling Interval {} secs".format(polling_interval_secs))2    logger.info("Running Support Miner Worker...")    default_fee = float(;            UserProfile.lookup_fee(UserProfile.GENERAL_FEE)    )1    SupportMinerAccountingService.update_credits(Q        SupportMinerService.filtered_miners(), polling_interval_secs, default_fee    )5�_�465/����2.V2^C�v�Q        SupportMinerService.filtered_miners(), polling_interval_secs, default_fee5�_�576/����2.V2^C�w�<        SupportMinerService.filtered_miners(), , default_fee5�_�687����2.V2^C���M        SupportMinerService.filtered_miners(), accounting_period, default_fee5�_�798����2.V2^C���    �5�_�8:9����2.V2^C���
    miners = �5�_�9;:����2.V2^C���(        , accounting_period, default_fee5�_�:<;
����2.V2^C���import loggingfrom datetime import timedelta from django.conf import settings+from celery.decorators import periodic_task,from coinmine.user.models import UserProfileCfrom coinmine.devices.services import SupportMinerAccountingService8logger = logging.getLogger("worker.support_miner.clock")@accounting_period = settings.SUPPORT_MINER_POLLING_INTERVAL_SECS@periodic_task(X    run_every=timedelta(seconds=accounting_period), name="update_support_miner_balances")9def update_support_miner_balances(polling_interval_secs):W    logger.info("Support Miner Polling Interval {} secs".format(polling_interval_secs))2    logger.info("Running Support Miner Worker...")H    default_fee = float(UserProfile.lookup_fee(UserProfile.GENERAL_FEE))2    miners = SupportMinerService.filtered_miners()1    SupportMinerAccountingService.update_credits(.        miners, accounting_period, default_fee    )5�_�;=<����2.V2^C���2    miners = SupportMinerService.filtered_miners()5�_�<?=����2.V2^C���4    miners = SupportMinerAcService.filtered_miners()5�_�=@>?"����^D<��9def update_support_miner_balances(polling_interval_secs):5�_�?A@@����^D<��W    logger.info("Support Miner Polling Interval {} secs".format(polling_interval_secs))5�_�@A@����^D<��B    logger.info("Support Miner Polling Interval {} secs".format())5�_�=?>����^D8
�
accounting_period = settings.5�_�)+*����2.V2^C�@� def (polling_interval_secs):5�_�')(����2.V2^C�:��from datetime import timedelta5�_�����V^C����,from coinmine.user.models import UserProfile5�_�����V^C�o�5��