2022-07-19 07:07:26 +02:00
|
|
|
#! /usr/bin/make
|
|
|
|
|
|
|
|
BOOKKEEPER_PLUGIN_SRC := \
|
2022-07-19 07:09:26 +02:00
|
|
|
plugins/bkpr/account.c \
|
2022-07-19 09:34:35 +02:00
|
|
|
plugins/bkpr/account_entry.c \
|
2022-07-19 07:07:26 +02:00
|
|
|
plugins/bkpr/bookkeeper.c \
|
2022-07-19 09:34:37 +02:00
|
|
|
plugins/bkpr/chain_event.c \
|
2022-07-19 09:34:35 +02:00
|
|
|
plugins/bkpr/channel_event.c \
|
bkpr: command to calculate some APYs/stats on channel routing fees
Computes some stats from the net routed fees etc
```
{
"channel_apys": [
{
"account": "7de277250f8003c35378c1eb20aacf8fa6a69dd4bb22077266329a9ad812cd5d",
"routed_out": "2000msat",
"routed_in": "125100101msat",
"lease_fee_paid": "0msat",
"lease_fee_earned": "670000msat",
"pushed_out": "0msat",
"pushed_in": "0msat",
"our_start_balance": "100670000msat",
"channel_start_balance": "1100670000msat",
"fees_out": "0msat",
"fees_in": "10100101msat",
"utilization_out": "0.0002%",
"utilization_out_initial": "0.0020%",
"utilization_in": "11.3658%",
"utilization_in_initial": "12.5100%",
"apy_out": "0.0000%",
"apy_out_initial": "0.0000%",
"apy_in": "3203.3924%",
"apy_in_initial": "3525.8779%",
"apy_total": "3203.3924%",
"apy_total_initial": "3203.3924%",
"apy_lease": "8.7014%"
},
{
"account": "b71937a02eb7694d946c311297ca2da454057c5c3e97ac67500739cc2afbc0c5",
"routed_out": "110000000msat",
"routed_in": "0msat",
"lease_fee_paid": "670000msat",
"lease_fee_earned": "0msat",
"pushed_out": "0msat",
"pushed_in": "0msat",
"our_start_balance": "4000000000msat",
"channel_start_balance": "4100670000msat",
"fees_out": "10100101msat",
"fees_in": "0msat",
"utilization_out": "2.6825%",
"utilization_out_initial": "2.7500%",
"utilization_in": "0.0000%",
"utilization_in_initial": "0.0000%",
"apy_out": "2579.4892%",
"apy_out_initial": "2644.4084%",
"apy_in": "0.0000%",
"apy_in_initial": "0.0000%",
"apy_total": "2579.4892%",
"apy_total_initial": "2579.4892%"
},
{
"account": "net",
"routed_out": "110002000msat",
"routed_in": "125100101msat",
"lease_fee_paid": "670000msat",
"lease_fee_earned": "670000msat",
"pushed_out": "0msat",
"pushed_in": "0msat",
"our_start_balance": "4100670000msat",
"channel_start_balance": "5201340000msat",
"fees_out": "10100101msat",
"fees_in": "10100101msat",
"utilization_out": "2.1149%",
"utilization_out_initial": "2.6825%",
"utilization_in": "2.4052%",
"utilization_in_initial": "11.3658%",
"apy_out": "677.8788%",
"apy_out_initial": "859.8297%",
"apy_in": "677.8788%",
"apy_in_initial": "3203.3924%",
"apy_total": "1355.7575%",
"apy_total_initial": "1355.7575%",
"apy_lease": "0.2122%"
}
]
}
```
2022-07-19 09:34:37 +02:00
|
|
|
plugins/bkpr/channelsapy.c \
|
2022-07-19 07:09:26 +02:00
|
|
|
plugins/bkpr/db.c \
|
2022-07-19 09:34:37 +02:00
|
|
|
plugins/bkpr/incomestmt.c \
|
2022-07-19 09:34:37 +02:00
|
|
|
plugins/bkpr/onchain_fee.c \
|
2022-07-19 07:09:26 +02:00
|
|
|
plugins/bkpr/recorder.c
|
2022-07-19 07:07:26 +02:00
|
|
|
|
|
|
|
BOOKKEEPER_DB_QUERIES := \
|
|
|
|
plugins/bkpr/db_sqlite3_sqlgen.c \
|
|
|
|
plugins/bkpr/db_postgres_sqlgen.c
|
|
|
|
|
|
|
|
BOOKKEEPER_SRC := $(BOOKKEEPER_PLUGIN_SRC) $(BOOKKEEPER_DB_QUERIES)
|
2022-07-19 07:09:26 +02:00
|
|
|
BOOKKEEPER_HEADER := \
|
|
|
|
plugins/bkpr/account.h \
|
2022-07-19 09:34:35 +02:00
|
|
|
plugins/bkpr/account_entry.h \
|
2022-07-19 07:09:26 +02:00
|
|
|
plugins/bkpr/chain_event.h \
|
|
|
|
plugins/bkpr/channel_event.h \
|
bkpr: command to calculate some APYs/stats on channel routing fees
Computes some stats from the net routed fees etc
```
{
"channel_apys": [
{
"account": "7de277250f8003c35378c1eb20aacf8fa6a69dd4bb22077266329a9ad812cd5d",
"routed_out": "2000msat",
"routed_in": "125100101msat",
"lease_fee_paid": "0msat",
"lease_fee_earned": "670000msat",
"pushed_out": "0msat",
"pushed_in": "0msat",
"our_start_balance": "100670000msat",
"channel_start_balance": "1100670000msat",
"fees_out": "0msat",
"fees_in": "10100101msat",
"utilization_out": "0.0002%",
"utilization_out_initial": "0.0020%",
"utilization_in": "11.3658%",
"utilization_in_initial": "12.5100%",
"apy_out": "0.0000%",
"apy_out_initial": "0.0000%",
"apy_in": "3203.3924%",
"apy_in_initial": "3525.8779%",
"apy_total": "3203.3924%",
"apy_total_initial": "3203.3924%",
"apy_lease": "8.7014%"
},
{
"account": "b71937a02eb7694d946c311297ca2da454057c5c3e97ac67500739cc2afbc0c5",
"routed_out": "110000000msat",
"routed_in": "0msat",
"lease_fee_paid": "670000msat",
"lease_fee_earned": "0msat",
"pushed_out": "0msat",
"pushed_in": "0msat",
"our_start_balance": "4000000000msat",
"channel_start_balance": "4100670000msat",
"fees_out": "10100101msat",
"fees_in": "0msat",
"utilization_out": "2.6825%",
"utilization_out_initial": "2.7500%",
"utilization_in": "0.0000%",
"utilization_in_initial": "0.0000%",
"apy_out": "2579.4892%",
"apy_out_initial": "2644.4084%",
"apy_in": "0.0000%",
"apy_in_initial": "0.0000%",
"apy_total": "2579.4892%",
"apy_total_initial": "2579.4892%"
},
{
"account": "net",
"routed_out": "110002000msat",
"routed_in": "125100101msat",
"lease_fee_paid": "670000msat",
"lease_fee_earned": "670000msat",
"pushed_out": "0msat",
"pushed_in": "0msat",
"our_start_balance": "4100670000msat",
"channel_start_balance": "5201340000msat",
"fees_out": "10100101msat",
"fees_in": "10100101msat",
"utilization_out": "2.1149%",
"utilization_out_initial": "2.6825%",
"utilization_in": "2.4052%",
"utilization_in_initial": "11.3658%",
"apy_out": "677.8788%",
"apy_out_initial": "859.8297%",
"apy_in": "677.8788%",
"apy_in_initial": "3203.3924%",
"apy_total": "1355.7575%",
"apy_total_initial": "1355.7575%",
"apy_lease": "0.2122%"
}
]
}
```
2022-07-19 09:34:37 +02:00
|
|
|
plugins/bkpr/channelsapy.h \
|
2022-07-19 07:09:26 +02:00
|
|
|
plugins/bkpr/db.h \
|
2022-07-19 09:34:37 +02:00
|
|
|
plugins/bkpr/incomestmt.h \
|
2022-07-19 07:09:26 +02:00
|
|
|
plugins/bkpr/onchain_fee.h \
|
|
|
|
plugins/bkpr/recorder.h
|
|
|
|
|
2022-07-19 07:07:26 +02:00
|
|
|
BOOKKEEPER_OBJS := $(BOOKKEEPER_SRC:.c=.o)
|
|
|
|
|
|
|
|
$(BOOKKEEPER_OBJS): $(PLUGIN_LIB_HEADER) $(BOOKKEEPER_HEADER)
|
|
|
|
|
2022-07-19 07:56:04 +02:00
|
|
|
PLUGIN_ALL_SRC += $(BOOKKEEPER_SRC) $(BOOKKEEPER_DB_QUERIES)
|
|
|
|
PLUGIN_ALL_HEADER += $(BOOKKEEPER_HEADER)
|
|
|
|
C_PLUGINS += plugins/bookkeeper
|
|
|
|
PLUGINS += plugins/bookkeeper
|
2022-07-19 07:07:26 +02:00
|
|
|
|
|
|
|
plugins/bookkeeper: bitcoin/chainparams.o common/coin_mvt.o $(BOOKKEEPER_OBJS) $(PLUGIN_LIB_OBJS) $(JSMN_OBJTS) $(PLUGIN_COMMON_OBJS) $(WIRE_OBJS) $(DB_OBJS)
|
|
|
|
|
|
|
|
# The following files contain SQL-annotated statements that we need to extact
|
|
|
|
BOOKKEEPER_SQL_FILES := \
|
|
|
|
$(DB_SQL_FILES) \
|
2022-07-19 07:09:26 +02:00
|
|
|
plugins/bkpr/db.c \
|
2022-07-19 09:34:37 +02:00
|
|
|
plugins/bkpr/incomestmt.c \
|
2022-07-19 07:09:26 +02:00
|
|
|
plugins/bkpr/recorder.c
|
2022-07-19 07:07:26 +02:00
|
|
|
|
|
|
|
plugins/bkpr/statements_gettextgen.po: $(BOOKKEEPER_SQL_FILES) $(FORCE)
|
|
|
|
@if $(call SHA256STAMP_CHANGED_ALL); then \
|
|
|
|
$(call VERBOSE,"xgettext $@",xgettext -kNAMED_SQL -kSQL --add-location --no-wrap --omit-header -o $@ $(BOOKKEEPER_SQL_FILES) && $(call SHA256STAMP_ALL,# ,)); \
|
|
|
|
fi
|
|
|
|
|
|
|
|
plugins/bkpr/db_%_sqlgen.c: plugins/bkpr/statements_gettextgen.po devtools/sql-rewrite.py $(BOOKKEEPER_SQL_FILES) $(FORCE)
|
|
|
|
@if $(call SHA256STAMP_CHANGED); then \
|
|
|
|
$(call VERBOSE,"sql-rewrite $@",devtools/sql-rewrite.py plugins/bkpr/statements_gettextgen.po $* > $@ && $(call SHA256STAMP,//,)); \
|
|
|
|
fi
|
|
|
|
|
|
|
|
maintainer-clean: clean
|
|
|
|
clean: bkpr-maintainer-clean
|
|
|
|
bkpr-maintainer-clean:
|
|
|
|
$(RM) plugins/bkpr/statements.po
|
|
|
|
$(RM) plugins/bkpr/statements_gettextgen.po
|
|
|
|
$(RM) $(BOOKKEEPER_DB_QUERIES)
|
2022-07-19 07:08:26 +02:00
|
|
|
|
|
|
|
include plugins/bkpr/test/Makefile
|