add api info entries for limits and swap availability

This commit is contained in:
Reckless_Satoshi 2024-02-11 14:57:47 +00:00
parent 6b892c7dde
commit 5509340c99
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
3 changed files with 31 additions and 1 deletions

View File

@ -36,6 +36,14 @@ class InfoSerializer(serializers.Serializer):
node_alias = serializers.CharField() node_alias = serializers.CharField()
node_id = serializers.CharField() node_id = serializers.CharField()
network = serializers.CharField() network = serializers.CharField()
min_order_size = serializers.IntegerField(help_text="Minimum order size in Sats")
max_order_size = serializers.IntegerField(help_text="Maximum order size in Sats")
swap_enabled = serializers.BooleanField(
help_text="Whether the option for onchain swap payouts is available or not"
)
max_swap = serializers.IntegerField(
help_text="Maximum size for onchain swap payouts in Sats"
)
maker_fee = serializers.FloatField(help_text="Exchange's set maker fee") maker_fee = serializers.FloatField(help_text="Exchange's set maker fee")
taker_fee = serializers.FloatField(help_text="Exchange's set taker fee ") taker_fee = serializers.FloatField(help_text="Exchange's set taker fee ")
bond_size = serializers.FloatField(help_text="Default bond size (percent)") bond_size = serializers.FloatField(help_text="Default bond size (percent)")

View File

@ -787,7 +787,8 @@ class InfoView(viewsets.ViewSet):
context["alternative_name"] = config("ALTERNATIVE_NAME") context["alternative_name"] = config("ALTERNATIVE_NAME")
context["node_alias"] = config("NODE_ALIAS") context["node_alias"] = config("NODE_ALIAS")
context["node_id"] = config("NODE_ID") context["node_id"] = config("NODE_ID")
context["network"] = config("NETWORK") context["network"] = config("NETWORK", cast=str, default="mainnet")
context["maker_fee"] = float(config("FEE")) * float(config("MAKER_FEE_SPLIT"))
context["maker_fee"] = float(config("FEE")) * float(config("MAKER_FEE_SPLIT")) context["maker_fee"] = float(config("FEE")) * float(config("MAKER_FEE_SPLIT"))
context["taker_fee"] = float(config("FEE")) * ( context["taker_fee"] = float(config("FEE")) * (
1 - float(config("MAKER_FEE_SPLIT")) 1 - float(config("MAKER_FEE_SPLIT"))
@ -795,6 +796,10 @@ class InfoView(viewsets.ViewSet):
context["bond_size"] = settings.DEFAULT_BOND_SIZE context["bond_size"] = settings.DEFAULT_BOND_SIZE
context["notice_severity"] = config("NOTICE_SEVERITY", cast=str, default="none") context["notice_severity"] = config("NOTICE_SEVERITY", cast=str, default="none")
context["notice_message"] = config("NOTICE_MESSAGE", cast=str, default="") context["notice_message"] = config("NOTICE_MESSAGE", cast=str, default="")
context["min_order_size"] = config("MIN_ORDER_SIZE", cast=int, default=20000)
context["max_order_size"] = config("MAX_ORDER_SIZE", cast=int, default=250000)
context["swap_enabled"] = not config("DISABLE_ONCHAIN", cast=bool, default=True)
context["max_swap"] = config("MAX_SWAP_ALLOWED", cast=int, default=0)
try: try:
context["current_swap_fee_rate"] = Logics.compute_swap_fee_rate( context["current_swap_fee_rate"] = Logics.compute_swap_fee_rate(

View File

@ -1006,6 +1006,19 @@ components:
type: string type: string
network: network:
type: string type: string
min_order_size:
type: integer
description: Minimum order size in Sats
max_order_size:
type: integer
description: Maximum order size in Sats
swap_enabled:
type: boolean
description: Whether the option for onchain swap payouts is available or
not
max_swap:
type: integer
description: Maximum size for onchain swap payouts in Sats
maker_fee: maker_fee:
type: number type: number
format: double format: double
@ -1041,6 +1054,9 @@ components:
- lifetime_volume - lifetime_volume
- lnd_version - lnd_version
- maker_fee - maker_fee
- max_order_size
- max_swap
- min_order_size
- network - network
- node_alias - node_alias
- node_id - node_id
@ -1049,6 +1065,7 @@ components:
- num_public_buy_orders - num_public_buy_orders
- num_public_sell_orders - num_public_sell_orders
- robosats_running_commit_hash - robosats_running_commit_hash
- swap_enabled
- taker_fee - taker_fee
- version - version
ListOrder: ListOrder: