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
1001
1002
1003
1004
1005
1006
1007
// This file is @generated by prost-build.
/// Запрос получения списка доступных бирж
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExchangesRequest {}
/// Список доступных бирж
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExchangesResponse {
/// Информация о бирже
#[prost(message, repeated, tag = "1")]
pub exchanges: ::prost::alloc::vec::Vec<Exchange>,
}
/// Запрос получения списка доступных инструментов
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AssetsRequest {}
/// Список доступных инструментов
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AssetsResponse {
/// Информация об инструменте
#[prost(message, repeated, tag = "1")]
pub assets: ::prost::alloc::vec::Vec<Asset>,
}
/// Запрос получения списка доступных инструментов
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AllAssetsRequest {
/// Курсор для пагинации. Указывает sec_id инструмента, с которого должен начинаться список.
/// Для первого запроса оставьте поле пустым (значение 0).
/// Для последующих запросов используйте значение next_cursor из предыдущего ответа.
#[prost(int64, tag = "1")]
pub cursor: i64,
/// Фильтрация по статусу инструмента: выбираются только активные(неархивные) инструменты
/// По умолчанию: false.
#[prost(bool, tag = "2")]
pub only_active: bool,
/// Фильтрация по статусу инструмента: выбираются только неактивные(архивные) инструменты
/// По умолчанию: false.
#[prost(bool, tag = "3")]
pub only_disabled: bool,
}
/// Ответ, содержащий часть доступных инструментов.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AllAssetsResponse {
/// Часть списка инструментов
#[prost(message, repeated, tag = "1")]
pub assets: ::prost::alloc::vec::Vec<Asset>,
/// Курсор для получения следующей страницы. Содержит sec_id последнего инструмента в текущем списке.
/// Передайте это значение в поле cursor следующего запроса, чтобы получить следующую часть данных.
/// Если значение 0 или отсутствует — это последняя страница.
#[prost(int64, tag = "2")]
pub next_cursor: i64,
}
/// Запрос получения информации по конкретному инструменту
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetAssetRequest {
/// Символ инструмента
#[prost(string, tag = "1")]
pub symbol: ::prost::alloc::string::String,
/// ID аккаунта для которого будет подбираться информация по инструменту
#[prost(string, tag = "2")]
pub account_id: ::prost::alloc::string::String,
}
/// Список информации по конкретному инструменту
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetAssetResponse {
/// Код режима торгов
#[prost(string, tag = "1")]
pub board: ::prost::alloc::string::String,
/// Идентификатор инструмента
#[prost(string, tag = "2")]
pub id: ::prost::alloc::string::String,
/// Тикер инструмента
#[prost(string, tag = "3")]
pub ticker: ::prost::alloc::string::String,
/// mic идентификатор биржи
#[prost(string, tag = "4")]
pub mic: ::prost::alloc::string::String,
/// Isin идентификатор инструмента
#[prost(string, tag = "5")]
pub isin: ::prost::alloc::string::String,
/// Тип инструмента
#[prost(string, tag = "6")]
pub r#type: ::prost::alloc::string::String,
/// Наименование инструмента
#[prost(string, tag = "7")]
pub name: ::prost::alloc::string::String,
/// Кол-во десятичных знаков в цене
#[prost(int32, tag = "10")]
pub decimals: i32,
/// Минимальный шаг цены. Для расчета финального ценового шага: min_step/(10ˆdecimals)
#[prost(int64, tag = "11")]
pub min_step: i64,
/// Кол-во штук в лоте
#[prost(message, optional, tag = "9")]
pub lot_size: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
/// Дата экспирации фьючерса
#[deprecated]
#[prost(message, optional, tag = "12")]
pub expiration_date: ::core::option::Option<
super::super::super::super::google::r#type::Date,
>,
/// Валюта котировки, может не совпадать с валютой режима торгов инструмента
#[prost(string, tag = "13")]
pub quote_currency: ::prost::alloc::string::String,
#[prost(oneof = "get_asset_response::AssetDetails", tags = "14, 15, 16")]
pub asset_details: ::core::option::Option<get_asset_response::AssetDetails>,
}
/// Nested message and enum types in `GetAssetResponse`.
pub mod get_asset_response {
/// Специфичные параметры для инструмента типа "Фьючерс"
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FutureDetails {
/// Дата и время экспирации (исполнения) фьючерсного контракта.
#[prost(message, optional, tag = "1")]
pub expiration_date: ::core::option::Option<::prost_types::Timestamp>,
/// Размер контракта (мультипликатор) — количество единиц базового актива в одном контракте.
#[prost(message, optional, tag = "2")]
pub contract_size: ::core::option::Option<
super::super::super::super::super::google::r#type::Decimal,
>,
}
/// Специфичные параметры для инструмента типа "Опцион"
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct OptionDetails {
/// Дата и время экспирации (исполнения) опционного контракта.
#[prost(message, optional, tag = "1")]
pub expiration_date: ::core::option::Option<::prost_types::Timestamp>,
/// Размер контракта (мультипликатор) — количество единиц базового актива в одном контракте.
#[prost(message, optional, tag = "2")]
pub contract_size: ::core::option::Option<
super::super::super::super::super::google::r#type::Decimal,
>,
/// Цена исполнения (страйк) опциона.
#[prost(message, optional, tag = "3")]
pub strike: ::core::option::Option<
super::super::super::super::super::google::r#type::Decimal,
>,
}
/// Специфичные параметры для инструмента типа "Облигация"
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BondDetails {
/// Текущая номинальная стоимость одной облигации.
#[prost(message, optional, tag = "1")]
pub bond_face_value: ::core::option::Option<
super::super::super::super::super::google::r#type::Decimal,
>,
/// Символьный код валюты номинала облигации (например, RUB, USD).
#[prost(string, tag = "2")]
pub currency: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum AssetDetails {
/// Специфичные параметры для инструмента типа "Фьючерс"
#[prost(message, tag = "14")]
FutureDetails(FutureDetails),
/// Специфичные параметры для инструмента типа "Опцион"
#[prost(message, tag = "15")]
OptionDetails(OptionDetails),
/// Специфичные параметры для инструмента типа "Облигация"
#[prost(message, tag = "16")]
BondDetails(BondDetails),
}
}
/// Запрос торговых параметров инструмента
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetAssetParamsRequest {
/// Символ инструмента
#[prost(string, tag = "1")]
pub symbol: ::prost::alloc::string::String,
/// ID аккаунта для которого будут подбираться торговые параметры
#[prost(string, tag = "2")]
pub account_id: ::prost::alloc::string::String,
}
/// Торговые параметры инструмента
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetAssetParamsResponse {
/// Символ инструмента
#[prost(string, tag = "1")]
pub symbol: ::prost::alloc::string::String,
/// ID аккаунта для которого подбираются торговые параметры
#[prost(string, tag = "2")]
pub account_id: ::prost::alloc::string::String,
/// Доступны ли торговые операции
/// Старое поле, помечено как устаревшее.
/// Клиентам следует перейти на is_tradeable.
#[deprecated]
#[prost(bool, tag = "3")]
pub tradeable: bool,
/// Доступны ли операции в Лонг
#[prost(message, optional, tag = "4")]
pub longable: ::core::option::Option<Longable>,
/// Доступны ли операции в Шорт
#[prost(message, optional, tag = "5")]
pub shortable: ::core::option::Option<Shortable>,
/// Ставка риска для операции в Лонг
#[prost(message, optional, tag = "6")]
pub long_risk_rate: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
/// Сумма обеспечения для поддержания позиции Лонг
#[deprecated]
#[prost(message, optional, tag = "7")]
pub long_collateral: ::core::option::Option<
super::super::super::super::google::r#type::Money,
>,
/// Ставка риска для операции в Шорт
#[prost(message, optional, tag = "8")]
pub short_risk_rate: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
/// Сумма обеспечения для поддержания позиции Шорт
#[deprecated]
#[prost(message, optional, tag = "9")]
pub short_collateral: ::core::option::Option<
super::super::super::super::google::r#type::Money,
>,
/// Начальные требования, сколько на счету должно быть свободных денежных средств, чтобы открыть лонг позицию, для FORTS счетов равен биржевому ГО
#[prost(message, optional, tag = "10")]
pub long_initial_margin: ::core::option::Option<
super::super::super::super::google::r#type::Money,
>,
/// Начальные требования, сколько на счету должно быть свободных денежных средств, чтобы открыть шорт позицию, для FORTS счетов равен биржевому ГО
#[prost(message, optional, tag = "11")]
pub short_initial_margin: ::core::option::Option<
super::super::super::super::google::r#type::Money,
>,
/// Доступны ли торговые операции
/// Новое поле. Позволяет различать false и "не установлено".
#[prost(message, optional, tag = "12")]
pub is_tradable: ::core::option::Option<bool>,
/// Допустимая цена. Помогает определить можно ли выставлять ордера с отрицательной ценой для финансового инструмента
#[prost(enumeration = "PriceType", tag = "13")]
pub price_type: i32,
}
/// Запрос получения цепочки опционов
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct OptionsChainRequest {
/// Символ базового актива опциона
#[prost(string, tag = "1")]
pub underlying_symbol: ::prost::alloc::string::String,
/// Опциональный параметр. Актуален для опционов на фьючерсы, по типу (недельные, месячные).
/// Если параметр не указан, будут возвращены опционы с ближайшей датой экспирации.
#[prost(string, tag = "2")]
pub root: ::prost::alloc::string::String,
/// Опциональный фильтр по дате экспирации опционов.
/// Если параметр не указан, будут возвращены опционы с ближайшей датой экспирации.
#[prost(message, optional, tag = "3")]
pub expiration_date: ::core::option::Option<
super::super::super::super::google::r#type::Date,
>,
}
/// Информация о цепочке опционов
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OptionsChainResponse {
/// Символ базового актива опциона
#[prost(string, tag = "1")]
pub symbol: ::prost::alloc::string::String,
/// Информация об опционе
#[prost(message, repeated, tag = "2")]
pub options: ::prost::alloc::vec::Vec<Option>,
}
/// Запрос получения расписания инструмента
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ScheduleRequest {
/// Символ инструмента
#[prost(string, tag = "1")]
pub symbol: ::prost::alloc::string::String,
}
/// Расписание инструмента
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ScheduleResponse {
/// Символ инструмента
#[prost(string, tag = "1")]
pub symbol: ::prost::alloc::string::String,
/// Сессии инструмента
#[prost(message, repeated, tag = "2")]
pub sessions: ::prost::alloc::vec::Vec<schedule_response::Sessions>,
}
/// Nested message and enum types in `ScheduleResponse`.
pub mod schedule_response {
/// Сессии
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Sessions {
/// Тип сессии
#[prost(string, tag = "1")]
pub r#type: ::prost::alloc::string::String,
/// Интервал сессии
#[prost(message, optional, tag = "2")]
pub interval: ::core::option::Option<
super::super::super::super::super::google::r#type::Interval,
>,
}
}
/// Запрос получения времени на сервере
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ClockRequest {}
/// Время на сервере
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ClockResponse {
/// Метка времени
#[prost(message, optional, tag = "1")]
pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
}
/// Информация о бирже
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Exchange {
/// Идентификатор биржи mic
#[prost(string, tag = "1")]
pub mic: ::prost::alloc::string::String,
/// Наименование биржи
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
}
/// Информация об инструменте
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Asset {
/// Символ инструмента ticker@mic
#[prost(string, tag = "1")]
pub symbol: ::prost::alloc::string::String,
/// Идентификатор инструмента
#[prost(string, tag = "2")]
pub id: ::prost::alloc::string::String,
/// Тикер инструмента
#[prost(string, tag = "3")]
pub ticker: ::prost::alloc::string::String,
/// mic идентификатор биржи
#[prost(string, tag = "4")]
pub mic: ::prost::alloc::string::String,
/// Isin идентификатор инструмента
#[prost(string, tag = "5")]
pub isin: ::prost::alloc::string::String,
/// Тип инструмента
#[prost(string, tag = "6")]
pub r#type: ::prost::alloc::string::String,
/// Наименование инструмента
#[prost(string, tag = "7")]
pub name: ::prost::alloc::string::String,
/// Архивный инструмент или нет
#[prost(bool, tag = "8")]
pub is_archived: bool,
}
/// Информация об опционе
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Option {
/// Символ инструмента
#[prost(string, tag = "1")]
pub symbol: ::prost::alloc::string::String,
/// Тип инструмента
#[prost(enumeration = "option::Type", tag = "2")]
pub r#type: i32,
/// Лот, количество базового актива в инструменте
#[prost(message, optional, tag = "4")]
pub contract_size: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
/// Дата старта торговли
#[prost(message, optional, tag = "5")]
pub trade_first_day: ::core::option::Option<
super::super::super::super::google::r#type::Date,
>,
/// Дата окончания торговли
#[prost(message, optional, tag = "6")]
pub trade_last_day: ::core::option::Option<
super::super::super::super::google::r#type::Date,
>,
/// Цена исполнения опциона
#[prost(message, optional, tag = "7")]
pub strike: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
/// Множитель опциона
#[prost(message, optional, tag = "9")]
pub multiplier: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
/// Дата начала экспирации
#[prost(message, optional, tag = "10")]
pub expiration_first_day: ::core::option::Option<
super::super::super::super::google::r#type::Date,
>,
/// Дата окончания экспирации
#[prost(message, optional, tag = "11")]
pub expiration_last_day: ::core::option::Option<
super::super::super::super::google::r#type::Date,
>,
}
/// Nested message and enum types in `Option`.
pub mod option {
/// Тип опциона
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Type {
/// Неопределенное значение
Unspecified = 0,
/// Колл
Call = 1,
/// Пут
Put = 2,
}
impl Type {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "TYPE_UNSPECIFIED",
Self::Call => "TYPE_CALL",
Self::Put => "TYPE_PUT",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"TYPE_CALL" => Some(Self::Call),
"TYPE_PUT" => Some(Self::Put),
_ => None,
}
}
}
}
/// Доступны ли операции в Лонг
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Longable {
/// Статус инструмента
#[prost(enumeration = "longable::Status", tag = "1")]
pub value: i32,
/// Сколько дней действует запрет на операции в Лонг (если есть)
#[prost(int32, tag = "2")]
pub halted_days: i32,
}
/// Nested message and enum types in `Longable`.
pub mod longable {
/// Статус
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Status {
/// Не доступен
NotAvailable = 0,
/// Доступен
Available = 1,
/// Запрещено на уровне счета
AccountNotApproved = 2,
}
impl Status {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::NotAvailable => "NOT_AVAILABLE",
Self::Available => "AVAILABLE",
Self::AccountNotApproved => "ACCOUNT_NOT_APPROVED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"NOT_AVAILABLE" => Some(Self::NotAvailable),
"AVAILABLE" => Some(Self::Available),
"ACCOUNT_NOT_APPROVED" => Some(Self::AccountNotApproved),
_ => None,
}
}
}
}
/// Доступны ли операции в Шорт
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Shortable {
/// Статус инструмента
#[prost(enumeration = "shortable::Status", tag = "1")]
pub value: i32,
/// Сколько дней действует запрет на операции в Шорт (если есть)
#[prost(int32, tag = "2")]
pub halted_days: i32,
}
/// Nested message and enum types in `Shortable`.
pub mod shortable {
/// Статус
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Status {
/// Не доступен
NotAvailable = 0,
/// Доступен
Available = 1,
/// Признак того, что бумага Hard To Borrow (если есть)
Htb = 2,
/// Запрещено на уровне счета
AccountNotApproved = 3,
/// Разрешено в составе стратегии
AvailableStrategy = 4,
}
impl Status {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::NotAvailable => "NOT_AVAILABLE",
Self::Available => "AVAILABLE",
Self::Htb => "HTB",
Self::AccountNotApproved => "ACCOUNT_NOT_APPROVED",
Self::AvailableStrategy => "AVAILABLE_STRATEGY",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"NOT_AVAILABLE" => Some(Self::NotAvailable),
"AVAILABLE" => Some(Self::Available),
"HTB" => Some(Self::Htb),
"ACCOUNT_NOT_APPROVED" => Some(Self::AccountNotApproved),
"AVAILABLE_STRATEGY" => Some(Self::AvailableStrategy),
_ => None,
}
}
}
}
/// Запрос на получение состава индекса
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetConstituentsRequest {
/// Символьный код индекса (например, "SPX@\_SP", "NDX@\_SCI")
#[prost(string, tag = "1")]
pub symbol: ::prost::alloc::string::String,
/// Курсор для пагинации. Указывает sec_id инструмента, с которого должен начинаться список.
/// Для первого запроса оставьте поле пустым (значение 0).
/// Для последующих запросов используйте значение next_cursor из предыдущего ответа.
#[prost(int64, tag = "2")]
pub cursor: i64,
}
/// Результат запроса состава индекса
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetConstituentsResponse {
/// Список компонентов (ценных бумаг), входящих в базу расчета запрошенного индекса
#[prost(message, repeated, tag = "1")]
pub constituents: ::prost::alloc::vec::Vec<Constituents>,
/// Курсор для получения следующей страницы. Содержит sec_id последнего инструмента в текущем списке.
/// Передайте это значение в поле cursor следующего запроса, чтобы получить следующую часть данных.
/// Если значение 0 или отсутствует — это последняя страница
#[prost(int64, tag = "2")]
pub next_cursor: i64,
}
/// Информация о компоненте (ценной бумаге), входящем в индекс
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Constituents {
/// Символьный код инструмента
#[prost(string, tag = "1")]
pub symbol: ::prost::alloc::string::String,
/// Полное наименование компании-эмитента
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
/// Глобальный сектор экономики, к которому относится компания (например, "Technology", "Healthcare")
#[prost(string, tag = "3")]
pub sector: ::prost::alloc::string::String,
/// Отрасль (подотрасль) деятельности компании (например, "Software - Application")
#[prost(string, tag = "4")]
pub sub_sector: ::prost::alloc::string::String,
/// Уникальный идентификатор компании в базе данных SEC США (Central Index Key)
#[prost(string, tag = "5")]
pub cik: ::prost::alloc::string::String,
}
/// Допустимая цена
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum PriceType {
/// Неизвестно
Unknown = 0,
/// Положительная. Больше нуля
Positive = 1,
/// Неотрицательная. Больше или равна нулю
NonNegative = 2,
/// Любая
Any = 3,
}
impl PriceType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unknown => "UNKNOWN",
Self::Positive => "POSITIVE",
Self::NonNegative => "NON_NEGATIVE",
Self::Any => "ANY",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UNKNOWN" => Some(Self::Unknown),
"POSITIVE" => Some(Self::Positive),
"NON_NEGATIVE" => Some(Self::NonNegative),
"ANY" => Some(Self::Any),
_ => None,
}
}
}
/// Generated client implementations.
pub mod assets_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// Сервис инструментов
#[derive(Debug, Clone)]
pub struct AssetsServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl AssetsServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> AssetsServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> AssetsServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
AssetsServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// Получение списка доступных бирж, названия и mic коды
/// Пример HTTP запроса:
/// GET /v1/exchanges
/// Authorization: <token>
pub async fn exchanges(
&mut self,
request: impl tonic::IntoRequest<super::ExchangesRequest>,
) -> std::result::Result<
tonic::Response<super::ExchangesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grpc.tradeapi.v1.assets.AssetsService/Exchanges",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("grpc.tradeapi.v1.assets.AssetsService", "Exchanges"),
);
self.inner.unary(req, path, codec).await
}
/// Получение списка доступных для торговли инструментов, их описание
/// Пример HTTP запроса:
/// GET /v1/assets
/// Authorization: <token>
#[deprecated]
pub async fn assets(
&mut self,
request: impl tonic::IntoRequest<super::AssetsRequest>,
) -> std::result::Result<tonic::Response<super::AssetsResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grpc.tradeapi.v1.assets.AssetsService/Assets",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("grpc.tradeapi.v1.assets.AssetsService", "Assets"),
);
self.inner.unary(req, path, codec).await
}
/// Получение списка всех инструментов, в том числе индикативных и архивных, их описание
/// Пример HTTP запроса:
/// GET /v1/assets/all?cursor=56658&only_disabled=true
/// Authorization: <token>
pub async fn all_assets(
&mut self,
request: impl tonic::IntoRequest<super::AllAssetsRequest>,
) -> std::result::Result<
tonic::Response<super::AllAssetsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grpc.tradeapi.v1.assets.AssetsService/AllAssets",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("grpc.tradeapi.v1.assets.AssetsService", "AllAssets"),
);
self.inner.unary(req, path, codec).await
}
/// Получение информации по конкретному инструменту
/// Пример HTTP запроса:
/// GET /v1/assets/SBER@MISX?account_id=1440399
/// Authorization: <token>
///
/// Параметры:
///
/// * symbol - передается в URL пути
/// * account_id - передаётся как query-параметр
pub async fn get_asset(
&mut self,
request: impl tonic::IntoRequest<super::GetAssetRequest>,
) -> std::result::Result<
tonic::Response<super::GetAssetResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grpc.tradeapi.v1.assets.AssetsService/GetAsset",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("grpc.tradeapi.v1.assets.AssetsService", "GetAsset"),
);
self.inner.unary(req, path, codec).await
}
/// Получение торговых параметров по инструменту
/// Пример HTTP запроса:
/// GET /v1/assets/SBER@MISX/params?account_id=1440399
/// Authorization: <token>
///
/// Параметры:
///
/// * symbol - передается в URL пути
/// * account_id - передаётся как query-параметр
pub async fn get_asset_params(
&mut self,
request: impl tonic::IntoRequest<super::GetAssetParamsRequest>,
) -> std::result::Result<
tonic::Response<super::GetAssetParamsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grpc.tradeapi.v1.assets.AssetsService/GetAssetParams",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"grpc.tradeapi.v1.assets.AssetsService",
"GetAssetParams",
),
);
self.inner.unary(req, path, codec).await
}
/// Получение цепочки опционов для базового актива
/// Пример HTTP запроса:
/// GET /v1/assets/SBER@MISX/options
/// Authorization: <token>
pub async fn options_chain(
&mut self,
request: impl tonic::IntoRequest<super::OptionsChainRequest>,
) -> std::result::Result<
tonic::Response<super::OptionsChainResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grpc.tradeapi.v1.assets.AssetsService/OptionsChain",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"grpc.tradeapi.v1.assets.AssetsService",
"OptionsChain",
),
);
self.inner.unary(req, path, codec).await
}
/// Получение расписания торгов для инструмента
/// Пример HTTP запроса:
/// GET /v1/assets/SBER@MISX/schedule
/// Authorization: <token>
pub async fn schedule(
&mut self,
request: impl tonic::IntoRequest<super::ScheduleRequest>,
) -> std::result::Result<
tonic::Response<super::ScheduleResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grpc.tradeapi.v1.assets.AssetsService/Schedule",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("grpc.tradeapi.v1.assets.AssetsService", "Schedule"),
);
self.inner.unary(req, path, codec).await
}
/// Получение времени на сервере
/// Пример HTTP запроса:
/// GET /v1/assets/clock
/// Authorization: <token>
pub async fn clock(
&mut self,
request: impl tonic::IntoRequest<super::ClockRequest>,
) -> std::result::Result<tonic::Response<super::ClockResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grpc.tradeapi.v1.assets.AssetsService/Clock",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("grpc.tradeapi.v1.assets.AssetsService", "Clock"),
);
self.inner.unary(req, path, codec).await
}
/// Получить состав биржевого индекса по его символу
pub async fn get_constituents(
&mut self,
request: impl tonic::IntoRequest<super::GetConstituentsRequest>,
) -> std::result::Result<
tonic::Response<super::GetConstituentsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grpc.tradeapi.v1.assets.AssetsService/GetConstituents",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"grpc.tradeapi.v1.assets.AssetsService",
"GetConstituents",
),
);
self.inner.unary(req, path, codec).await
}
}
}