From 5509340c991d0671770ed36e988f423c47ca1636 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Sun, 11 Feb 2024 14:57:47 +0000 Subject: [PATCH] add api info entries for limits and swap availability --- api/serializers.py | 8 ++++++++ api/views.py | 7 ++++++- docs/assets/schemas/api-latest.yaml | 17 +++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/api/serializers.py b/api/serializers.py index 205613d6..950eaf95 100644 --- a/api/serializers.py +++ b/api/serializers.py @@ -36,6 +36,14 @@ class InfoSerializer(serializers.Serializer): node_alias = serializers.CharField() node_id = 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") taker_fee = serializers.FloatField(help_text="Exchange's set taker fee ") bond_size = serializers.FloatField(help_text="Default bond size (percent)") diff --git a/api/views.py b/api/views.py index 47da524e..79647084 100644 --- a/api/views.py +++ b/api/views.py @@ -787,7 +787,8 @@ class InfoView(viewsets.ViewSet): context["alternative_name"] = config("ALTERNATIVE_NAME") context["node_alias"] = config("NODE_ALIAS") 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["taker_fee"] = float(config("FEE")) * ( 1 - float(config("MAKER_FEE_SPLIT")) @@ -795,6 +796,10 @@ class InfoView(viewsets.ViewSet): context["bond_size"] = settings.DEFAULT_BOND_SIZE context["notice_severity"] = config("NOTICE_SEVERITY", cast=str, default="none") 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: context["current_swap_fee_rate"] = Logics.compute_swap_fee_rate( diff --git a/docs/assets/schemas/api-latest.yaml b/docs/assets/schemas/api-latest.yaml index ebb473f4..1ed83986 100644 --- a/docs/assets/schemas/api-latest.yaml +++ b/docs/assets/schemas/api-latest.yaml @@ -1006,6 +1006,19 @@ components: type: string network: 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: type: number format: double @@ -1041,6 +1054,9 @@ components: - lifetime_volume - lnd_version - maker_fee + - max_order_size + - max_swap + - min_order_size - network - node_alias - node_id @@ -1049,6 +1065,7 @@ components: - num_public_buy_orders - num_public_sell_orders - robosats_running_commit_hash + - swap_enabled - taker_fee - version ListOrder: