#BIP-0171 - Historical exchange rates ## HTTP://api.cerise.tech/ A common interface for requesting currency exchange rate information from a server - BIP171 implementation [**Contact the developer**](mailto:stephane.traumat@gmail.com) **Version** 0.2 [**Terms of Service**](https://github.com/straumat/cerise/blob/master/LICENSE) [**BSD 2-Clause &quot;Simplified&quot; License**](https://github.com/straumat/cerise/blob/master/LICENSE) # APIs ## / ### GET <a id="getHistoricalExchangeRates">Historical exchange rates API</a> #### Request ##### Parameters <table border="1"> <tr> <th>Name</th> <th>Located in</th> <th>Required</th> <th>Description</th> <th>Default</th> <th>Schema</th> </tr> <tr> <th>mode</th> <td>query</td> <td>yes</td> <td>Always &quot;history&quot; for this request.</td> <td> - </td> <td>string </td> </tr> <tr> <th>cp</th> <td>query</td> <td>yes</td> <td>Currency pair(s) for which information is requested.</td> <td> - </td> <td>Array[string] (multi)</td> </tr> <tr> <th>type</th> <td>query</td> <td>no</td> <td>Type of exchange rate data being requested. May be &quot;high&quot;, &quot;low&quot;, &quot;average&quot;, &quot;typical&quot;, or any other arbitrary name. If omitted, the server may provide any rates it deems appropriate.</td> <td> - </td> <td>Array[string] (multi)</td> </tr> <tr> <th>from</th> <td>query</td> <td>no</td> <td>POSIX timestamp the results should begin with.</td> <td> - </td> <td>number (double)</td> </tr> <tr> <th>to</th> <td>query</td> <td>no</td> <td>POSIX timestamp the results should end with. If omitted, the present time shall be used.</td> <td> - </td> <td>number (double)</td> </tr> <tr> <th>nearest</th> <td>query</td> <td>no</td> <td>If provided and true, indicates that only the nearest timestamp to &quot;from&quot; must be returned, and a range is not desired. (&quot;to&quot; should be omitted in this case.)</td> <td> - </td> <td>boolean </td> </tr> <tr> <th>ratedelta</th> <td>query</td> <td>no</td> <td>If specified, the server may omit data where the rate or time has not changed since the last provided rate and time. If both are provided, either a significant rate change OR time change should trigger a new record in the results.</td> <td> - </td> <td>number (float)</td> </tr> <tr> <th>timedelta</th> <td>query</td> <td>no</td> <td>If specified, the server may omit data where the rate or time has not changed since the last provided rate and time. If both are provided, either a significant rate change OR time change should trigger a new record in the results.</td> <td> - </td> <td>number (float)</td> </tr> </table> #### Response | Status Code | Reason | Response Model | |-------------|-------------|----------------| | 200 | successful operation | Array[<a href="#/definitions/HistoricalExchangeRatesResult">HistoricalExchangeRatesResult</a>]| # Definitions ## <a name="/definitions/HistoricalExchangeRatesResult">HistoricalExchangeRatesResult</a> <table border="1"> <tr> <th>name</th> <th>type</th> <th>required</th> <th>description</th> <th>example</th> </tr> <tr> <td>cp</td> <td> string </td> <td>required</td> <td>The currency-pair token. Currency-pair tokens are arbitrary Strings no longer than 255 characters, which may include any ASCII RFC 3986 unreserved characters (ie, alphanumerics and the hyphen, underscore, period, and tilde symbols)</td> <td>XBTUSD-ver4</td> </tr> <tr> <td>time</td> <td> number (double) </td> <td>required</td> <td>The time (as a POSIX timestamp) the rate information is applicable to (should be approximately the request time).</td> <td>1.4887674105463133E9</td> </tr> <tr> <td>rates</td> <td> object </td> <td>required</td> <td>A JSON Object with each rate type provided as a key, and a Number as the value specifying the rate.</td> <td>{&quot;typical&quot;: 1300}</td> </tr> </table>