#![allow(clippy::tabs_in_doc_comments)]
#![allow(clippy::large_enum_variant)]
#![allow(clippy::enum_variant_names)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MoneyValue {
#[prost(string, tag = "1")]
pub currency: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub units: i64,
#[prost(int32, tag = "3")]
pub nano: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Quotation {
#[prost(int64, tag = "1")]
pub units: i64,
#[prost(int32, tag = "2")]
pub nano: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Ping {
#[prost(message, optional, tag = "1")]
pub time: ::core::option::Option<::prost_types::Timestamp>,
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum InstrumentType {
Unspecified = 0,
Bond = 1,
Share = 2,
Currency = 3,
Etf = 4,
Futures = 5,
Sp = 6,
Option = 7,
ClearingCertificate = 8,
}
impl InstrumentType {
pub fn as_str_name(&self) -> &'static str {
match self {
InstrumentType::Unspecified => "INSTRUMENT_TYPE_UNSPECIFIED",
InstrumentType::Bond => "INSTRUMENT_TYPE_BOND",
InstrumentType::Share => "INSTRUMENT_TYPE_SHARE",
InstrumentType::Currency => "INSTRUMENT_TYPE_CURRENCY",
InstrumentType::Etf => "INSTRUMENT_TYPE_ETF",
InstrumentType::Futures => "INSTRUMENT_TYPE_FUTURES",
InstrumentType::Sp => "INSTRUMENT_TYPE_SP",
InstrumentType::Option => "INSTRUMENT_TYPE_OPTION",
InstrumentType::ClearingCertificate => {
"INSTRUMENT_TYPE_CLEARING_CERTIFICATE"
}
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"INSTRUMENT_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"INSTRUMENT_TYPE_BOND" => Some(Self::Bond),
"INSTRUMENT_TYPE_SHARE" => Some(Self::Share),
"INSTRUMENT_TYPE_CURRENCY" => Some(Self::Currency),
"INSTRUMENT_TYPE_ETF" => Some(Self::Etf),
"INSTRUMENT_TYPE_FUTURES" => Some(Self::Futures),
"INSTRUMENT_TYPE_SP" => Some(Self::Sp),
"INSTRUMENT_TYPE_OPTION" => Some(Self::Option),
"INSTRUMENT_TYPE_CLEARING_CERTIFICATE" => {
Some(Self::ClearingCertificate)
}
_ => None,
}
}
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum SecurityTradingStatus {
Unspecified = 0,
NotAvailableForTrading = 1,
OpeningPeriod = 2,
ClosingPeriod = 3,
BreakInTrading = 4,
NormalTrading = 5,
ClosingAuction = 6,
DarkPoolAuction = 7,
DiscreteAuction = 8,
OpeningAuctionPeriod = 9,
TradingAtClosingAuctionPrice = 10,
SessionAssigned = 11,
SessionClose = 12,
SessionOpen = 13,
DealerNormalTrading = 14,
DealerBreakInTrading = 15,
DealerNotAvailableForTrading = 16,
}
impl SecurityTradingStatus {
pub fn as_str_name(&self) -> &'static str {
match self {
SecurityTradingStatus::Unspecified => {
"SECURITY_TRADING_STATUS_UNSPECIFIED"
}
SecurityTradingStatus::NotAvailableForTrading => {
"SECURITY_TRADING_STATUS_NOT_AVAILABLE_FOR_TRADING"
}
SecurityTradingStatus::OpeningPeriod => {
"SECURITY_TRADING_STATUS_OPENING_PERIOD"
}
SecurityTradingStatus::ClosingPeriod => {
"SECURITY_TRADING_STATUS_CLOSING_PERIOD"
}
SecurityTradingStatus::BreakInTrading => {
"SECURITY_TRADING_STATUS_BREAK_IN_TRADING"
}
SecurityTradingStatus::NormalTrading => {
"SECURITY_TRADING_STATUS_NORMAL_TRADING"
}
SecurityTradingStatus::ClosingAuction => {
"SECURITY_TRADING_STATUS_CLOSING_AUCTION"
}
SecurityTradingStatus::DarkPoolAuction => {
"SECURITY_TRADING_STATUS_DARK_POOL_AUCTION"
}
SecurityTradingStatus::DiscreteAuction => {
"SECURITY_TRADING_STATUS_DISCRETE_AUCTION"
}
SecurityTradingStatus::OpeningAuctionPeriod => {
"SECURITY_TRADING_STATUS_OPENING_AUCTION_PERIOD"
}
SecurityTradingStatus::TradingAtClosingAuctionPrice => {
"SECURITY_TRADING_STATUS_TRADING_AT_CLOSING_AUCTION_PRICE"
}
SecurityTradingStatus::SessionAssigned => {
"SECURITY_TRADING_STATUS_SESSION_ASSIGNED"
}
SecurityTradingStatus::SessionClose => {
"SECURITY_TRADING_STATUS_SESSION_CLOSE"
}
SecurityTradingStatus::SessionOpen => {
"SECURITY_TRADING_STATUS_SESSION_OPEN"
}
SecurityTradingStatus::DealerNormalTrading => {
"SECURITY_TRADING_STATUS_DEALER_NORMAL_TRADING"
}
SecurityTradingStatus::DealerBreakInTrading => {
"SECURITY_TRADING_STATUS_DEALER_BREAK_IN_TRADING"
}
SecurityTradingStatus::DealerNotAvailableForTrading => {
"SECURITY_TRADING_STATUS_DEALER_NOT_AVAILABLE_FOR_TRADING"
}
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SECURITY_TRADING_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
"SECURITY_TRADING_STATUS_NOT_AVAILABLE_FOR_TRADING" => {
Some(Self::NotAvailableForTrading)
}
"SECURITY_TRADING_STATUS_OPENING_PERIOD" => {
Some(Self::OpeningPeriod)
}
"SECURITY_TRADING_STATUS_CLOSING_PERIOD" => {
Some(Self::ClosingPeriod)
}
"SECURITY_TRADING_STATUS_BREAK_IN_TRADING" => {
Some(Self::BreakInTrading)
}
"SECURITY_TRADING_STATUS_NORMAL_TRADING" => {
Some(Self::NormalTrading)
}
"SECURITY_TRADING_STATUS_CLOSING_AUCTION" => {
Some(Self::ClosingAuction)
}
"SECURITY_TRADING_STATUS_DARK_POOL_AUCTION" => {
Some(Self::DarkPoolAuction)
}
"SECURITY_TRADING_STATUS_DISCRETE_AUCTION" => {
Some(Self::DiscreteAuction)
}
"SECURITY_TRADING_STATUS_OPENING_AUCTION_PERIOD" => {
Some(Self::OpeningAuctionPeriod)
}
"SECURITY_TRADING_STATUS_TRADING_AT_CLOSING_AUCTION_PRICE" => {
Some(Self::TradingAtClosingAuctionPrice)
}
"SECURITY_TRADING_STATUS_SESSION_ASSIGNED" => {
Some(Self::SessionAssigned)
}
"SECURITY_TRADING_STATUS_SESSION_CLOSE" => {
Some(Self::SessionClose)
}
"SECURITY_TRADING_STATUS_SESSION_OPEN" => Some(Self::SessionOpen),
"SECURITY_TRADING_STATUS_DEALER_NORMAL_TRADING" => {
Some(Self::DealerNormalTrading)
}
"SECURITY_TRADING_STATUS_DEALER_BREAK_IN_TRADING" => {
Some(Self::DealerBreakInTrading)
}
"SECURITY_TRADING_STATUS_DEALER_NOT_AVAILABLE_FOR_TRADING" => {
Some(Self::DealerNotAvailableForTrading)
}
_ => None,
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MarketDataRequest {
#[prost(
oneof = "market_data_request::Payload",
tags = "1, 2, 3, 4, 5, 6"
)]
pub payload: ::core::option::Option<market_data_request::Payload>,
}
pub mod market_data_request {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Payload {
#[prost(message, tag = "1")]
SubscribeCandlesRequest(super::SubscribeCandlesRequest),
#[prost(message, tag = "2")]
SubscribeOrderBookRequest(super::SubscribeOrderBookRequest),
#[prost(message, tag = "3")]
SubscribeTradesRequest(super::SubscribeTradesRequest),
#[prost(message, tag = "4")]
SubscribeInfoRequest(super::SubscribeInfoRequest),
#[prost(message, tag = "5")]
SubscribeLastPriceRequest(super::SubscribeLastPriceRequest),
#[prost(message, tag = "6")]
GetMySubscriptions(super::GetMySubscriptions),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MarketDataServerSideStreamRequest {
#[prost(message, optional, tag = "1")]
pub subscribe_candles_request:
::core::option::Option<SubscribeCandlesRequest>,
#[prost(message, optional, tag = "2")]
pub subscribe_order_book_request:
::core::option::Option<SubscribeOrderBookRequest>,
#[prost(message, optional, tag = "3")]
pub subscribe_trades_request:
::core::option::Option<SubscribeTradesRequest>,
#[prost(message, optional, tag = "4")]
pub subscribe_info_request: ::core::option::Option<SubscribeInfoRequest>,
#[prost(message, optional, tag = "5")]
pub subscribe_last_price_request:
::core::option::Option<SubscribeLastPriceRequest>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MarketDataResponse {
#[prost(
oneof = "market_data_response::Payload",
tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11"
)]
pub payload: ::core::option::Option<market_data_response::Payload>,
}
pub mod market_data_response {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Payload {
#[prost(message, tag = "1")]
SubscribeCandlesResponse(super::SubscribeCandlesResponse),
#[prost(message, tag = "2")]
SubscribeOrderBookResponse(super::SubscribeOrderBookResponse),
#[prost(message, tag = "3")]
SubscribeTradesResponse(super::SubscribeTradesResponse),
#[prost(message, tag = "4")]
SubscribeInfoResponse(super::SubscribeInfoResponse),
#[prost(message, tag = "5")]
Candle(super::Candle),
#[prost(message, tag = "6")]
Trade(super::Trade),
#[prost(message, tag = "7")]
Orderbook(super::OrderBook),
#[prost(message, tag = "8")]
TradingStatus(super::TradingStatus),
#[prost(message, tag = "9")]
Ping(super::Ping),
#[prost(message, tag = "10")]
SubscribeLastPriceResponse(super::SubscribeLastPriceResponse),
#[prost(message, tag = "11")]
LastPrice(super::LastPrice),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeCandlesRequest {
#[prost(enumeration = "SubscriptionAction", tag = "1")]
pub subscription_action: i32,
#[prost(message, repeated, tag = "2")]
pub instruments: ::prost::alloc::vec::Vec<CandleInstrument>,
#[prost(bool, tag = "3")]
pub waiting_close: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CandleInstrument {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(enumeration = "SubscriptionInterval", tag = "2")]
pub interval: i32,
#[prost(string, tag = "3")]
pub instrument_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeCandlesResponse {
#[prost(string, tag = "1")]
pub tracking_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub candles_subscriptions: ::prost::alloc::vec::Vec<CandleSubscription>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CandleSubscription {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(enumeration = "SubscriptionInterval", tag = "2")]
pub interval: i32,
#[prost(enumeration = "SubscriptionStatus", tag = "3")]
pub subscription_status: i32,
#[prost(string, tag = "4")]
pub instrument_uid: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeOrderBookRequest {
#[prost(enumeration = "SubscriptionAction", tag = "1")]
pub subscription_action: i32,
#[prost(message, repeated, tag = "2")]
pub instruments: ::prost::alloc::vec::Vec<OrderBookInstrument>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OrderBookInstrument {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub depth: i32,
#[prost(string, tag = "3")]
pub instrument_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeOrderBookResponse {
#[prost(string, tag = "1")]
pub tracking_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub order_book_subscriptions:
::prost::alloc::vec::Vec<OrderBookSubscription>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OrderBookSubscription {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub depth: i32,
#[prost(enumeration = "SubscriptionStatus", tag = "3")]
pub subscription_status: i32,
#[prost(string, tag = "4")]
pub instrument_uid: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeTradesRequest {
#[prost(enumeration = "SubscriptionAction", tag = "1")]
pub subscription_action: i32,
#[prost(message, repeated, tag = "2")]
pub instruments: ::prost::alloc::vec::Vec<TradeInstrument>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TradeInstrument {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub instrument_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeTradesResponse {
#[prost(string, tag = "1")]
pub tracking_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub trade_subscriptions: ::prost::alloc::vec::Vec<TradeSubscription>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TradeSubscription {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(enumeration = "SubscriptionStatus", tag = "2")]
pub subscription_status: i32,
#[prost(string, tag = "3")]
pub instrument_uid: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeInfoRequest {
#[prost(enumeration = "SubscriptionAction", tag = "1")]
pub subscription_action: i32,
#[prost(message, repeated, tag = "2")]
pub instruments: ::prost::alloc::vec::Vec<InfoInstrument>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InfoInstrument {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub instrument_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeInfoResponse {
#[prost(string, tag = "1")]
pub tracking_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub info_subscriptions: ::prost::alloc::vec::Vec<InfoSubscription>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InfoSubscription {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(enumeration = "SubscriptionStatus", tag = "2")]
pub subscription_status: i32,
#[prost(string, tag = "3")]
pub instrument_uid: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeLastPriceRequest {
#[prost(enumeration = "SubscriptionAction", tag = "1")]
pub subscription_action: i32,
#[prost(message, repeated, tag = "2")]
pub instruments: ::prost::alloc::vec::Vec<LastPriceInstrument>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LastPriceInstrument {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub instrument_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeLastPriceResponse {
#[prost(string, tag = "1")]
pub tracking_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub last_price_subscriptions:
::prost::alloc::vec::Vec<LastPriceSubscription>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LastPriceSubscription {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(enumeration = "SubscriptionStatus", tag = "2")]
pub subscription_status: i32,
#[prost(string, tag = "3")]
pub instrument_uid: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Candle {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(enumeration = "SubscriptionInterval", tag = "2")]
pub interval: i32,
#[prost(message, optional, tag = "3")]
pub open: ::core::option::Option<Quotation>,
#[prost(message, optional, tag = "4")]
pub high: ::core::option::Option<Quotation>,
#[prost(message, optional, tag = "5")]
pub low: ::core::option::Option<Quotation>,
#[prost(message, optional, tag = "6")]
pub close: ::core::option::Option<Quotation>,
#[prost(int64, tag = "7")]
pub volume: i64,
#[prost(message, optional, tag = "8")]
pub time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "9")]
pub last_trade_ts: ::core::option::Option<::prost_types::Timestamp>,
#[prost(string, tag = "10")]
pub instrument_uid: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OrderBook {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub depth: i32,
#[prost(bool, tag = "3")]
pub is_consistent: bool,
#[prost(message, repeated, tag = "4")]
pub bids: ::prost::alloc::vec::Vec<Order>,
#[prost(message, repeated, tag = "5")]
pub asks: ::prost::alloc::vec::Vec<Order>,
#[prost(message, optional, tag = "6")]
pub time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "7")]
pub limit_up: ::core::option::Option<Quotation>,
#[prost(message, optional, tag = "8")]
pub limit_down: ::core::option::Option<Quotation>,
#[prost(string, tag = "9")]
pub instrument_uid: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Order {
#[prost(message, optional, tag = "1")]
pub price: ::core::option::Option<Quotation>,
#[prost(int64, tag = "2")]
pub quantity: i64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Trade {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(enumeration = "TradeDirection", tag = "2")]
pub direction: i32,
#[prost(message, optional, tag = "3")]
pub price: ::core::option::Option<Quotation>,
#[prost(int64, tag = "4")]
pub quantity: i64,
#[prost(message, optional, tag = "5")]
pub time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(string, tag = "6")]
pub instrument_uid: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TradingStatus {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(enumeration = "SecurityTradingStatus", tag = "2")]
pub trading_status: i32,
#[prost(message, optional, tag = "3")]
pub time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(bool, tag = "4")]
pub limit_order_available_flag: bool,
#[prost(bool, tag = "5")]
pub market_order_available_flag: bool,
#[prost(string, tag = "6")]
pub instrument_uid: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetCandlesRequest {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub from: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "3")]
pub to: ::core::option::Option<::prost_types::Timestamp>,
#[prost(enumeration = "CandleInterval", tag = "4")]
pub interval: i32,
#[prost(string, tag = "5")]
pub instrument_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetCandlesResponse {
#[prost(message, repeated, tag = "1")]
pub candles: ::prost::alloc::vec::Vec<HistoricCandle>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HistoricCandle {
#[prost(message, optional, tag = "1")]
pub open: ::core::option::Option<Quotation>,
#[prost(message, optional, tag = "2")]
pub high: ::core::option::Option<Quotation>,
#[prost(message, optional, tag = "3")]
pub low: ::core::option::Option<Quotation>,
#[prost(message, optional, tag = "4")]
pub close: ::core::option::Option<Quotation>,
#[prost(int64, tag = "5")]
pub volume: i64,
#[prost(message, optional, tag = "6")]
pub time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(bool, tag = "7")]
pub is_complete: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetLastPricesRequest {
#[prost(string, repeated, tag = "1")]
pub figi: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, repeated, tag = "2")]
pub instrument_id:
::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetLastPricesResponse {
#[prost(message, repeated, tag = "1")]
pub last_prices: ::prost::alloc::vec::Vec<LastPrice>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LastPrice {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub price: ::core::option::Option<Quotation>,
#[prost(message, optional, tag = "3")]
pub time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(string, tag = "11")]
pub instrument_uid: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetOrderBookRequest {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub depth: i32,
#[prost(string, tag = "3")]
pub instrument_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetOrderBookResponse {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub depth: i32,
#[prost(message, repeated, tag = "3")]
pub bids: ::prost::alloc::vec::Vec<Order>,
#[prost(message, repeated, tag = "4")]
pub asks: ::prost::alloc::vec::Vec<Order>,
#[prost(message, optional, tag = "5")]
pub last_price: ::core::option::Option<Quotation>,
#[prost(message, optional, tag = "6")]
pub close_price: ::core::option::Option<Quotation>,
#[prost(message, optional, tag = "7")]
pub limit_up: ::core::option::Option<Quotation>,
#[prost(message, optional, tag = "8")]
pub limit_down: ::core::option::Option<Quotation>,
#[prost(message, optional, tag = "21")]
pub last_price_ts: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "22")]
pub close_price_ts: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "23")]
pub orderbook_ts: ::core::option::Option<::prost_types::Timestamp>,
#[prost(string, tag = "9")]
pub instrument_uid: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetTradingStatusRequest {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub instrument_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetTradingStatusesRequest {
#[prost(string, repeated, tag = "1")]
pub instrument_id:
::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetTradingStatusesResponse {
#[prost(message, repeated, tag = "1")]
pub trading_statuses: ::prost::alloc::vec::Vec<GetTradingStatusResponse>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetTradingStatusResponse {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(enumeration = "SecurityTradingStatus", tag = "2")]
pub trading_status: i32,
#[prost(bool, tag = "3")]
pub limit_order_available_flag: bool,
#[prost(bool, tag = "4")]
pub market_order_available_flag: bool,
#[prost(bool, tag = "5")]
pub api_trade_available_flag: bool,
#[prost(string, tag = "6")]
pub instrument_uid: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetLastTradesRequest {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub from: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "3")]
pub to: ::core::option::Option<::prost_types::Timestamp>,
#[prost(string, tag = "4")]
pub instrument_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetLastTradesResponse {
#[prost(message, repeated, tag = "1")]
pub trades: ::prost::alloc::vec::Vec<Trade>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetMySubscriptions {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetClosePricesRequest {
#[prost(message, repeated, tag = "1")]
pub instruments: ::prost::alloc::vec::Vec<InstrumentClosePriceRequest>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InstrumentClosePriceRequest {
#[prost(string, tag = "1")]
pub instrument_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetClosePricesResponse {
#[prost(message, repeated, tag = "1")]
pub close_prices: ::prost::alloc::vec::Vec<InstrumentClosePriceResponse>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InstrumentClosePriceResponse {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub instrument_uid: ::prost::alloc::string::String,
#[prost(message, optional, tag = "11")]
pub price: ::core::option::Option<Quotation>,
#[prost(message, optional, tag = "21")]
pub time: ::core::option::Option<::prost_types::Timestamp>,
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum SubscriptionAction {
Unspecified = 0,
Subscribe = 1,
Unsubscribe = 2,
}
impl SubscriptionAction {
pub fn as_str_name(&self) -> &'static str {
match self {
SubscriptionAction::Unspecified => {
"SUBSCRIPTION_ACTION_UNSPECIFIED"
}
SubscriptionAction::Subscribe => "SUBSCRIPTION_ACTION_SUBSCRIBE",
SubscriptionAction::Unsubscribe => {
"SUBSCRIPTION_ACTION_UNSUBSCRIBE"
}
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SUBSCRIPTION_ACTION_UNSPECIFIED" => Some(Self::Unspecified),
"SUBSCRIPTION_ACTION_SUBSCRIBE" => Some(Self::Subscribe),
"SUBSCRIPTION_ACTION_UNSUBSCRIBE" => Some(Self::Unsubscribe),
_ => None,
}
}
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum SubscriptionInterval {
Unspecified = 0,
OneMinute = 1,
FiveMinutes = 2,
TenMinutes = 8,
OneHour = 4,
Day = 5,
Week = 12,
Month = 13,
}
impl SubscriptionInterval {
pub fn as_str_name(&self) -> &'static str {
match self {
SubscriptionInterval::Unspecified => {
"SUBSCRIPTION_INTERVAL_UNSPECIFIED"
}
SubscriptionInterval::OneMinute => {
"SUBSCRIPTION_INTERVAL_ONE_MINUTE"
}
SubscriptionInterval::FiveMinutes => {
"SUBSCRIPTION_INTERVAL_FIVE_MINUTES"
}
SubscriptionInterval::TenMinutes => {
"SUBSCRIPTION_INTERVAL_10_MIN"
}
SubscriptionInterval::OneHour => "SUBSCRIPTION_INTERVAL_ONE_HOUR",
SubscriptionInterval::Day => "SUBSCRIPTION_INTERVAL_ONE_DAY",
SubscriptionInterval::Week => "SUBSCRIPTION_INTERVAL_WEEK",
SubscriptionInterval::Month => "SUBSCRIPTION_INTERVAL_MONTH",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SUBSCRIPTION_INTERVAL_UNSPECIFIED" => Some(Self::Unspecified),
"SUBSCRIPTION_INTERVAL_ONE_MINUTE" => Some(Self::OneMinute),
"SUBSCRIPTION_INTERVAL_FIVE_MINUTES" => Some(Self::FiveMinutes),
_ => None,
}
}
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum SubscriptionStatus {
Unspecified = 0,
Success = 1,
InstrumentNotFound = 2,
SubscriptionActionIsInvalid = 3,
DepthIsInvalid = 4,
IntervalIsInvalid = 5,
LimitIsExceeded = 6,
InternalError = 7,
TooManyRequests = 8,
SubscriptionNotFound = 9,
}
impl SubscriptionStatus {
pub fn as_str_name(&self) -> &'static str {
match self {
SubscriptionStatus::Unspecified => {
"SUBSCRIPTION_STATUS_UNSPECIFIED"
}
SubscriptionStatus::Success => "SUBSCRIPTION_STATUS_SUCCESS",
SubscriptionStatus::InstrumentNotFound => {
"SUBSCRIPTION_STATUS_INSTRUMENT_NOT_FOUND"
}
SubscriptionStatus::SubscriptionActionIsInvalid => {
"SUBSCRIPTION_STATUS_SUBSCRIPTION_ACTION_IS_INVALID"
}
SubscriptionStatus::DepthIsInvalid => {
"SUBSCRIPTION_STATUS_DEPTH_IS_INVALID"
}
SubscriptionStatus::IntervalIsInvalid => {
"SUBSCRIPTION_STATUS_INTERVAL_IS_INVALID"
}
SubscriptionStatus::LimitIsExceeded => {
"SUBSCRIPTION_STATUS_LIMIT_IS_EXCEEDED"
}
SubscriptionStatus::InternalError => {
"SUBSCRIPTION_STATUS_INTERNAL_ERROR"
}
SubscriptionStatus::TooManyRequests => {
"SUBSCRIPTION_STATUS_TOO_MANY_REQUESTS"
}
SubscriptionStatus::SubscriptionNotFound => {
"SUBSCRIPTION_STATUS_SUBSCRIPTION_NOT_FOUND"
}
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SUBSCRIPTION_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
"SUBSCRIPTION_STATUS_SUCCESS" => Some(Self::Success),
"SUBSCRIPTION_STATUS_INSTRUMENT_NOT_FOUND" => {
Some(Self::InstrumentNotFound)
}
"SUBSCRIPTION_STATUS_SUBSCRIPTION_ACTION_IS_INVALID" => {
Some(Self::SubscriptionActionIsInvalid)
}
"SUBSCRIPTION_STATUS_DEPTH_IS_INVALID" => {
Some(Self::DepthIsInvalid)
}
"SUBSCRIPTION_STATUS_INTERVAL_IS_INVALID" => {
Some(Self::IntervalIsInvalid)
}
"SUBSCRIPTION_STATUS_LIMIT_IS_EXCEEDED" => {
Some(Self::LimitIsExceeded)
}
"SUBSCRIPTION_STATUS_INTERNAL_ERROR" => Some(Self::InternalError),
"SUBSCRIPTION_STATUS_TOO_MANY_REQUESTS" => {
Some(Self::TooManyRequests)
}
"SUBSCRIPTION_STATUS_SUBSCRIPTION_NOT_FOUND" => {
Some(Self::SubscriptionNotFound)
}
_ => None,
}
}
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum TradeDirection {
Unspecified = 0,
Buy = 1,
Sell = 2,
}
impl TradeDirection {
pub fn as_str_name(&self) -> &'static str {
match self {
TradeDirection::Unspecified => "TRADE_DIRECTION_UNSPECIFIED",
TradeDirection::Buy => "TRADE_DIRECTION_BUY",
TradeDirection::Sell => "TRADE_DIRECTION_SELL",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"TRADE_DIRECTION_UNSPECIFIED" => Some(Self::Unspecified),
"TRADE_DIRECTION_BUY" => Some(Self::Buy),
"TRADE_DIRECTION_SELL" => Some(Self::Sell),
_ => None,
}
}
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum CandleInterval {
Unspecified = 0,
CandleInterval1Min = 1,
CandleInterval5Min = 2,
CandleInterval15Min = 3,
Hour = 4,
Day = 5,
CandleInterval2Min = 6,
CandleInterval3Min = 7,
CandleInterval10Min = 8,
CandleInterval30Min = 9,
CandleInterval2Hour = 10,
CandleInterval4Hour = 11,
Week = 12,
Month = 13,
}
impl CandleInterval {
pub fn as_str_name(&self) -> &'static str {
match self {
CandleInterval::Unspecified => "CANDLE_INTERVAL_UNSPECIFIED",
CandleInterval::CandleInterval1Min => "CANDLE_INTERVAL_1_MIN",
CandleInterval::CandleInterval5Min => "CANDLE_INTERVAL_5_MIN",
CandleInterval::CandleInterval15Min => "CANDLE_INTERVAL_15_MIN",
CandleInterval::Hour => "CANDLE_INTERVAL_HOUR",
CandleInterval::Day => "CANDLE_INTERVAL_DAY",
CandleInterval::CandleInterval2Min => "CANDLE_INTERVAL_2_MIN",
CandleInterval::CandleInterval3Min => "CANDLE_INTERVAL_3_MIN",
CandleInterval::CandleInterval10Min => "CANDLE_INTERVAL_10_MIN",
CandleInterval::CandleInterval30Min => "CANDLE_INTERVAL_30_MIN",
CandleInterval::CandleInterval2Hour => "CANDLE_INTERVAL_2_HOUR",
CandleInterval::CandleInterval4Hour => "CANDLE_INTERVAL_4_HOUR",
CandleInterval::Week => "CANDLE_INTERVAL_WEEK",
CandleInterval::Month => "CANDLE_INTERVAL_MONTH",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CANDLE_INTERVAL_UNSPECIFIED" => Some(Self::Unspecified),
"CANDLE_INTERVAL_1_MIN" => Some(Self::CandleInterval1Min),
"CANDLE_INTERVAL_5_MIN" => Some(Self::CandleInterval5Min),
"CANDLE_INTERVAL_15_MIN" => Some(Self::CandleInterval15Min),
"CANDLE_INTERVAL_HOUR" => Some(Self::Hour),
"CANDLE_INTERVAL_DAY" => Some(Self::Day),
"CANDLE_INTERVAL_2_MIN" => Some(Self::CandleInterval2Min),
"CANDLE_INTERVAL_3_MIN" => Some(Self::CandleInterval3Min),
"CANDLE_INTERVAL_10_MIN" => Some(Self::CandleInterval10Min),
"CANDLE_INTERVAL_30_MIN" => Some(Self::CandleInterval30Min),
"CANDLE_INTERVAL_2_HOUR" => Some(Self::CandleInterval2Hour),
"CANDLE_INTERVAL_4_HOUR" => Some(Self::CandleInterval4Hour),
"CANDLE_INTERVAL_WEEK" => Some(Self::Week),
"CANDLE_INTERVAL_MONTH" => Some(Self::Month),
_ => None,
}
}
}
pub mod market_data_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::let_unit_value
)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct MarketDataServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl MarketDataServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(
dst: D,
) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn =
tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> MarketDataServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + 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,
) -> MarketDataServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T:
tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<
tonic::body::BoxBody,
>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
MarketDataServiceClient::new(InterceptedService::new(
inner,
interceptor,
))
}
#[must_use]
pub fn send_compressed(
mut self,
encoding: CompressionEncoding,
) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(
mut self,
encoding: CompressionEncoding,
) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
pub async fn get_candles(
&mut self,
request: impl tonic::IntoRequest<super::GetCandlesRequest>,
) -> Result<tonic::Response<super::GetCandlesResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/tinkoff.public.invest.api.contract.v1.MarketDataService/GetCandles",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_last_prices(
&mut self,
request: impl tonic::IntoRequest<super::GetLastPricesRequest>,
) -> Result<
tonic::Response<super::GetLastPricesResponse>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/tinkoff.public.invest.api.contract.v1.MarketDataService/GetLastPrices",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_order_book(
&mut self,
request: impl tonic::IntoRequest<super::GetOrderBookRequest>,
) -> Result<tonic::Response<super::GetOrderBookResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/tinkoff.public.invest.api.contract.v1.MarketDataService/GetOrderBook",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_trading_status(
&mut self,
request: impl tonic::IntoRequest<super::GetTradingStatusRequest>,
) -> Result<
tonic::Response<super::GetTradingStatusResponse>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/tinkoff.public.invest.api.contract.v1.MarketDataService/GetTradingStatus",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_trading_statuses(
&mut self,
request: impl tonic::IntoRequest<super::GetTradingStatusesRequest>,
) -> Result<
tonic::Response<super::GetTradingStatusesResponse>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/tinkoff.public.invest.api.contract.v1.MarketDataService/GetTradingStatuses",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_last_trades(
&mut self,
request: impl tonic::IntoRequest<super::GetLastTradesRequest>,
) -> Result<
tonic::Response<super::GetLastTradesResponse>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/tinkoff.public.invest.api.contract.v1.MarketDataService/GetLastTrades",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_close_prices(
&mut self,
request: impl tonic::IntoRequest<super::GetClosePricesRequest>,
) -> Result<
tonic::Response<super::GetClosePricesResponse>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/tinkoff.public.invest.api.contract.v1.MarketDataService/GetClosePrices",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}
pub mod market_data_stream_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::let_unit_value
)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct MarketDataStreamServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl MarketDataStreamServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(
dst: D,
) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn =
tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> MarketDataStreamServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + 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,
) -> MarketDataStreamServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T:
tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<
tonic::body::BoxBody,
>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
MarketDataStreamServiceClient::new(InterceptedService::new(
inner,
interceptor,
))
}
#[must_use]
pub fn send_compressed(
mut self,
encoding: CompressionEncoding,
) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(
mut self,
encoding: CompressionEncoding,
) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
pub async fn market_data_stream(
&mut self,
request: impl tonic::IntoStreamingRequest<
Message = super::MarketDataRequest,
>,
) -> Result<
tonic::Response<
tonic::codec::Streaming<super::MarketDataResponse>,
>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/tinkoff.public.invest.api.contract.v1.MarketDataStreamService/MarketDataStream",
);
self.inner
.streaming(request.into_streaming_request(), path, codec)
.await
}
pub async fn market_data_server_side_stream(
&mut self,
request: impl tonic::IntoRequest<
super::MarketDataServerSideStreamRequest,
>,
) -> Result<
tonic::Response<
tonic::codec::Streaming<super::MarketDataResponse>,
>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/tinkoff.public.invest.api.contract.v1.MarketDataStreamService/MarketDataServerSideStream",
);
self.inner
.server_streaming(request.into_request(), path, codec)
.await
}
}
}