Skip to content

Commit

Permalink
add api info entries for limits and swap availability
Browse files Browse the repository at this point in the history
  • Loading branch information
Reckless-Satoshi committed Feb 11, 2024
1 parent 6b892c7 commit 5509340
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
8 changes: 8 additions & 0 deletions api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand Down
7 changes: 6 additions & 1 deletion api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,14 +787,19 @@ def get(self, request):
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"))
)
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(
Expand Down
17 changes: 17 additions & 0 deletions docs/assets/schemas/api-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1041,6 +1054,9 @@ components:
- lifetime_volume
- lnd_version
- maker_fee
- max_order_size
- max_swap
- min_order_size
- network
- node_alias
- node_id
Expand All @@ -1049,6 +1065,7 @@ components:
- num_public_buy_orders
- num_public_sell_orders
- robosats_running_commit_hash
- swap_enabled
- taker_fee
- version
ListOrder:
Expand Down

0 comments on commit 5509340

Please sign in to comment.