#![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 PostStopOrderRequest {
#[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(message, optional, tag = "4")]
pub stop_price: ::core::option::Option<Quotation>,
#[prost(enumeration = "StopOrderDirection", tag = "5")]
pub direction: i32,
#[prost(string, tag = "6")]
pub account_id: ::prost::alloc::string::String,
#[prost(enumeration = "StopOrderExpirationType", tag = "7")]
pub expiration_type: i32,
#[prost(enumeration = "StopOrderType", tag = "8")]
pub stop_order_type: i32,
#[prost(message, optional, tag = "9")]
pub expire_date: ::core::option::Option<::prost_types::Timestamp>,
#[prost(string, tag = "10")]
pub instrument_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PostStopOrderResponse {
#[prost(string, tag = "1")]
pub stop_order_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetStopOrdersRequest {
#[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 GetStopOrdersResponse {
#[prost(message, repeated, tag = "1")]
pub stop_orders: ::prost::alloc::vec::Vec<StopOrder>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CancelStopOrderRequest {
#[prost(string, tag = "1")]
pub account_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub stop_order_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CancelStopOrderResponse {
#[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 StopOrder {
#[prost(string, tag = "1")]
pub stop_order_id: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub lots_requested: i64,
#[prost(string, tag = "3")]
pub figi: ::prost::alloc::string::String,
#[prost(enumeration = "StopOrderDirection", tag = "4")]
pub direction: i32,
#[prost(string, tag = "5")]
pub currency: ::prost::alloc::string::String,
#[prost(enumeration = "StopOrderType", tag = "6")]
pub order_type: i32,
#[prost(message, optional, tag = "7")]
pub create_date: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "8")]
pub activation_date_time:
::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "9")]
pub expiration_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "10")]
pub price: ::core::option::Option<MoneyValue>,
#[prost(message, optional, tag = "11")]
pub stop_price: ::core::option::Option<MoneyValue>,
#[prost(string, tag = "12")]
pub instrument_uid: ::prost::alloc::string::String,
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum StopOrderDirection {
Unspecified = 0,
Buy = 1,
Sell = 2,
}
impl StopOrderDirection {
pub fn as_str_name(&self) -> &'static str {
match self {
StopOrderDirection::Unspecified => {
"STOP_ORDER_DIRECTION_UNSPECIFIED"
}
StopOrderDirection::Buy => "STOP_ORDER_DIRECTION_BUY",
StopOrderDirection::Sell => "STOP_ORDER_DIRECTION_SELL",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STOP_ORDER_DIRECTION_UNSPECIFIED" => Some(Self::Unspecified),
"STOP_ORDER_DIRECTION_BUY" => Some(Self::Buy),
"STOP_ORDER_DIRECTION_SELL" => Some(Self::Sell),
_ => None,
}
}
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum StopOrderExpirationType {
Unspecified = 0,
GoodTillCancel = 1,
GoodTillDate = 2,
}
impl StopOrderExpirationType {
pub fn as_str_name(&self) -> &'static str {
match self {
StopOrderExpirationType::Unspecified => {
"STOP_ORDER_EXPIRATION_TYPE_UNSPECIFIED"
}
StopOrderExpirationType::GoodTillCancel => {
"STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_CANCEL"
}
StopOrderExpirationType::GoodTillDate => {
"STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_DATE"
}
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STOP_ORDER_EXPIRATION_TYPE_UNSPECIFIED" => {
Some(Self::Unspecified)
}
"STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_CANCEL" => {
Some(Self::GoodTillCancel)
}
"STOP_ORDER_EXPIRATION_TYPE_GOOD_TILL_DATE" => {
Some(Self::GoodTillDate)
}
_ => None,
}
}
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum StopOrderType {
Unspecified = 0,
TakeProfit = 1,
StopLoss = 2,
StopLimit = 3,
}
impl StopOrderType {
pub fn as_str_name(&self) -> &'static str {
match self {
StopOrderType::Unspecified => "STOP_ORDER_TYPE_UNSPECIFIED",
StopOrderType::TakeProfit => "STOP_ORDER_TYPE_TAKE_PROFIT",
StopOrderType::StopLoss => "STOP_ORDER_TYPE_STOP_LOSS",
StopOrderType::StopLimit => "STOP_ORDER_TYPE_STOP_LIMIT",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STOP_ORDER_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"STOP_ORDER_TYPE_TAKE_PROFIT" => Some(Self::TakeProfit),
"STOP_ORDER_TYPE_STOP_LOSS" => Some(Self::StopLoss),
"STOP_ORDER_TYPE_STOP_LIMIT" => Some(Self::StopLimit),
_ => None,
}
}
}
pub mod stop_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 StopOrdersServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl StopOrdersServiceClient<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> StopOrdersServiceClient<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,
) -> StopOrdersServiceClient<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,
{
StopOrdersServiceClient::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_stop_order(
&mut self,
request: impl tonic::IntoRequest<super::PostStopOrderRequest>,
) -> Result<
tonic::Response<super::PostStopOrderResponse>,
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.StopOrdersService/PostStopOrder",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_stop_orders(
&mut self,
request: impl tonic::IntoRequest<super::GetStopOrdersRequest>,
) -> Result<
tonic::Response<super::GetStopOrdersResponse>,
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.StopOrdersService/GetStopOrders",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn cancel_stop_order(
&mut self,
request: impl tonic::IntoRequest<super::CancelStopOrderRequest>,
) -> Result<
tonic::Response<super::CancelStopOrderResponse>,
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.StopOrdersService/CancelStopOrder",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}