forked from ssantos21/cln-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
45 lines (37 loc) · 1.39 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import click
import total_fee_income
import swiss_pay_invoice
import stats
import event_earnings
@click.command(name='total-fee-income' )
@click.option('--hours', default=24, help='Number of hours to aggregate data for. Defaults to 24.')
def execute_total_fee_income(hours):
result = total_fee_income.execute(hours=hours)
# Print the result
for event_type, data in result.items():
click.echo(f"Type: {event_type}, Credit (msat): {data['credit_msat']}, "
f"Debit (msat): {data['debit_msat']}, Total (msat): {data['total']}")
@click.command(name='payment' )
@click.option('--hours', default=24, help='Number of hours of earnings to be paid. Default is 24.')
def payment(hours):
result = swiss_pay_invoice.execute(hours=hours)
print(result)
@click.command(name='stats' )
@click.option('--hours', default=24, help='Number of hours of stats. Default is 24.')
def execute_stats(hours):
result = stats.execute(hours=hours)
print(result)
@click.command(name='event-earnings' )
@click.option('--hours', default=24, help='Number of hours of events. Default is 24.')
def execute_event_earnings(hours):
result = event_earnings.execute(hours=hours)
print(result)
@click.group()
def cli():
pass
cli.add_command(execute_total_fee_income)
cli.add_command(payment)
cli.add_command(execute_stats)
cli.add_command(execute_event_earnings)
if __name__ == "__main__":
cli()