yeref 0.24.85__py3-none-any.whl → 0.24.87__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
yeref/yeref.py CHANGED
@@ -16558,7 +16558,70 @@ async def return_profit_and_loss_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P)
16558
16558
  sql = 'SELECT USER_TID, USER_VARS, USER_LSTS FROM "USER"'
16559
16559
  data_users = await db_select_pg(sql, (), BASE_P)
16560
16560
 
16561
- # Собираем MRR по месяцам
16561
+ months = ["2025-06", "2025-07", "2025-08", "2025-09"]
16562
+ data_users = []
16563
+ for _ in range(30):
16564
+ # дата входа
16565
+ entry_month = random.choice(months)
16566
+ entry_day = random.randint(1, 28)
16567
+ entry_date = f"{entry_month}-{entry_day:02}"
16568
+ entry_dt_obj = datetime.strptime(entry_date, '%Y-%m-%d')
16569
+ entry_dt = f"{entry_dt_obj.strftime('%d-%m-%Y')}_{datetime.now().strftime('%H-%M-%S')}"
16570
+ utm = random.choice(["/start", "/startapp"])
16571
+
16572
+ # месяцы от входа и дальше
16573
+ valid_months = [m for m in months if datetime.strptime(m + "-01", "%Y-%m-%d") >= entry_dt_obj.replace(day=1)]
16574
+ if not valid_months:
16575
+ valid_months = [entry_month]
16576
+
16577
+ user_mau = sorted(random.sample(valid_months, k=random.randint(1, len(valid_months))))
16578
+ user_dau_dates = set()
16579
+ txs, payments = [], []
16580
+
16581
+ # платеж
16582
+ if user_mau:
16583
+ pay_month = random.choice(user_mau)
16584
+ pay_day = random.randint(1, 28)
16585
+ pay_date = f"{pay_month}-{pay_day:02}"
16586
+ dt_pay = datetime.strptime(pay_date, "%Y-%m-%d")
16587
+ # if dt_pay >= entry_dt_obj:
16588
+ payments = [{
16589
+ "TYPE": random.choice(["don", "sub", "pst"]),
16590
+ "DT_START": f"{dt_pay.strftime('%d-%m-%Y')}_14-00-00",
16591
+ "DT_END": "0",
16592
+ "AMOUNT": str(random.randint(1, 10))
16593
+ }]
16594
+ user_dau_dates.add(pay_date)
16595
+
16596
+ # вход в приложение
16597
+ user_dau_dates.add(entry_date)
16598
+ for m in user_mau:
16599
+ day = random.randint(1, 28)
16600
+ visit = f"{m}-{day:02}"
16601
+ dt_visit = datetime.strptime(visit, "%Y-%m-%d")
16602
+ if dt_visit >= entry_dt_obj and random.random() < 0.7:
16603
+ user_dau_dates.add(visit)
16604
+
16605
+ # статусы (отток) с низкой вероятностью
16606
+ USER_STATUSES = []
16607
+ if random.random() < 0.2: # 10% шанс оттока
16608
+ churn_month = random.choice(valid_months)
16609
+ churn_day = random.randint(1, 28)
16610
+ churn_date = f"{churn_month}-{churn_day:02}"
16611
+ churn_ts = datetime.strptime(churn_date, "%Y-%m-%d").strftime("%d-%m-%Y") + "_23-59-59"
16612
+ USER_STATUSES = [{random.choice(["left", "kicked"]): churn_ts}]
16613
+
16614
+ user_dau = sorted(user_dau_dates)
16615
+ wallet = f"wallet{random.randint(1, 100)}" if txs else random.choice([f"wallet{random.randint(1, 100)}", ""])
16616
+
16617
+ data_users.append((
16618
+ random.randint(100000, 999999),
16619
+ json.dumps({"USER_WALLET": wallet, "USER_UTM": utm, "USER_DT": entry_dt}),
16620
+ json.dumps({"USER_DAU": user_dau, "USER_MAU": user_mau, "USER_TXS": txs,
16621
+ "USER_PAYMENTS": payments, "USER_STATUSES": USER_STATUSES})
16622
+ ))
16623
+ print(f"gen {data_users=}")
16624
+
16562
16625
  metrics = defaultdict(lambda: {"sum_amount": 0.0})
