forked from thrasher-corp/gocryptotrader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrpc.proto
1864 lines (1581 loc) · 44 KB
/
rpc.proto
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
syntax = "proto3";
package gctrpc;
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
option go_package = "github.com/thrasher-corp/gocryptotrader/gctrpc";
message GetInfoRequest {}
message GetInfoResponse {
string uptime = 1;
int64 available_exchanges = 2;
int64 enabled_exchanges = 3;
string default_forex_provider = 4;
string default_fiat_currency = 5;
map<string, bool> subsystem_status = 6;
map<string, RPCEndpoint> rpc_endpoints = 7;
}
message GetCommunicationRelayersRequest {}
message CommunicationRelayer {
bool enabled = 1;
bool connected = 2;
}
message GetCommunicationRelayersResponse {
map<string, CommunicationRelayer> communication_relayers = 1;
}
message GenericSubsystemRequest {
string subsystem = 1;
}
message GetSubsystemsRequest {}
message GetSusbsytemsResponse {
map<string, bool> subsystems_status = 1;
}
message GetRPCEndpointsRequest {}
message RPCEndpoint {
bool started = 1;
string listen_address = 2;
}
message GetRPCEndpointsResponse {
map<string, RPCEndpoint> endpoints = 1;
}
message GenericExchangeNameRequest {
string exchange = 1;
}
message GetExchangesRequest {
bool enabled = 1;
}
message GetExchangesResponse {
string exchanges = 1;
}
message GetExchangeOTPResponse {
string otp_code = 1;
}
message GetExchangeOTPsRequest {}
message GetExchangeOTPsResponse {
map<string, string> otp_codes = 1;
}
message DisableExchangeRequest {
string exchange = 1;
}
message PairsSupported {
string available_pairs = 1;
string enabled_pairs = 2;
}
message GetExchangeInfoResponse {
string name = 1;
bool enabled = 2;
bool verbose = 3;
bool using_sandbox = 4;
string http_timeout = 5;
string http_useragent = 6;
string http_proxy = 7;
string base_currencies = 8;
map<string, PairsSupported> supported_assets = 9;
bool authenticated_api = 10;
}
message GetTickerRequest {
string exchange = 1;
CurrencyPair pair = 2;
string asset_type = 3;
}
message CurrencyPair {
string delimiter = 1;
string base = 2;
string quote = 3;
}
message TickerResponse {
CurrencyPair pair = 1;
int64 last_updated = 2;
string currency_pair = 3;
double last = 4;
double high = 5;
double low = 6;
double bid = 7;
double ask = 8;
double volume = 9;
double price_ath = 10;
}
message GetTickersRequest {}
message Tickers {
string exchange = 1;
repeated TickerResponse tickers = 2;
}
message GetTickersResponse {
repeated Tickers tickers = 1;
}
message GetOrderbookRequest {
string exchange = 1;
CurrencyPair pair = 2;
string asset_type = 3;
}
message OrderbookItem {
double amount = 1;
double price = 2;
int64 id = 3;
}
message OrderbookResponse {
CurrencyPair pair = 1;
string currency_pair = 2;
repeated OrderbookItem bids = 3;
repeated OrderbookItem asks = 4;
int64 last_updated = 5;
string asset_type = 6;
string error = 7;
}
message GetOrderbooksRequest {}
message Orderbooks {
string exchange = 1;
repeated OrderbookResponse orderbooks = 2;
}
message GetOrderbooksResponse {
repeated Orderbooks orderbooks = 1;
}
message GetAccountInfoRequest {
string exchange = 1;
string asset_type = 2;
}
message Account {
string id = 1;
repeated AccountCurrencyInfo currencies = 2;
}
message AccountCurrencyInfo {
string currency = 1;
double total_value = 2;
double hold = 3;
double free = 4;
double free_without_borrow = 5;
double borrowed = 6;
}
message GetAccountInfoResponse {
string exchange = 1;
repeated Account accounts = 2;
}
message GetConfigRequest {}
message GetConfigResponse {
bytes data = 1;
}
message PortfolioAddress {
string address = 1;
string coin_type = 2;
string description = 3;
double balance = 4;
}
message GetPortfolioRequest {}
message GetPortfolioResponse {
repeated PortfolioAddress portfolio = 1;
}
message GetPortfolioSummaryRequest {}
message Coin {
string coin = 1;
double balance = 2;
string address = 3;
double percentage = 4;
}
message OfflineCoinSummary {
string address = 1;
double balance = 2;
double percentage = 3;
}
message OnlineCoinSummary {
double balance = 1;
double percentage = 2;
}
message OfflineCoins {
repeated OfflineCoinSummary addresses = 1;
}
message OnlineCoins {
map<string, OnlineCoinSummary> coins = 1;
}
message GetPortfolioSummaryResponse {
repeated Coin coin_totals = 1;
repeated Coin coins_offline = 2;
map<string, OfflineCoins> coins_offline_summary = 3;
repeated Coin coins_online = 4;
map<string, OnlineCoins> coins_online_summary = 5;
}
message AddPortfolioAddressRequest {
string address = 1;
string coin_type = 2;
string description = 3;
double balance = 4;
string supported_exchanges = 5;
bool cold_storage = 6;
}
message RemovePortfolioAddressRequest {
string address = 1;
string coin_type = 2;
string description = 3;
}
message GetForexProvidersRequest {}
message ForexProvider {
string name = 1;
bool enabled = 2;
bool verbose = 3;
string rest_polling_delay = 4;
string api_key = 5;
int64 api_key_level = 6;
bool primary_provider = 7;
}
message GetForexProvidersResponse {
repeated ForexProvider forex_providers = 1;
}
message GetForexRatesRequest {}
message ForexRatesConversion {
string from = 1;
string to = 2;
double rate = 3;
double inverse_rate = 4;
}
message GetForexRatesResponse {
repeated ForexRatesConversion forex_rates = 1;
}
message OrderDetails {
string exchange = 1;
string id = 2;
string client_order_id = 3;
string base_currency = 4;
string quote_currency = 5;
string asset_type = 6;
string order_side = 7;
string order_type = 8;
string creation_time = 9;
string update_time = 10;
string status = 11;
double price = 12;
double amount = 13;
double open_volume = 14;
double fee = 15;
double cost = 16;
repeated TradeHistory trades = 17;
}
message TradeHistory {
int64 creation_time = 1;
string id = 2;
double price = 3;
double amount = 4;
string exchange = 5;
string asset_type = 6;
string order_side = 7;
double fee = 8;
double total = 9;
}
message GetOrdersRequest {
string exchange = 1;
string asset_type = 2;
CurrencyPair pair = 3;
string start_date = 4;
string end_date = 5;
}
message GetOrdersResponse {
repeated OrderDetails orders = 1;
}
message GetOrderRequest {
string exchange = 1;
string order_id = 2;
CurrencyPair pair = 3;
string asset = 4;
}
message SubmitOrderRequest {
string exchange = 1;
CurrencyPair pair = 2;
string side = 3;
string order_type = 4;
double amount = 5;
double price = 6;
string client_id = 7;
string asset_type = 8;
}
message Trades {
double amount = 1;
double price = 2;
double fee = 3;
string fee_asset = 4;
}
message SubmitOrderResponse {
bool order_placed = 1;
string order_id = 2;
repeated Trades trades = 3;
}
message SimulateOrderRequest {
string exchange = 1;
CurrencyPair pair = 2;
double amount = 3;
string side = 4;
}
message SimulateOrderResponse {
repeated OrderbookItem orders = 1;
double amount = 2;
double minimum_price = 3;
double maximum_price = 4;
double percentage_gain_loss = 5;
string status = 6;
}
message WhaleBombRequest {
string exchange = 1;
CurrencyPair pair = 2;
double price_target = 3;
string side = 4;
string asset_type = 5;
}
message CancelOrderRequest {
string exchange = 1;
string account_id = 2;
string order_id = 3;
CurrencyPair pair = 4;
string asset_type = 5;
string wallet_address = 6;
string side = 7;
}
message CancelBatchOrdersRequest {
string exchange = 1;
string account_id = 2;
string orders_id = 3;
CurrencyPair pair = 4;
string asset_type = 5;
string wallet_address = 6;
string side = 7;
}
message Orders {
string exchange = 1;
map<string, string> order_status = 2;
}
message CancelBatchOrdersResponse {
repeated Orders orders = 1;
}
message CancelAllOrdersRequest {
string exchange = 1;
}
message CancelAllOrdersResponse {
repeated Orders orders = 1;
int64 count = 2;
}
message GetEventsRequest {}
message ConditionParams {
string condition = 1;
double price = 2;
bool check_bids = 3;
bool check_asks = 4;
double orderbook_amount = 5;
}
message GetEventsResponse {
int64 id = 1;
string exchange = 2;
string item = 3;
ConditionParams condition_params = 4;
CurrencyPair pair = 5;
string action = 6;
bool executed = 7;
}
message AddEventRequest {
string exchange = 1;
string item = 2;
ConditionParams condition_params = 3;
CurrencyPair pair = 4;
string asset_type = 5;
string action = 6;
}
message AddEventResponse {
int64 id = 1;
}
message RemoveEventRequest {
int64 id = 1;
}
message GetCryptocurrencyDepositAddressesRequest {
string exchange = 1;
}
message DepositAddress {
string address = 1;
string tag = 2;
string chain = 3;
}
message DepositAddresses {
repeated DepositAddress addresses = 1;
}
message GetCryptocurrencyDepositAddressesResponse {
map<string, DepositAddresses> addresses = 1;
}
message GetCryptocurrencyDepositAddressRequest {
string exchange = 1;
string cryptocurrency = 2;
string chain = 3;
bool bypass = 4;
}
message GetCryptocurrencyDepositAddressResponse {
string address = 1;
string tag = 2;
}
message GetAvailableTransferChainsRequest {
string exchange = 1;
string cryptocurrency = 2;
}
message GetAvailableTransferChainsResponse {
repeated string chains = 1;
}
message WithdrawFiatRequest {
string exchange = 1;
string currency = 2;
double amount = 3;
string description = 4;
string bank_account_id = 5;
}
message WithdrawCryptoRequest {
string exchange = 1;
string address = 2;
string address_tag = 3;
string currency = 4;
double amount = 5;
double fee = 6;
string description = 7;
string chain = 8;
}
message WithdrawResponse {
string id = 1;
string status = 2;
}
message WithdrawalEventByIDRequest {
string id = 1;
}
message WithdrawalEventByIDResponse {
WithdrawalEventResponse event = 2;
}
message WithdrawalEventsByExchangeRequest {
string exchange = 1;
string id = 2;
int32 limit = 3;
string currency = 4;
string asset_type = 5;
}
message WithdrawalEventsByDateRequest {
string exchange = 1;
string start = 2;
string end = 3;
int32 limit = 4;
}
message WithdrawalEventsByExchangeResponse {
repeated WithdrawalEventResponse event = 2;
}
message WithdrawalEventResponse {
string id = 2;
WithdrawlExchangeEvent exchange = 3;
WithdrawalRequestEvent request = 4;
google.protobuf.Timestamp created_at = 5;
google.protobuf.Timestamp updated_at = 6;
}
message WithdrawlExchangeEvent {
string name = 1;
string id = 2;
string status = 3;
}
message WithdrawalRequestEvent {
string currency = 2;
string description = 3;
double amount = 4;
int32 type = 5;
FiatWithdrawalEvent fiat = 6;
CryptoWithdrawalEvent crypto = 7;
}
message FiatWithdrawalEvent {
string bank_name = 1;
string account_name = 2;
string account_number = 3;
string bsb = 4;
string swift = 5;
string iban = 6;
}
message CryptoWithdrawalEvent {
string address = 1;
string address_tag = 2;
double fee = 3;
string tx_id = 4;
}
message GetLoggerDetailsRequest {
string logger = 1;
}
message GetLoggerDetailsResponse {
bool info = 1;
bool debug = 2;
bool warn = 3;
bool error = 4;
}
message SetLoggerDetailsRequest {
string logger = 1;
string level = 2;
}
message GetExchangePairsRequest {
string exchange = 1;
string asset = 2;
}
message GetExchangePairsResponse {
map<string, PairsSupported> supported_assets = 1;
}
message SetExchangePairRequest {
string exchange = 1;
string asset_type = 2;
repeated CurrencyPair pairs = 3;
bool enable = 4;
}
message GetOrderbookStreamRequest {
string exchange = 1;
CurrencyPair pair = 2;
string asset_type = 3;
}
message GetExchangeOrderbookStreamRequest {
string exchange = 1;
}
message GetTickerStreamRequest {
string exchange = 1;
CurrencyPair pair = 2;
string asset_type = 3;
}
message GetExchangeTickerStreamRequest {
string exchange = 1;
}
message GetAuditEventRequest {
string start_date = 1;
string end_date = 2;
string order_by = 3;
int32 limit = 4;
int32 offset = 5;
}
message GetAuditEventResponse {
repeated AuditEvent events = 1;
}
message GetSavedTradesRequest {
string exchange = 1;
CurrencyPair pair = 2;
string asset_type = 3;
string start = 4;
string end = 5;
}
message SavedTrades {
double price = 1;
double amount = 2;
string side = 3;
string timestamp = 4;
string trade_id = 5;
}
message SavedTradesResponse {
string exchange_name = 1;
string asset = 2;
CurrencyPair pair = 3;
repeated SavedTrades trades = 4;
}
message ConvertTradesToCandlesRequest {
string exchange = 1;
CurrencyPair pair = 2;
string asset_type = 3;
string start = 4;
string end = 5;
int64 time_interval = 6;
bool sync = 7;
bool force = 8;
}
message GetHistoricCandlesRequest {
string exchange = 1;
CurrencyPair pair = 2;
string asset_type = 3;
string start = 4;
string end = 5;
int64 time_interval = 6;
bool ex_request = 7;
bool sync = 8;
bool use_db = 9;
bool fill_missing_with_trades = 10;
bool force = 11;
}
message GetHistoricCandlesResponse {
string exchange = 1;
CurrencyPair pair = 2;
string start = 3;
string end = 4;
string interval = 6;
repeated Candle candle = 5;
}
message Candle {
string time = 1;
double low = 2;
double high = 3;
double open = 4;
double close = 5;
double volume = 6;
bool is_partial = 7;
}
message AuditEvent {
string type = 1;
string identifier = 2;
string message = 3;
string timestamp = 4;
}
message GCTScript {
string uuid = 1;
string name = 2;
string path = 3;
string next_run = 4;
}
message GCTScriptExecuteRequest {
GCTScript script = 1;
}
message GCTScriptStopRequest {
GCTScript script = 1;
}
message GCTScriptStopAllRequest {}
message GCTScriptStatusRequest {}
message GCTScriptListAllRequest {}
message GCTScriptUploadRequest {
string script_name = 1;
string script_data = 2;
bytes data = 3;
bool archived = 4;
bool overwrite = 5;
}
message GCTScriptReadScriptRequest {
GCTScript script = 1;
}
message GCTScriptQueryRequest {
GCTScript script = 1;
}
message GCTScriptAutoLoadRequest {
string script = 1;
bool status = 2;
}
message GCTScriptStatusResponse {
string status = 1;
repeated GCTScript scripts = 2;
}
message GCTScriptQueryResponse {
string status = 1;
GCTScript script = 2;
string data = 3;
}
message GenericResponse {
string status = 1;
string data = 2;
}
message SetExchangeAssetRequest {
string exchange = 1;
string asset = 2;
bool enable = 3;
}
message SetExchangeAllPairsRequest {
string exchange = 1;
bool enable = 2;
}
message UpdateExchangeSupportedPairsRequest {
string exchange = 1;
}
message GetExchangeAssetsRequest {
string exchange = 1;
}
message GetExchangeAssetsResponse {
string assets = 1;
}
message WebsocketGetInfoRequest {
string exchange = 1;
}
message WebsocketGetInfoResponse {
string exchange = 1;
bool supported = 2;
bool enabled = 3;
bool authenticated_supported = 4;
bool authenticated = 5;
string running_url = 6;
string proxy_address = 7;
}
message WebsocketSetEnabledRequest {
string exchange = 1;
bool enable = 2;
}
message WebsocketGetSubscriptionsRequest {
string exchange = 1;
}
message WebsocketSubscription {
string channel = 1;
string currency = 2;
string asset = 3;
string params = 4;
}
message WebsocketGetSubscriptionsResponse {
string exchange = 1;
repeated WebsocketSubscription subscriptions = 2;
}
message WebsocketSetProxyRequest {
string exchange = 1;
string proxy = 2;
}
message WebsocketSetURLRequest {
string exchange = 1;
string url = 2;
}
message FindMissingCandlePeriodsRequest {
string exchange_name = 1;
string asset_type = 2;
CurrencyPair pair = 3;
int64 interval = 4;
string start = 5;
string end = 6;
}
message FindMissingTradePeriodsRequest {
string exchange_name = 1;
string asset_type = 2;
CurrencyPair pair = 3;
string start = 4;
string end = 5;
}
message FindMissingIntervalsResponse {
string exchange_name = 1;
string asset_type = 2;
CurrencyPair pair = 3;
repeated string missing_periods = 4;
string status = 5;
}
message SetExchangeTradeProcessingRequest {
string exchange = 1;
bool status = 2;
}
message UpsertDataHistoryJobRequest {
string nickname = 1;
string exchange = 2;
string asset = 3;
CurrencyPair pair = 4;
string start_date = 5;
string end_date = 6;
int64 interval = 7;
int64 request_size_limit = 8;
int64 data_type = 9;
int64 max_retry_attempts = 10;
int64 batch_size = 11;
bool insert_only = 12;
int64 conversion_interval = 13;
bool overwrite_existing_data = 14;
string prerequisite_job_nickname = 15;
int64 decimal_place_comparison = 16;
string secondary_exchange_name = 17;
double issue_tolerance_percentage = 18;
bool replace_on_issue = 19;
}
message InsertSequentialJobsRequest {
repeated UpsertDataHistoryJobRequest jobs = 1;
}
message InsertSequentialJobsResponse {
repeated UpsertDataHistoryJobResponse jobs = 1;
}
message UpsertDataHistoryJobResponse {
string message = 1;
string job_id = 2;
}
message GetDataHistoryJobDetailsRequest {
string id = 1;
string nickname = 2;
bool full_details = 3;
}
message DataHistoryJob {
string id = 1;
string nickname = 2;
string exchange = 3;
string asset = 4;
CurrencyPair pair = 5;
string start_date = 6;
string end_date = 7;
int64 interval = 8;
int64 request_size_limit = 9;
int64 max_retry_attempts = 10;
int64 batch_size = 11;
string status = 12;
string data_type = 13;
int64 conversion_interval = 14;
bool overwrite_existing_data = 15;
string prerequisite_job_nickname = 16;
int64 decimal_place_comparison = 17;
string secondary_exchange_name = 18;
double issue_tolerance_percentage = 19;
bool replace_on_issue = 20;
repeated DataHistoryJobResult job_results = 21;
repeated string result_summaries = 22;
}
message DataHistoryJobResult {
string start_date = 1;
string end_date = 2;
bool has_data = 3;
string message = 4;
string run_date = 5;
}
message DataHistoryJobs {
repeated DataHistoryJob results = 1;
}
message GetDataHistoryJobsBetweenRequest {
string start_date = 1;
string end_date = 2;
}
message SetDataHistoryJobStatusRequest {
string id = 1;
string nickname = 2;
int64 status = 3;
}
message UpdateDataHistoryJobPrerequisiteRequest {
string nickname = 1;
string prerequisite_job_nickname = 2;
}
message ModifyOrderRequest {
string exchange = 1;
string order_id = 2;
CurrencyPair pair = 3;
string asset = 4;
double amount = 5;
double price = 6;
}
message ModifyOrderResponse {
string modified_order_id = 1;
}
message CurrencyStateGetAllRequest {
string exchange = 1;
}
message CurrencyStateTradingRequest {
string exchange = 1;
string code = 2;
string asset = 3;
}