#![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 GetAccountsRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetAccountsResponse {
#[prost(message, repeated, tag = "1")]
pub accounts: ::prost::alloc::vec::Vec<Account>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Account {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(enumeration = "AccountType", tag = "2")]
pub r#type: i32,
#[prost(string, tag = "3")]
pub name: ::prost::alloc::string::String,
#[prost(enumeration = "AccountStatus", tag = "4")]
pub status: i32,
#[prost(message, optional, tag = "5")]
pub opened_date: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "6")]
pub closed_date: ::core::option::Option<::prost_types::Timestamp>,
#[prost(enumeration = "AccessLevel", tag = "7")]
pub access_level: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetMarginAttributesRequest {
#[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 GetMarginAttributesResponse {
#[prost(message, optional, tag = "1")]
pub liquid_portfolio: ::core::option::Option<MoneyValue>,
#[prost(message, optional, tag = "2")]
pub starting_margin: ::core::option::Option<MoneyValue>,
#[prost(message, optional, tag = "3")]
pub minimal_margin: ::core::option::Option<MoneyValue>,
#[prost(message, optional, tag = "4")]
pub funds_sufficiency_level: ::core::option::Option<Quotation>,
#[prost(message, optional, tag = "5")]
pub amount_of_missing_funds: ::core::option::Option<MoneyValue>,
#[prost(message, optional, tag = "6")]
pub corrected_margin: ::core::option::Option<MoneyValue>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetUserTariffRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetUserTariffResponse {
#[prost(message, repeated, tag = "1")]
pub unary_limits: ::prost::alloc::vec::Vec<UnaryLimit>,
#[prost(message, repeated, tag = "2")]
pub stream_limits: ::prost::alloc::vec::Vec<StreamLimit>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UnaryLimit {
#[prost(int32, tag = "1")]
pub limit_per_minute: i32,
#[prost(string, repeated, tag = "2")]
pub methods: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamLimit {
#[prost(int32, tag = "1")]
pub limit: i32,
#[prost(string, repeated, tag = "2")]
pub streams: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(int32, tag = "3")]
pub open: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetInfoRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetInfoResponse {
#[prost(bool, tag = "1")]
pub prem_status: bool,
#[prost(bool, tag = "2")]
pub qual_status: bool,
#[prost(string, repeated, tag = "3")]
pub qualified_for_work_with:
::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag = "4")]
pub tariff: ::prost::alloc::string::String,
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum AccountType {
Unspecified = 0,
Tinkoff = 1,
TinkoffIis = 2,
InvestBox = 3,
}
impl AccountType {
pub fn as_str_name(&self) -> &'static str {
match self {
AccountType::Unspecified => "ACCOUNT_TYPE_UNSPECIFIED",
AccountType::Tinkoff => "ACCOUNT_TYPE_TINKOFF",
AccountType::TinkoffIis => "ACCOUNT_TYPE_TINKOFF_IIS",
AccountType::InvestBox => "ACCOUNT_TYPE_INVEST_BOX",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ACCOUNT_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"ACCOUNT_TYPE_TINKOFF" => Some(Self::Tinkoff),
"ACCOUNT_TYPE_TINKOFF_IIS" => Some(Self::TinkoffIis),
"ACCOUNT_TYPE_INVEST_BOX" => Some(Self::InvestBox),
_ => None,
}
}
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum AccountStatus {
Unspecified = 0,
New = 1,
Open = 2,
Closed = 3,
}
impl AccountStatus {
pub fn as_str_name(&self) -> &'static str {
match self {
AccountStatus::Unspecified => "ACCOUNT_STATUS_UNSPECIFIED",
AccountStatus::New => "ACCOUNT_STATUS_NEW",
AccountStatus::Open => "ACCOUNT_STATUS_OPEN",
AccountStatus::Closed => "ACCOUNT_STATUS_CLOSED",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ACCOUNT_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
"ACCOUNT_STATUS_NEW" => Some(Self::New),
"ACCOUNT_STATUS_OPEN" => Some(Self::Open),
"ACCOUNT_STATUS_CLOSED" => Some(Self::Closed),
_ => None,
}
}
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum AccessLevel {
AccountAccessLevelUnspecified = 0,
AccountAccessLevelFullAccess = 1,
AccountAccessLevelReadOnly = 2,
AccountAccessLevelNoAccess = 3,
}
impl AccessLevel {
pub fn as_str_name(&self) -> &'static str {
match self {
AccessLevel::AccountAccessLevelUnspecified => {
"ACCOUNT_ACCESS_LEVEL_UNSPECIFIED"
}
AccessLevel::AccountAccessLevelFullAccess => {
"ACCOUNT_ACCESS_LEVEL_FULL_ACCESS"
}
AccessLevel::AccountAccessLevelReadOnly => {
"ACCOUNT_ACCESS_LEVEL_READ_ONLY"
}
AccessLevel::AccountAccessLevelNoAccess => {
"ACCOUNT_ACCESS_LEVEL_NO_ACCESS"
}
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ACCOUNT_ACCESS_LEVEL_UNSPECIFIED" => {
Some(Self::AccountAccessLevelUnspecified)
}
"ACCOUNT_ACCESS_LEVEL_FULL_ACCESS" => {
Some(Self::AccountAccessLevelFullAccess)
}
"ACCOUNT_ACCESS_LEVEL_READ_ONLY" => {
Some(Self::AccountAccessLevelReadOnly)
}
"ACCOUNT_ACCESS_LEVEL_NO_ACCESS" => {
Some(Self::AccountAccessLevelNoAccess)
}
_ => None,
}
}
}
pub mod users_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 UsersServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl UsersServiceClient<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> UsersServiceClient<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,
) -> UsersServiceClient<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,
{
UsersServiceClient::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_accounts(
&mut self,
request: impl tonic::IntoRequest<super::GetAccountsRequest>,
) -> Result<tonic::Response<super::GetAccountsResponse>, 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.UsersService/GetAccounts",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_margin_attributes(
&mut self,
request: impl tonic::IntoRequest<super::GetMarginAttributesRequest>,
) -> Result<
tonic::Response<super::GetMarginAttributesResponse>,
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.UsersService/GetMarginAttributes",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_user_tariff(
&mut self,
request: impl tonic::IntoRequest<super::GetUserTariffRequest>,
) -> Result<
tonic::Response<super::GetUserTariffResponse>,
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.UsersService/GetUserTariff",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_info(
&mut self,
request: impl tonic::IntoRequest<super::GetInfoRequest>,
) -> Result<tonic::Response<super::GetInfoResponse>, 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.UsersService/GetInfo",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}