forked from XRPLF/xrpl-dev-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcharts_api.html
1693 lines (1589 loc) · 56.9 KB
/
charts_api.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width">
<title>Ripple Charts API - Ripple Developer Portal</title>
<!-- favicon -->
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<!-- jQuery -->
<script src="vendor/jquery-1.11.1.min.js"></script>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<script src="js/bootstrap.min.js"></script>
<!-- Flatdoc theme -->
<link href='vendor/flatdoc/v/0.8.0/theme-white/style.css' rel='stylesheet'>
<script src="vendor/flatdoc/v/0.8.0/theme-white/script.js"></script>
<!-- syntax highlighting -->
<link rel="stylesheet" href="vendor/docco.min.css">
<script src="vendor/highlight.min.js"></script>
<!-- syntax selection js -->
<script src="js/multicodetab.js"></script>
<!-- Markdown content already parsed+included; just do the code tab stuff -->
<script>
$(document).ready(function() {
$().multicode_tabs_pandoc();
hljs.initHighlighting();
make_code_expandable();
});
</script>
<script src="js/expandcode.js"></script>
<script src="js/fixsidebarscroll.js"></script>
<!-- Custom Stylesheets -->
<link href="font/fonts.css" rel="stylesheet" type="text/css" />
<link href="css/main.css" rel="stylesheet" />
<link href="css/custom.css" rel="stylesheet" />
<link rel="shortcut icon" href="favicon.ico?v=2" type="image/x-icon" />
<link rel="icon" href="favicon.ico?v=2" type="image/x-icon" />
</head>
<body class='no-literate'>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="./"><img class="small_logo" src="assets/img/ripple_logo_small.png"></a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Concepts <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="paths.html">Paths</a></li>
<li><a href="fees.html">Fees (Disambiguation)</a></li>
<li><a href="transfer_fees.html">Transfer Fees</a></li>
<li><a href="tx-cost.html">Transaction Cost</a></li>
<li><a href="fee-voting.html">Fee Voting</a></li>
<li><a href="reserves.html">Reserves</a></li>
<li><a href="freeze.html">Freeze</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">References <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="rippled-apis.html">rippled</a></li>
<li><a href="ripple-rest.html">Ripple-REST</a></li>
<li><a href="transactions.html">Transactions</a></li>
<li><a href="ripple-ledger.html">Ripple Consensus Ledger</a></li>
<li><a href="historical_data.html">Historical Data API</a></li>
<li><a href="charts_api.html">Ripple Charts API</a></li>
<li><a href="data_api_v2.html">Ripple Data API v2</a></li>
<li><a href="rippleapi.html">RippleAPI</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorials <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="rippled-setup.html">rippled Setup</a></li>
<li><a href="reliable_tx.html">Reliable Transaction Submission</a></li>
<li><a href="gateway_guide.html">Gateway Guide</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">API Tools <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="rest-api-tool.html">Ripple-REST API Tool</a></li>
<li><a href="historicaldb-api-tool.html">Historical Database API Tool</a></li>
<li><a href="ripple-api-tool.html">WebSocket API Tool</a></li>
<li><a href="charts-api-tool.html">Charts API Tool</a></li>
<li><a href="data-api-v2-tool.html">Data API v2 Tool</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Resources <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="https://forum.ripple.com/viewforum.php?f=2">Forums</a></li>
<li><a href="https://www.bountysource.com/teams/ripple/bounties">Bounties</a></li>
<li><a href="https://ripplelabs.atlassian.net/">Bug Tracking</a></li>
<li><a href="https://ripple.com/category/dev-blog/">Dev Blog</a></li>
<li><a href="https://ripple.com/press-releases/">Press Center</a></li>
<li><a href="https://ripple.com/brand-guidelines/">Brand Guidelines</a></li>
</ul>
<li><a href="https://github.com/ripple/ripple-dev-portal" title="GitHub">Site Source</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<script type="text/javascript">
if (window.location.host.indexOf("github.io") > -1) {
document.write("<div style='background-color:red; color:white; position:fixed; top: 50px; right: 150px; padding: 10px 20px;'>DRAFT</div>");
}
</script>
<div class='wrapper'>
<div class='content-root'>
<div class='menubar'>
<div class='menu section' role='flatdoc-menu'>
<script type="text/javascript" src="js/jquery.gensidebar.js"></script>
<script type="text/javascript">
</script>
</div>
</div>
<div class='content'>
<h1 id="ripple-charts-api">Ripple Charts API</h1>
<p>The Ripple Charts API, also known as the <strong>Data API</strong>, provides past and present information about the state of the Ripple Network through an HTTP API, with additional information calculated for analysis purposes. The Ripple Charts API is used as a data source by applications such as <a href="https://www.ripplecharts.com/">Ripple Charts</a> and <a href="https://www.ripple.com/">ripple.com</a>.</p>
<p>(The API does not follow the conventions of a REST API, but you can use an HTTP client to access it in the same way you would access a REST API.)</p>
<ul>
<li><a href="#architecture">Architecture</a></li>
<li><a href="#setup">Setup</a></li>
<li><a href="#api-method-reference">API Method Reference</a></li>
</ul>
<h1 id="architecture">Architecture</h1>
<p>The Ripple Charts API is a <a href="https://nodejs.org/">Node.js</a> application that uses <a href="http://hbase.apache.org/">HBase</a> as its datastore.</p>
<h2 id="components">Components</h2>
<h3 id="ledger-importer">Ledger Importer</h3>
<p>The ledger importer imports ledgers from the Ripple Network into the data store. The process is set up to import continously in real time as ledgers are validated, and also import historical ledgers.</p>
<h3 id="data-store">Data Store</h3>
<p>The data store uses HBase to store ledgers. This is not as flexible as the old CouchDB data store, but it scales much better.</p>
<h3 id="api-server">API Server</h3>
<p>Accessing the historical data is not done by querying the database directly but through a node.js API server. The server takes requests in the form of JSON data, interprets it into one or several database queries, processes the data as necessary and returns the results.</p>
<h1 id="setup">Setup</h1>
<p>Setup for the Ripple Charts API on top of HBase is not currently documented.</p>
<h2 id="start-api-service">Start API Service</h2>
<p>The following command starts the API service:</p>
<p><code>grunt watch</code></p>
<p>(This requires read permissions to the database. Write permissions are not necessary.)</p>
<h2 id="start-ledger-importer">Start Ledger Importer</h2>
<p>The following command starts the ledger importer service:</p>
<p><code>node db/importer</code></p>
<p>Alternatively, you can use the experimental websocket-based importer:</p>
<p><code>node db/import</code></p>
<p>(Either way, you need write permission to the database.)</p>
<h1 id="formatting-conventions">Formatting Conventions</h1>
<p>Requests to the Charts API generally take the same format:</p>
<ul>
<li>Use the HTTP POST method</li>
<li>The URL defines the API method to use</li>
<li>All parameters are in the request body.</li>
<li>The <code>Content-Type</code> header has the value <code>application/json</code>. <strong>Caution:</strong> If you omit or specify the wrong Content-Type, the API may respond with misleading error messages such as <code>{"error":"Please specify an account"}</code></li>
</ul>
<h2 id="dates-and-times">Dates and Times</h2>
<p>The Ripple Charts API uses Moment.js to parse strings, and therefore accepts <a href="http://momentjs.com/docs/#supported-iso-8601-strings">any date-time string that Moment.js recognizes</a> as input.</p>
<p>The Ripple Charts API always outputs dates in UTC, in the following format:</p>
<p>YYYY-MM-DDThh-mm-ss+00:00</p>
<p>For example:
<code>2015-03-01T00:00:00+00:00</code>
(midnight exactly on March 3, 2015 UTC)</p>
<h2 id="currency-objects">Currency Objects</h2>
<p>Many methods define <strong>a currency</strong> as an object with the following fields:</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>currency</td>
<td>String</td>
<td>Three-letter <a href="http://www.xe.com/iso4217.php">ISO 4217 Currency Code</a> string, or a 160-bit hex string according to Ripple's internal <a href="https://wiki.ripple.com/Currency_format">Currency format</a>.</td>
</tr>
<tr>
<td>issuer</td>
<td>String</td>
<td>Account address of the counterparty holding the currency. Usually an issuing gateway in the Ripple network. Omitted or <code>null</code> for XRP.</td>
</tr>
</tbody>
</table>
<p>Some methods describe <strong>an amount of currency</strong>, for example a quantity traded in a currency exchange. In <a href="#response-formats">JSON format</a>, this takes the form of a nested JSON object with the following fields:</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>currency</td>
<td>String</td>
<td>Same as the <code>currency</code> field of a currency object.</td>
</tr>
<tr>
<td>issuer</td>
<td>String</td>
<td>Same as the <code>issuer</code> field of a currency object.</td>
</tr>
<tr>
<td>amount</td>
<td>Number</td>
<td>The quantity of the currency exchanged.</td>
</tr>
</tbody>
</table>
<p>In <a href="#response-formats">CSV or array format</a>, a currency amount is specified as three separate attributes that correspond to the fields of the JSON object. The name of the fields depends on the context: for example, the <code>baseAmount</code> column is equivalent to the <code>amount</code> field of the <code>base</code> currency amount object.</p>
<p><strong>Warning:</strong> JavaScript's native number type does not support <code>rippled</code>'s full range of precision. When dealing with very large or very small numbers, the <code>amount</code> values returned by the Charts API lose precision.</p>
<h2 id="response-formats">Response Formats</h2>
<p>Several methods provide a <code>format</code> parameter, which lets you request results in one of three formats:</p>
<ul>
<li><code>csv</code> - <a href="http://en.wikipedia.org/wiki/Comma-separated_values">Comma-separated-values</a> table. The first line is a row of column headers, and each subsequent line represents one result or interval, with its attributes in columns. The columns are separated by comma (<code>,</code>) characters.</li>
<li><code>json</code> - The request contains some top-level information at the top level, and a <code>results</code> array. Each member of the <code>results</code> array is a JSON object with attributes and values that represent one result or interval.</li>
<li><strong>Two-dimensional array format</strong> - If neither <code>csv</code> nor <code>json</code> is specified, the API returns an array of JSON arrays, in a format that resembles CSV. The first member of the top-level array is an array of table headers, and each subsequent member is a nested array representing one result or interval, with its members corresponding to the attribute names in the header row.</li>
</ul>
<h1 id="api-method-reference">API Method Reference</h1>
<p>To use a method in this document, append the path for that method to the hostname of the Charts API instance you want to use. Ripple Labs runs a public instance of the Ripple Charts API with full data, available at:</p>
<p><strong>https://api.ripplecharts.com</strong></p>
<p>The API provides the following methods:</p>
<ul>
<li><a href="#accounts-created">Accounts Created - <code>POST /api/accounts_created</code></a></li>
<li><a href="#exchange-rates">Exchange Rates - <code>POST /api/exchange_rates</code></a></li>
<li><a href="#issuer-capitalization">Issuer Capitalization - <code>POST /api/issuer_capitalization</code></a></li>
<li><a href="#market-traders">Market Traders - <code>POST /api/market_traders</code></a></li>
<li><a href="#offers-exercised">Offers Exercised - <code>POST /api/offers_exercised</code></a></li>
<li><a href="#top-markets">Top Markets - <code>POST /api/top_markets</code></a></li>
</ul>
<p>As of August 19, 2015, the following methods are no longer available: Account Transaction Stats, Account Transactions, Account Offers Exercised, Ledgers Closed, Offers, Total Network Value, Total Value Sent, Transaction Stats, and Value Sent.</p>
<h2 id="accounts-created">Accounts Created</h2>
<p><a href="https://github.com/ripple/ripple-data-api/blob/develop/api/routes/accountsCreated.js" title="Source">[Source]<br/></a></p>
<p>Retrieve information about the creation of new Ripple accounts.</p>
<h4 id="request-format">Request Format</h4>
<div class="multicode">
*Reduced*
wzxhzdk:0
*Expanded*
wzxhzdk:1
</div>
<p><a class="button" href="charts-api-tool.html#accounts-created">Try it! ></a></p>
<p>The request includes the following body parameters:</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>startTime</td>
<td>String (<a href="#dates-and-times">Date-Time</a>)</td>
<td>Retrieve information starting at this time.</td>
</tr>
<tr>
<td>endTime</td>
<td>String (<a href="#dates-and-times">Date-Time</a>)</td>
<td>Retrieve information ending at this time.</td>
</tr>
<tr>
<td>timeIncrement</td>
<td>String</td>
<td>(Optional) Divide results into intervals of the specified length: <code>week</code>, <code>day</code>, <code>hour</code>. The value <code>all</code> collapses the results into just one interval. Defaults to <code>all</code>.</td>
</tr>
<tr>
<td>descending</td>
<td>Boolean</td>
<td>(Optional) If true, return results in descending order. Defaults to false.</td>
</tr>
<tr>
<td>reduce</td>
<td>Boolean</td>
<td>(Optional) If <code>false</code>, include accounts individually instead of collapsing them into results over time. Ignored if <code>timeIncrement</code> is provided. Defaults to <code>true</code>.</td>
</tr>
<tr>
<td>limit</td>
<td>Number</td>
<td>(Optional) If reduce is <code>false</code>, this value defines the maximum number of transactions to return in one response. Use with <code>offset</code> to paginate results. Defaults to 500.</td>
</tr>
<tr>
<td>offset</td>
<td>Number</td>
<td>(Optional) If reduce is <code>false</code>, this value defines a number of transactions to skip before returning results. Use with <code>limit</code> to paginate results. Defaults to 0.</td>
</tr>
<tr>
<td>format</td>
<td>String</td>
<td>(Optional) The <a href="#response-formats">Response Format</a> to use: <code>csv</code> or <code>json</code>. If omitted, defaults to a CSV-like JSON array format.</td>
</tr>
</tbody>
</table>
<h4 id="response-format">Response Format</h4>
<p>The format of the response depends on the <code>format</code> and <code>reduce</code> parameters from the request. See <a href="#response-formats">Response Format</a> for details. Examples of successful responses:</p>
<div class="multicode">
*Reduced*
wzxhzdk:2
*Expanded*
wzxhzdk:3
</div>
<p><strong>If results are reduced</strong> (the default), then each result represents an interval of time, with the following attributes, in order:</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>time</td>
<td>String (<a href="#dates-and-times">Date-Time</a>)</td>
<td>The time this interval begins</td>
</tr>
<tr>
<td>count</td>
<td>Number</td>
<td>The number of accounts created (successfully funded with the XRP reserve) in this interval.</td>
</tr>
</tbody>
</table>
<p><strong>If the results are not reduced</strong> (the request specified <code>reduce</code> as false and did not include a <code>timeIncrement</code>), then each result represents an individual account that was created, with the following attributes:</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>time</td>
<td>String (<a href="#dates-and-times">Date-Time</a>)</td>
<td>The time this account was created, as defined by the close time of the ledger containing the transaction that created it.</td>
</tr>
<tr>
<td>account</td>
<td>String (Ripple Address)</td>
<td>The address of the newly-created account.</td>
</tr>
<tr>
<td>txHash</td>
<td>String (Transaction Hash)</td>
<td>The identifying hash of the transaction that created this account.</td>
</tr>
<tr>
<td>ledgerIndex</td>
<td>Number</td>
<td>The sequence number of the ledger when this account was created.</td>
</tr>
</tbody>
</table>
<h2 id="exchange-rates">Exchange Rates</h2>
<p><a href="https://github.com/ripple/ripple-data-api/blob/develop/api/routes/exchangeRates.js" title="Source">[Source]<br/></a></p>
<p>Retrieve information about the exchange rates between one or more pairs of currency, based on trading activity in the network.</p>
<h4 id="request-format-1">Request Format</h4>
<div class="multicode">
*Multiple*
wzxhzdk:4
*Single*
wzxhzdk:5
*Live*
wzxhzdk:6
</div>
<p><a class="button" href="charts-api-tool.html#exchange-rates">Try it! ></a></p>
<p>The request includes the following body parameters:</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>pairs</td>
<td>Array</td>
<td>(Optional) Array of currency pairs to compare. Each member of the array should be an object with a <code>base</code> field and a <code>counter</code> field, whose values are <a href="#currency-objects">Currency Objects</a>. If <code>live</code> is true, each pair can also include a <code>depth</code> field specifying how deep to dig into the order book to calculate the live rate.</td>
</tr>
<tr>
<td>base</td>
<td>Object (<a href="#currency-objects">Currency Object</a>)</td>
<td>(Optional) One currency to compare. Ignored if <code>pairs</code> provided.</td>
</tr>
<tr>
<td>counter</td>
<td>Object (<a href="#currency-objects">Currency Object</a>)</td>
<td>(Optional) The other currency to compare. Ignored if <code>pairs</code> provided.</td>
</tr>
<tr>
<td>depth</td>
<td>Number</td>
<td>(Optional) Ignored unless <code>live</code> is true. Ignored if <code>pairs</code> is provided. Retrieve exchange rates for this amount of the <code>counter</code> currency. Provides a more accurate picture when the best orders in the market do not have enough volume to fully satisfy an exchange. Defaults to 0 (use the first bid and ask only).</td>
</tr>
<tr>
<td>range</td>
<td>String</td>
<td>(Optional) Time period over which the exchange rate is calculated: <code>year</code>, <code>month</code>, <code>week</code>, <code>day</code>, or <code>hour</code>. Defaults to <code>day</code>. Ignored if <code>live</code> is true.</td>
</tr>
<tr>
<td>last</td>
<td>Boolean</td>
<td>(Optional) If true, only return the price from the most recent exchange, without calculating <a href="https://en.wikipedia.org/wiki/Volume-weighted_average_price">VWAP</a>. Use for a faster response. Defaults to false.</td>
</tr>
<tr>
<td>live</td>
<td>Boolean</td>
<td>(Optional) If true, retrieve the current price directly from the Ripple network instead, as the midpoint between weighted average of the bid and asks up to the depth specified . Otherwise, use historical data from the past <code>range</code> amount of time. Defaults to false.</td>
</tr>
</tbody>
</table>
<p>You must provide either <code>pairs</code> or both <code>base</code> and <code>counter</code>.</p>
<h4 id="response-format-1">Response Format</h4>
<p>Examples of successful responses:</p>
<div class="multicode">
*Single*
wzxhzdk:7
*Multiple*
wzxhzdk:8
*Live*
wzxhzdk:9
</div>
<p>A successful result contains a JSON array. Each member of the array represents a currency pair, as an object with the following fields:</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>base</td>
<td>Object (<a href="#currency-objects">Currency Object</a>)</td>
<td>The base currency specified for this pair, possibly including a <code>name</code> field with the Ripple Name for the <code>issuer</code> address.</td>
</tr>
<tr>
<td>counter</td>
<td>Object (<a href="#currency-objects">Currency Object</a>)</td>
<td>The counter currency specified for this pair, possibly including a <code>name</code> field with the Ripple Name for the <code>issuer</code> address.</td>
</tr>
<tr>
<td>depth</td>
<td>Number</td>
<td>(May be omitted) The depth to search for this currency pair, if provided.</td>
</tr>
<tr>
<td>rate</td>
<td>Number</td>
<td>(May be omitted) The amount of the counter currency that you can purchase with 1 unit of the base currency. By default, this is calculated <a href="https://en.wikipedia.org/wiki/Volume-weighted_average_price">volume-weighted average price</a> for all exchanges executed during the <code>range</code> period from the request. If the request specified <code>live</code> as true, this is instead calculated as the midpoint between the weighted average of current bid and ask rates in the network up to the specified <code>depth</code>. Omitted if the request specified <code>last</code> as <code>true</code>.</td>
</tr>
<tr>
<td>last</td>
<td>Number</td>
<td>(May be omitted) The rate of the single most recent exchange to take place.</td>
</tr>
</tbody>
</table>
<p>If no exchanges are found for a currency pair from the request, that pair is omitted from the response.</p>
<h2 id="issuer-capitalization">Issuer Capitalization</h2>
<p><a href="https://github.com/ripple/ripple-data-api/blob/develop/api/routes/issuerCapitalization.js" title="Source">[Source]<br/></a></p>
<p>Retrieve the total capitalization (outstanding balance) of specified currency issuers over time.</p>
<h4 id="request-format-2">Request Format</h4>
<div class="multicode">
*Request*
wzxhzdk:10
</div>
<p><a class="button" href="charts-api-tool.html#issuer-capitalization">Try it! ></a></p>
<p>The request includes the following body parameters:</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>currencies</td>
<td>Array of <a href="#currency-objects">Currency Objects</a>)</td>
<td>A list of currency/issuer pairs to look up.</td>
</tr>
<tr>
<td>startTime</td>
<td>String (<a href="#dates-and-times">Date-Time</a>)</td>
<td>Retrieve information starting at this time.</td>
</tr>
<tr>
<td>endTime</td>
<td>String (<a href="#dates-and-times">Date-Time</a>)</td>
<td>Retrieve information ending at this time.</td>
</tr>
<tr>
<td>timeIncrement</td>
<td>String</td>
<td>(Optional) Divide results into intervals of the specified length: <code>year</code>, <code>month</code>, <code>day</code>, <code>hour</code>, <code>minute</code>, or <code>second</code>. The value <code>all</code> collapses the results into just one interval. Defaults to <code>all</code>. Ignored if <code>reduce</code> is <code>false</code>.</td>
</tr>
</tbody>
</table>
<h4 id="response-format-2">Response Format</h4>
<p>An example of a successful response:</p>
<pre><code>[
{
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"name": "Bitstamp",
"hotwallets": [
"rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1",
"rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX"
],
"results": [
[
"2014-01-01T00:00:00+00:00",
2182532.512563024
],
[
"2014-02-01T00:00:00+00:00",
1672428.6072806932
],
[
"2014-03-01T00:00:00+00:00",
1475205.4287192414
],
[
"2014-04-01T00:00:00+00:00",
1475129.7523240475
],
[
"2014-05-01T00:00:00+00:00",
1641170.5998081048
],
[
"2014-06-01T00:00:00+00:00",
2823512.0227728607
],
[
"2014-07-01T00:00:00+00:00",
2181718.7345464956
],
[
"2014-08-01T00:00:00+00:00",
2150290.1475041625
],
[
"2014-09-01T00:00:00+00:00",
1370978.1335410434
],
[
"2014-10-01T00:00:00+00:00",
1386720.726560316
],
[
"2014-11-01T00:00:00+00:00",
1171158.4417431813
],
[
"2014-12-01T00:00:00+00:00",
1651264.0460538066
],
[
"2015-01-01T00:00:00+00:00",
2272895.4608580153
]
]
},
{
"currency": "USD",
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
"name": "SnapSwap",
"hotwallets": [
"ra7JkEzrgeKHdzKgo4EUUVBnxggY4z37kt",
"rQsAshmCjPsxkYnxY9GnmBTAeEUaePDAie",
"rEk9i7G8ac1kUs1mFjtze1qjj9FzGvXAG",
"rsTQ7iwrCik9Ugc3zbpcbo2K3SbAdYJss1",
"rwm98fCBS8tV1YB8CGho8zUPW5J7N41th2",
"rnd8KJ4qeip6FPJvC1fyv82nW2Lm8C8KjQ",
"r5ymZSvtdNgbKVc8ay1Jhmq5f9QgnvEtj"
],
"results": [
[
"2014-01-01T00:00:00+00:00",
308414.17014300067
],
[
"2014-02-01T00:00:00+00:00",
221127.8278553265
],
[
"2014-03-01T00:00:00+00:00",
189103.31201476356
],
[
"2014-04-01T00:00:00+00:00",
166239.66201052035
],
[
"2014-05-01T00:00:00+00:00",
181126.05199917927
],
[
"2014-06-01T00:00:00+00:00",
352360.96199815325
],
[
"2014-07-01T00:00:00+00:00",
406900.8018140941
],
[
"2014-08-01T00:00:00+00:00",
522981.4027866862
],
[
"2014-09-01T00:00:00+00:00",
823727.7361699624
],
[
"2014-10-01T00:00:00+00:00",
1285657.1682029555
],
[
"2014-11-01T00:00:00+00:00",
1162233.7115210893
],
[
"2014-12-01T00:00:00+00:00",
1631690.8946927704
],
[
"2015-01-01T00:00:00+00:00",
3778040.482102244
]
]
}
]
</code></pre>
<p>A successful result contains a <strong>JSON array</strong> of objects representing the issuers from the request. Each member object has the following fields:</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>currency</td>
<td>String</td>
<td>Currency code of the currency described by this record.</td>
</tr>
<tr>
<td>issuer</td>
<td>String (Ripple Address)</td>
<td>The account address of the gateway issuing this currency.</td>
</tr>
<tr>
<td>name</td>
<td>String</td>
<td>The name of this gateway, which usually corresponds to the Ripple Name of the account.</td>
</tr>
<tr>
<td>hotwallets</td>
<td>Array of Ripple Addresses</td>
<td>Hot wallets controlled by this gateway. Assets held by these accounts are not counted towards the capitalization.</td>
</tr>
<tr>
<td>results</td>
<td>Array of Arrays</td>
<td>The capitalization of the issuer/currency pair as an array of intervals. Each nested array has two values: a String (<a href="#dates-and-times">Date-Time</a>) specifying the beginning of the interval, and a number representing the total units of the currency distributed through the network at the time.</td>
</tr>
</tbody>
</table>
<p>The list of gateway names and hot wallets is defined by the <a href="https://github.com/ripple/ripple-data-api/blob/a6c23a8c1bc5f073f2dd2bf32e8d763b66b6a2e3/api/gateways.json">gateways.json</a> file in the server tree. In the future, this may be <a href="https://ripplelabs.atlassian.net/browse/RD-75">expanded to use host-meta</a>.</p>
<h2 id="market-traders">Market Traders</h2>
<p><a href="https://github.com/ripple/ripple-data-api/blob/develop/api/routes/marketTraders.js" title="Source">[Source]<br/></a></p>
<p>Return a list of accounts that participated in trading a specified currency exchange.</p>
<h4 id="request-format-3">Request Format</h4>
<div class="multicode">
*Transactions Included*
wzxhzdk:12
*Default Markets*
wzxhzdk:13
</div>
<p><a class="button" href="charts-api-tool.html#market-traders">Try it! ></a></p>
<p>The request includes the following body parameters:</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>base</td>
<td>Object (<a href="#currency-objects">Currency Object</a>)</td>
<td>(Optional) One of the currencies being exchanged. Required if <code>counter</code> is specified.</td>
</tr>
<tr>
<td>counter</td>
<td>Object (<a href="#currency-objects">Currency Object</a>)</td>
<td>(Optional) The other of the currencies being exchanged. Required if <code>base</code> is specified.</td>
</tr>
<tr>
<td>startTime</td>
<td>String (<a href="#dates-and-times">Date-Time</a>)</td>
<td>(Optional) Retrieve information starting at this time. If omitted, use the <code>period</code> ending at the current time.</td>
</tr>
<tr>
<td>period</td>
<td>String</td>
<td>(Optional) One of the following values: <code>3d</code> (three days), <code>7d</code> (seven days), or <code>24h</code> (24 hours). Defaults to <code>24h</code>.</td>
</tr>
<tr>
<td>transactions</td>
<td>Boolean</td>
<td>(Optional) If true, include individual transactions in the response. Defaults to false. Ignored if <code>format</code> is csv.</td>
</tr>
<tr>
<td>format</td>
<td>String</td>
<td>(Optional) The <a href="#response-formats">Response Format</a> to use: <code>csv</code> or <code>json</code>. If omitted, defaults to a CSV-like JSON array format.</td>
</tr>
</tbody>
</table>
<p>If both <code>base</code> and <code>counter</code> are omitted, the API combines the results from a <a href="https://github.com/ripple/ripple-data-api/blob/2d456ace25c7ee157ed510b801ccc987b58d5d92/api/routes/marketTraders.js#L81-L92">hardcoded list of popular markets</a> with XRP as the base currency.</p>
<p><strong>Note:</strong> This method <em>does not</em> have an <code>endTime</code> parameter.</p>
<h4 id="response-format-3">Response Format</h4>
<p>The format of the response depends on the <code>format</code> and <code>reduce</code> parameters from the request. See <a href="#response-formats">Response Format</a> for details. Examples of successful responses:</p>
<div class="multicode">
*Transactions Included*
wzxhzdk:14
*Default Markets*
wzxhzdk:15
</div>
<p>A successful result contains the following fields:</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>account</td>
<td>String (Account Address)</td>
<td>The account of the trader.</td>
</tr>
<tr>
<td>buy</td>
<td>Object</td>
<td>Object with <code>baseVolume</code> (volume of base currency bought), <code>counterVolume</code> (volume of counter currency used to buy the base currency), and <code>count</code> (number of buy transactions) fields describing the activity of this account.</td>
</tr>
<tr>
<td>sell</td>
<td>Object</td>
<td>Object with <code>baseVolume</code> (volume of base currency sold), <code>counterVolume</code> (volume of counter acquired by selling the base currency), and <code>count</code> (number of sell transactions) fields describing the activity of this account.</td>
</tr>
<tr>
<td>baseVolume</td>
<td>Number</td>
<td>The total amount of the base currency exchanged.</td>
</tr>
<tr>
<td>counterVolume</td>
<td>Number</td>
<td>The total amount of the counter currency exchanged.</td>
</tr>
<tr>
<td>count</td>
<td>Number</td>
<td>The number of exchanges this account performed.</td>
</tr>
<tr>
<td>transactions</td>
<td>Array</td>
<td>(Omitted unless the request specified <code>transactions</code> as true) Array of transactions sent that this account participated in.</td>
</tr>
</tbody>
</table>
<p>If transactions are included, each transaction is represented as an array with the following fields in order:</p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>String (<a href="#dates-and-times">Date-Time</a>)</td>
<td>The approximate time this transaction occurred.</td>
</tr>
<tr>
<td>Number</td>
<td>The amount of the counter currency received for each unit of the base spent.</td>
</tr>
<tr>
<td>Number</td>
<td>The amount of base currency in this transaction.</td>
</tr>
<tr>
<td>Number</td>
<td>The amount of counter currency in this transaction.</td>
</tr>
<tr>
<td>String (Ripple Address)</td>
<td>One party to this transaction.</td>
</tr>
<tr>
<td>String (Ripple Address)</td>
<td>The other party to this transaction.</td>
</tr>
<tr>
<td>String (Transaction Hash)</td>
<td>The identifying hash for this transaction. (This may be <code>null</code> for very old transactions.)</td>
</tr>
<tr>
<td>Number</td>
<td>The sequence number of the ledger that included this transaction.</td>
</tr>
</tbody>
</table>
<h2 id="offers-exercised">Offers Exercised</h2>
<p><a href="https://github.com/ripple/ripple-data-api/blob/master/api/routes/offersExercised.js" title="Source">[Source]<br/></a></p>
<p>Retrieve information about currency-exchange orders being exercised on the network, for a specific pair of currencies and timeframe.</p>
<div class="multicode">
*15-minute increments*
wzxhzdk:16
*Expanded*
wzxhzdk:17
</div>
<p><a class="button" href="charts-api-tool.html#offers-exercised">Try it! ></a></p>
<p>The request includes the following body parameters:</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>base</td>
<td>Object (<a href="#currency-objects">Currency Object</a>)</td>
<td>One of the currencies being exchanged.</td>
</tr>
<tr>
<td>counter</td>
<td>Object (<a href="#currency-objects">Currency Object</a>)</td>
<td>The other of the currencies being exchanged.</td>
</tr>
<tr>
<td>startTime</td>
<td>String (<a href="#dates-and-times">Date-Time</a>)</td>
<td>Retrieve information starting at this time.</td>
</tr>
<tr>
<td>endTime</td>
<td>String (<a href="#dates-and-times">Date-Time</a>)</td>
<td>Retrieve information ending at this time.</td>
</tr>
<tr>
<td>timeIncrement</td>
<td>String</td>
<td>(Optional) Divide results into intervals of the specified length: <code>year</code>, <code>month</code>, <code>day</code>, <code>hour</code>, <code>minute</code>, or <code>second</code>. The value <code>all</code> collapses the results into just one interval. Defaults to <code>all</code>.</td>
</tr>
<tr>
<td>timeMultiple</td>
<td>Number</td>
<td>(Optional) Create larger intervals that are this many times the size of the <code>timeIncrement</code> (for example, 15-minute intervals). Defaults to 1.</td>
</tr>
<tr>
<td>descending</td>
<td>Boolean</td>
<td>(Optional) If true, return results in descending order. Defaults to false.</td>
</tr>
<tr>
<td>reduce</td>
<td>Boolean</td>
<td>(Optional) If <code>false</code>, include transactions individually instead of collapsing them into results over time. Defaults to <code>true</code>. Ignored if <code>timeIncrement</code> is provided.</td>
</tr>
<tr>
<td>limit</td>
<td>Number</td>
<td>(Optional) If reduce is <code>false</code>, this value defines the maximum number of transactions to return in one response. Use with <code>offset</code> to paginate results. Defaults to 500.</td>
</tr>