@@ -1383,7 +1383,8 @@ A successful response uses the HTTP code **200 OK** and has a JSON body with the
13831383Retrieve an exchange rate for a given currency at a specific time. The exchange rate is
13841384determined by conversion first to XRP and then to the counter currency. The rate is
13851385derived from the volume weighted average over the calanendar day specified, averaged with
1386- the volume weighted average of the last 50 trades within the last 14 days.
1386+ the volume weighted average of the last 50 trades within the last 14 days. If a rate
1387+ cannot be determined, 0 is returned.
13871388
13881389```
13891390GET /v2/exchange_rates/{:base}/{:counter}
@@ -1392,7 +1393,7 @@ GET /v2/exchange_rates/{:base}/{:counter}
13921393#### Params ####
13931394 * : base (string)...base currency of the pair in the format currency[ +issuer] (required)
13941395 * : counter (string)...counter currency of the pair in the format currency[ +issuer] (required)
1395- * date (string)...UTC start time of query range (defaults to now)
1396+ * date (string)...UTC date for which exchange rate is determined (defaults to now)
13961397 * strict (boolean)...disallow rates derived from less than 10 exchanges (defaults to true)
13971398
13981399#### Response Format ####
@@ -1401,7 +1402,48 @@ A successful response uses the HTTP code **200 OK** and has a JSON body with the
14011402| Field | Value | Description |
14021403| --------| -------| -------------|
14031404| result | ` success ` | Indicates that the body represents a successful response. |
1404- | rate | number | The requested exchange rate |
1405+ | rate | Number | The requested exchange rate |
1406+
1407+
1408+
1409+ ## Normalize ##
1410+ [[ Source] <br >] ( https://github.com/ripple/rippled-historical-database/blob/develop/api/routesV2/normalize.js " Source ")
1411+
1412+ Convert an amount from one currency/issuer denomination to another, using network
1413+ exchange rates. For non-XRP currencies, rates between each currency and XRP are used
1414+ to determine a final rate, using the same logic as the exchange rate endpoint. If a
1415+ rate cannot be determined, 0 is used.
1416+
1417+ ```
1418+ GET /v2/normalize
1419+ ```
1420+
1421+ date: smoment(req.query.date),
1422+ amount: Number(req.query.amount),
1423+ currency: (req.query.currency || 'XRP').toUpperCase(),
1424+ issuer: req.query.issuer || '',
1425+ exchange_currency: (req.query.exchange_currency || 'XRP').toUpperCase(),
1426+ exchange_issuer: req.query.exchange_issuer || '',
1427+ strict: (/false/i).test(req.query.strict) ? false : true
1428+
1429+ #### Params ####
1430+ * amount (string)...amount of currency to normalize (required)
1431+ * currency(string)...original denomination currency (defaults to XRP)
1432+ * issuer(string)...original denomination issuer
1433+ * exchange_currency(string)...final denomination currency (defaults to XRP)
1434+ * exchange_issuer(string)...final denomination issuer
1435+ * date (string)...UTC date for which exchange rate is determined (defaults to now)
1436+ * strict (boolean)...disallow rates derived from less than 10 exchanges (defaults to true)
1437+
1438+ #### Response Format ####
1439+ A successful response uses the HTTP code ** 200 OK** and has a JSON body with the following:
1440+
1441+ | Field | Value | Description |
1442+ | --------| -------| -------------|
1443+ | result | ` success ` | Indicates that the body represents a successful response. |
1444+ | amount | Number | Original denomination amount |
1445+ | converted | Number | Final denomination amount |
1446+ | rate | Number | Exchange rate of conversion |
14051447
14061448
14071449
0 commit comments