16563
16626
 
16564
16627
  for USER_TID, USER_VARS, USER_LSTS in data_users:
@@ -16604,12 +16667,12 @@ async def return_profit_and_loss_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P)
16604
16667
  fmt(NP)
16605
16668
  ])
16606
16669
 
16607
- path = os.path.join(EXTRA_D, "4_profit_and_loss_metrics.csv")
16670
+ path = os.path.join(EXTRA_D, "5_profit_and_loss_metrics.csv")
16608
16671
  with open(path, "w", newline="", encoding="utf-8") as f:
16609
16672
  writer = csv.writer(f)
16610
16673
  writer.writerow([
16611
- "Месяц", "Total MRR", "COGS", "Валовая прибыль",
16612
- "OPEX", "Операционная прибыль", "Комиссия (30%)", "Обмен (1%)", "Чистая прибыль"
16674
+ "Mo", "MRR", "COGS", "Gross Profit",
16675
+ "OPEX", "Operating Profit", "Comission (30%)", "Fiat (1%)", "Net Profit"
16613
16676
  ])
16614
16677
  for row in results:
16615
16678
  writer.writerow(row)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yeref
3
- Version: 0.24.85
3
+ Version: 0.24.87
4
4
  Summary: desc-f
5
5
  Author: john smith
6
6
  Dynamic: author
@@ -0,0 +1,8 @@
1
+ yeref/__init__.py,sha256=Qpv3o6Xa78VdLcsSRmctGtpnYE9btpAkCekgGhgJyXM,49
2
+ yeref/l_.py,sha256=LMX_olmJwq-tgoALJCnhV_fGrL_i_43yBLkLIcEVqGo,1176743
3
+ yeref/tonweb.js,sha256=Jf6aFOQ1OIY4q7fINYz-m5LsI3seMus124M5SYYZmtE,443659
4
+ yeref/yeref.py,sha256=H3xcQ_grp3RzRcbU9jAnOxnNoI0U1_OuJhnmHXrkdvw,1059621
5
+ yeref-0.24.87.dist-info/METADATA,sha256=32rpWU0-qM0VrE9uSeyIHq6XMdFLmtWkbLJY8FcndOg,119
6
+ yeref-0.24.87.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ yeref-0.24.87.dist-info/top_level.txt,sha256=yCQKchWHbfV-3OuQPYRdi2loypD-nmbDJbtt3OuKKkY,6
8
+ yeref-0.24.87.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- yeref/__init__.py,sha256=Qpv3o6Xa78VdLcsSRmctGtpnYE9btpAkCekgGhgJyXM,49
2
- yeref/l_.py,sha256=LMX_olmJwq-tgoALJCnhV_fGrL_i_43yBLkLIcEVqGo,1176743
3
- yeref/tonweb.js,sha256=Jf6aFOQ1OIY4q7fINYz-m5LsI3seMus124M5SYYZmtE,443659
4
- yeref/yeref.py,sha256=zAsIJKaySL8dAFA1wR9acEcc7RYu1Q5j6kq4Wh6Gjj4,1056664
5
- yeref-0.24.85.dist-info/METADATA,sha256=yd_8nv1OvhGLdGrKQAiJhPXHwEmB7Ss9UoRknv32HB0,119
6
- yeref-0.24.85.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
- yeref-0.24.85.dist-info/top_level.txt,sha256=yCQKchWHbfV-3OuQPYRdi2loypD-nmbDJbtt3OuKKkY,6
8
- yeref-0.24.85.dist-info/RECORD,,