commit 14fc31f083a4cbb1ae110f9d243d5faf6a9569c1
parent 7b75d09335c11d9defc15d59fb516053f45f4aa8
Author: Florian Dold <florian@dold.me>
Date: Thu, 19 Oct 2023 12:36:31 +0200
corebank: move optional conversion rate info to /config
Diffstat:
1 file changed, 17 insertions(+), 46 deletions(-)
diff --git a/core/api-corebank.rst b/core/api-corebank.rst
@@ -86,6 +86,23 @@ Config
// Only applicable if have_cashout=true.
fiat_currency?: CurrencySpecification;
+ // Extra conversion rate information.
+ // Only present if conversion is supported and the server opts in
+ // to report the static conversion rate.
+ conversion_info?: {
+ // Exchange rate to buy the local currency from the external one
+ buy_at_ratio: DecimalNumber;
+
+ // Exchange rate to sell the local currency for the external one
+ sell_at_ratio: DecimalNumber;
+
+ // Fee to subtract after applying the buy ratio.
+ buy_in_fee: DecimalNumber;
+
+ // Fee to subtract after applying the sell ratio.
+ sell_out_fee: DecimalNumber;
+ }
+
}
@@ -901,52 +918,6 @@ Cashouts
Aborted cashout operations will also not be found.
-Conversion rates
-----------------
-
-..
- FIXME: throughout API docs and implementations, the following names
- are used interchangeably: local, regional, internal currency. As well
- these: external, fiat, currency. Style should tend to use only one.
-
-.. http:get:: /conversion-rates
-
- This call shows the current conversion rates between the local and the
- external currency. The external currency is the one mentioned in the
- *fiat_currency* field of `Config`.
-
- **Response:**
-
- :http:statuscode:`200 OK`: `ConversionRatesResponse`.
-
- :http:statuscode:`404 Not Found`: the bank doesn't provide any conversion service.
-
- .. ts:def:: ConversionRatesResponse
-
- interface ConversionRatesResponse {
-
- // Exchange rate to buy the local currency from the external one
- buy_at_ratio: DecimalNumber;
-
- // Exchange rate to sell the local currency for the external one
- sell_at_ratio: DecimalNumber;
-
- // Fee to subtract after applying the buy ratio.
- buy_in_fee: DecimalNumber;
-
- // Fee to subtract after applying the sell ratio.
- sell_out_fee: DecimalNumber;
- }
-
- For example, given a local currency LC, a fiat currency FC,
- a *sell_at_ratio* = 0.9 and *sell_out_fee* = 0.03, selling
- 10 LC would result in the following FC: (10 * 0.9) - 0.03
- = 8.97 FC. On the other hand, given *buy_at_ratio* = 1.1
- and *buy_in_fee* = 0.01, a user wanting to spend 10 FC to
- buy the LC would result in the following LC: (10 * 1.1) -
- 0.01 = 10.99 LC.
-
-
Monitor
-------