#![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 TradesStreamRequest {
#[prost(string, repeated, tag = "1")]
pub accounts: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TradesStreamResponse {
#[prost(oneof = "trades_stream_response::Payload", tags = "1, 2")]
pub payload: ::core::option::Option<trades_stream_response::Payload>,
}
pub mod trades_stream_response {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Payload {
#[prost(message, tag = "1")]
OrderTrades(super::OrderTrades),
#[prost(message, tag = "2")]
Ping(super::Ping),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OrderTrades {
#[prost(string, tag = "1")]
pub order_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub created_at: ::core::option::Option<::prost_types::Timestamp>,
#[prost(enumeration = "OrderDirection", tag = "3")]
pub direction: i32,
#[prost(string, tag = "4")]
pub figi: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "5")]
pub trades: ::prost::alloc::vec::Vec<OrderTrade>,
#[prost(string, tag = "6")]
pub account_id: ::prost::alloc::string::String,
#[prost(string, tag = "7")]
pub instrument_uid: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OrderTrade {
#[prost(message, optional, tag = "1")]
pub date_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "2")]
pub price: ::core::option::Option<Quotation>,
#[prost(int64, tag = "3")]
pub quantity: i64,
#[prost(string, tag = "4")]
pub trade_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PostOrderRequest {
#[prost(string, tag = "1")]
pub figi: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub quantity: i64,
#[prost(message, optional, tag = "3")]
pub price: ::core::option::Option<Quotation>,
#[prost(enumeration = "OrderDirection", tag = "4")]
pub direction: i32,
#[prost(string, tag = "5")]
pub account_id: ::prost::alloc::string::String,
#[prost(enumeration = "OrderType", tag = "6")]
pub order_type: i32,
#[prost(string, tag = "7")]
pub order_id: ::prost::alloc::string::String,
#[prost(string, tag = "8")]
pub instrument_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PostOrderResponse {
#[prost(string, tag = "1")]
pub order_id: ::prost::alloc::string::String,
#[prost(enumeration = "OrderExecutionReportStatus", tag = "2")]
pub execution_report_status: i32,
#[prost(int64, tag = "3")]
pub lots_requested: i64,
#[prost(int64, tag = "4")]
pub lots_executed: i64,
#[prost(message, optional, tag = "5")]
pub initial_order_price: ::core::option::Option<MoneyValue>,
#[prost(message, optional, tag = "6")]
pub executed_order_price: ::core::option::Option<MoneyValue>,
#[prost(message, optional, tag = "7")]
pub total_order_amount: ::core::option::Option<MoneyValue>,
#[prost(message, optional, tag = "8")]
pub initial_commission: ::core::option::Option<MoneyValue>,
#[prost(message, optional, tag = "9")]
pub executed_commission: ::core::option::Option<MoneyValue>,
#[prost(message, optional, tag = "10")]
pub aci_value: ::core::option::Option<MoneyValue>,
#[prost(string, tag = "11")]
pub figi: ::prost::alloc::string::String,
#[prost(enumeration = "OrderDirection", tag = "12")]
pub direction: i32,
#[prost(message, optional, tag = "13")]
pub initial_security_price: ::core::option::Option<MoneyValue>,
#[prost(enumeration = "OrderType", tag = "14")]
pub order_type: i32,
#[prost(string, tag = "15")]
pub message: ::prost::alloc::string::String,
#[prost(message, optional, tag = "16")]
pub initial_order_price_pt: ::core::option::Option<Quotation>,
#[prost(string, tag = "17")]
pub instrument_uid: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CancelOrderRequest {
#[prost(string, tag = "1")]
pub account_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub order_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CancelOrderResponse {
#[prost(message, optional, tag = "1")]
pub time: ::core::option::Option<::prost_types::Timestamp>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetOrderStateRequest {
#[prost(string, tag = "1")]
pub account_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub order_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetOrdersRequest {
#[prost(string, tag = "1")]
pub account_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetOrdersResponse {
#[prost(message, repeated, tag = "1")]
pub orders: ::prost::alloc::vec::Vec<OrderState>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OrderState {
#[prost(string, tag = "1")]
pub order_id: ::prost::alloc::string::String,
#[prost(enumeration = "OrderExecutionReportStatus", tag = "2")]
pub execution_report_status: i32,
#[prost(int64, tag = "3")]
pub lots_requested: i64,
#[prost(int64, tag = "4")]
pub lots_executed: i64,
#[prost(message, optional, tag = "5")]
pub initial_order_price: ::core::option::Option<MoneyValue>,
#[prost(message, optional, tag = "6")]
pub executed_order_price: ::core::option::Option<MoneyValue>,
#[prost(message, optional, tag = "7")]
pub total_order_amount: ::core::option::Option<MoneyValue>,
#[prost(message, optional, tag = "8")]
pub average_position_price: ::core::option::Option<MoneyValue>,
#[prost(message, optional, tag = "9")]
pub initial_commission: ::core::option::Option<MoneyValue>,
#[prost(message, optional, tag = "10")]
pub executed_commission: ::core::option::Option<MoneyValue>,
#[prost(string, tag = "11")]
pub figi: ::prost::alloc::string::String,
#[prost(enumeration = "OrderDirection", tag = "12")]
pub direction: i32,
#[prost(message, optional, tag = "13")]
pub initial_security_price: ::core::option::Option<MoneyValue>,
#[prost(message, repeated, tag = "14")]
pub stages: ::prost::alloc::vec::Vec<OrderStage>,
#[prost(message, optional, tag = "15")]
pub service_commission: ::core::option::Option<MoneyValue>,
#[prost(string, tag = "16")]
pub currency: ::prost::alloc::string::String,
#[prost(enumeration = "OrderType", tag = "17")]
pub order_type: i32,
#[prost(message, optional, tag = "18")]
pub order_date: ::core::option::Option<::prost_types::Timestamp>,
#[prost(string, tag = "19")]
pub instrument_uid: ::prost::alloc::string::String,
#[prost(string, tag = "20")]
pub order_request_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OrderStage {
#[prost(message, optional, tag = "1")]
pub price: ::core::option::Option<MoneyValue>,
#[prost(int64, tag = "2")]
pub quantity: i64,
#[prost(string, tag = "3")]
pub trade_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReplaceOrderRequest {
#[prost(string, tag = "1")]
pub account_id: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub order_id: ::prost::alloc::string::String,
#[prost(string, tag = "7")]
pub idempotency_key: ::prost::alloc::string::String,
#[prost(int64, tag = "11")]
pub quantity: i64,
#[prost(message, optional, tag = "12")]
pub price: ::core::option::Option<Quotation>,
#[prost(enumeration = "PriceType", tag = "13")]
pub price_type: i32,
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum OrderDirection {
Unspecified = 0,
Buy = 1,
Sell = 2,
}
impl OrderDirection {
pub fn as_str_name(&self) -> &'static str {
match self {
OrderDirection::Unspecified => "ORDER_DIRECTION_UNSPECIFIED",
OrderDirection::Buy => "ORDER_DIRECTION_BUY",
OrderDirection::Sell => "ORDER_DIRECTION_SELL",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ORDER_DIRECTION_UNSPECIFIED" => Some(Self::Unspecified),
"ORDER_DIRECTION_BUY" => Some(Self::Buy),
"ORDER_DIRECTION_SELL" => Some(Self::Sell),
_ => None,
}
}
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum OrderType {
Unspecified = 0,
Limit = 1,
Market = 2,
Bestprice = 3,
}
impl OrderType {
pub fn as_str_name(&self) -> &'static str {
match self {
OrderType::Unspecified => "ORDER_TYPE_UNSPECIFIED",
OrderType::Limit => "ORDER_TYPE_LIMIT",
OrderType::Market => "ORDER_TYPE_MARKET",
OrderType::Bestprice => "ORDER_TYPE_BESTPRICE",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ORDER_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"ORDER_TYPE_LIMIT" => Some(Self::Limit),
"ORDER_TYPE_MARKET" => Some(Self::Market),
"ORDER_TYPE_BESTPRICE" => Some(Self::Bestprice),
_ => None,
}
}
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum OrderExecutionReportStatus {
ExecutionReportStatusUnspecified = 0,
ExecutionReportStatusFill = 1,
ExecutionReportStatusRejected = 2,
ExecutionReportStatusCancelled = 3,
ExecutionReportStatusNew = 4,
ExecutionReportStatusPartiallyfill = 5,
}
impl OrderExecutionReportStatus {
pub fn as_str_name(&self) -> &'static str {
match self {
OrderExecutionReportStatus::ExecutionReportStatusUnspecified => {
"EXECUTION_REPORT_STATUS_UNSPECIFIED"
}
OrderExecutionReportStatus::ExecutionReportStatusFill => {
"EXECUTION_REPORT_STATUS_FILL"
}
OrderExecutionReportStatus::ExecutionReportStatusRejected => {
"EXECUTION_REPORT_STATUS_REJECTED"
}
OrderExecutionReportStatus::ExecutionReportStatusCancelled => {
"EXECUTION_REPORT_STATUS_CANCELLED"
}
OrderExecutionReportStatus::ExecutionReportStatusNew => {
"EXECUTION_REPORT_STATUS_NEW"
}
OrderExecutionReportStatus::ExecutionReportStatusPartiallyfill => {
"EXECUTION_REPORT_STATUS_PARTIALLYFILL"
}
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"EXECUTION_REPORT_STATUS_UNSPECIFIED" => {
Some(Self::ExecutionReportStatusUnspecified)
}
"EXECUTION_REPORT_STATUS_FILL" => {
Some(Self::ExecutionReportStatusFill)
}
"EXECUTION_REPORT_STATUS_REJECTED" => {
Some(Self::ExecutionReportStatusRejected)
}
"EXECUTION_REPORT_STATUS_CANCELLED" => {
Some(Self::ExecutionReportStatusCancelled)
}
"EXECUTION_REPORT_STATUS_NEW" => {
Some(Self::ExecutionReportStatusNew)
}
"EXECUTION_REPORT_STATUS_PARTIALLYFILL" => {
Some(Self::ExecutionReportStatusPartiallyfill)
}
_ => None,
}
}
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum PriceType {
Unspecified = 0,
Point = 1,
Currency = 2,
}
impl PriceType {
pub fn as_str_name(&self) -> &'static str {
match self {
PriceType::Unspecified => "PRICE_TYPE_UNSPECIFIED",
PriceType::Point => "PRICE_TYPE_POINT",
PriceType::Currency => "PRICE_TYPE_CURRENCY",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"PRICE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"PRICE_TYPE_POINT" => Some(Self::Point),
"PRICE_TYPE_CURRENCY" => Some(Self::Currency),
_ => None,
}
}
}
pub mod orders_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 OrdersStreamServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl OrdersStreamServiceClient<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> OrdersStreamServiceClient<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,
) -> OrdersStreamServiceClient<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,
{
OrdersStreamServiceClient::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 trades_stream(
&mut self,
request: impl tonic::IntoRequest<super::TradesStreamRequest>,
) -> Result<
tonic::Response<
tonic::codec::Streaming<super::TradesStreamResponse>,
>,
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.OrdersStreamService/TradesStream",
);
self.inner
.server_streaming(request.into_request(), path, codec)
.await
}
}
}
pub mod orders_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 OrdersServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl OrdersServiceClient<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> OrdersServiceClient<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,
) -> OrdersServiceClient<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,
{
OrdersServiceClient::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 post_order(
&mut self,
request: impl tonic::IntoRequest<super::PostOrderRequest>,
) -> Result<tonic::Response<super::PostOrderResponse>, 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.OrdersService/PostOrder",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn cancel_order(
&mut self,
request: impl tonic::IntoRequest<super::CancelOrderRequest>,
) -> Result<tonic::Response<super::CancelOrderResponse>, 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.OrdersService/CancelOrder",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_order_state(
&mut self,
request: impl tonic::IntoRequest<super::GetOrderStateRequest>,
) -> Result<tonic::Response<super::OrderState>, 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.OrdersService/GetOrderState",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_orders(
&mut self,
request: impl tonic::IntoRequest<super::GetOrdersRequest>,
) -> Result<tonic::Response<super::GetOrdersResponse>, 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.OrdersService/GetOrders",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn replace_order(
&mut self,
request: impl tonic::IntoRequest<super::ReplaceOrderRequest>,
) -> Result<tonic::Response<super::PostOrderResponse>, 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.OrdersService/ReplaceOrder",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}