#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetAccountRequest {
#[prost(string, tag = "1")]
pub account_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetAccountResponse {
#[prost(string, tag = "1")]
pub account_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub r#type: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub status: ::prost::alloc::string::String,
#[prost(message, optional, tag = "4")]
pub equity: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
#[prost(message, optional, tag = "5")]
pub unrealized_profit: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
#[prost(message, repeated, tag = "6")]
pub positions: ::prost::alloc::vec::Vec<Position>,
#[prost(message, repeated, tag = "7")]
pub cash: ::prost::alloc::vec::Vec<
super::super::super::super::google::r#type::Money,
>,
#[prost(message, optional, tag = "11")]
pub open_account_date: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "12")]
pub first_trade_date: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "13")]
pub first_non_trade_date: ::core::option::Option<::prost_types::Timestamp>,
#[prost(oneof = "get_account_response::Portfolio", tags = "8, 9, 10")]
pub portfolio: ::core::option::Option<get_account_response::Portfolio>,
}
pub mod get_account_response {
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum Portfolio {
#[prost(message, tag = "8")]
PortfolioMc(super::Mc),
#[prost(message, tag = "9")]
PortfolioMct(super::Mct),
#[prost(message, tag = "10")]
PortfolioForts(super::Forts),
}
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Mc {
#[prost(message, optional, tag = "1")]
pub available_cash: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
#[prost(message, optional, tag = "2")]
pub initial_margin: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
#[prost(message, optional, tag = "3")]
pub maintenance_margin: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Mct {}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Forts {
#[prost(message, optional, tag = "1")]
pub available_cash: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
#[prost(message, optional, tag = "2")]
pub money_reserved: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TradesRequest {
#[prost(string, tag = "1")]
pub account_id: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub limit: i32,
#[prost(message, optional, tag = "3")]
pub interval: ::core::option::Option<
super::super::super::super::google::r#type::Interval,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TradesResponse {
#[prost(message, repeated, tag = "1")]
pub trades: ::prost::alloc::vec::Vec<super::AccountTrade>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TransactionsRequest {
#[prost(string, tag = "1")]
pub account_id: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub limit: i32,
#[prost(message, optional, tag = "3")]
pub interval: ::core::option::Option<
super::super::super::super::google::r#type::Interval,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TransactionsResponse {
#[prost(message, repeated, tag = "1")]
pub transactions: ::prost::alloc::vec::Vec<Transaction>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Position {
#[prost(string, tag = "1")]
pub symbol: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub quantity: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
#[prost(message, optional, tag = "3")]
pub average_price: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
#[prost(message, optional, tag = "4")]
pub current_price: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
#[prost(message, optional, tag = "5")]
pub maintenance_margin: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
#[prost(message, optional, tag = "6")]
pub daily_pnl: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
#[prost(message, optional, tag = "7")]
pub unrealized_pnl: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Transaction {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[deprecated]
#[prost(string, tag = "2")]
pub category: ::prost::alloc::string::String,
#[prost(message, optional, tag = "4")]
pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
#[prost(string, tag = "5")]
pub symbol: ::prost::alloc::string::String,
#[prost(message, optional, tag = "6")]
pub change: ::core::option::Option<
super::super::super::super::google::r#type::Money,
>,
#[prost(message, optional, tag = "7")]
pub trade: ::core::option::Option<transaction::Trade>,
#[prost(enumeration = "transaction::TransactionCategory", tag = "8")]
pub transaction_category: i32,
#[prost(string, tag = "9")]
pub transaction_name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "10")]
pub change_qty: ::core::option::Option<
super::super::super::super::google::r#type::Decimal,
>,
}
pub mod transaction {
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Trade {
#[prost(message, optional, tag = "1")]
pub size: ::core::option::Option<
super::super::super::super::super::google::r#type::Decimal,
>,
#[prost(message, optional, tag = "2")]
pub price: ::core::option::Option<
super::super::super::super::super::google::r#type::Decimal,
>,
#[prost(message, optional, tag = "3")]
pub accrued_interest: ::core::option::Option<
super::super::super::super::super::google::r#type::Decimal,
>,
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum TransactionCategory {
Others = 0,
Deposit = 1,
Withdraw = 2,
Income = 5,
Commission = 7,
Tax = 8,
Inheritance = 9,
Transfer = 11,
ContractTermination = 12,
Outcomes = 13,
Fine = 15,
Loan = 19,
}
impl TransactionCategory {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Others => "OTHERS",
Self::Deposit => "DEPOSIT",
Self::Withdraw => "WITHDRAW",
Self::Income => "INCOME",
Self::Commission => "COMMISSION",
Self::Tax => "TAX",
Self::Inheritance => "INHERITANCE",
Self::Transfer => "TRANSFER",
Self::ContractTermination => "CONTRACT_TERMINATION",
Self::Outcomes => "OUTCOMES",
Self::Fine => "FINE",
Self::Loan => "LOAN",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"OTHERS" => Some(Self::Others),
"DEPOSIT" => Some(Self::Deposit),
"WITHDRAW" => Some(Self::Withdraw),
"INCOME" => Some(Self::Income),
"COMMISSION" => Some(Self::Commission),
"TAX" => Some(Self::Tax),
"INHERITANCE" => Some(Self::Inheritance),
"TRANSFER" => Some(Self::Transfer),
"CONTRACT_TERMINATION" => Some(Self::ContractTermination),
"OUTCOMES" => Some(Self::Outcomes),
"FINE" => Some(Self::Fine),
"LOAN" => Some(Self::Loan),
_ => None,
}
}
}
}
pub mod accounts_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct AccountsServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl AccountsServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> AccountsServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> AccountsServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
AccountsServiceClient::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
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get_account(
&mut self,
request: impl tonic::IntoRequest<super::GetAccountRequest>,
) -> std::result::Result<
tonic::Response<super::GetAccountResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grpc.tradeapi.v1.accounts.AccountsService/GetAccount",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"grpc.tradeapi.v1.accounts.AccountsService",
"GetAccount",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn trades(
&mut self,
request: impl tonic::IntoRequest<super::TradesRequest>,
) -> std::result::Result<tonic::Response<super::TradesResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grpc.tradeapi.v1.accounts.AccountsService/Trades",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"grpc.tradeapi.v1.accounts.AccountsService",
"Trades",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn transactions(
&mut self,
request: impl tonic::IntoRequest<super::TransactionsRequest>,
) -> std::result::Result<
tonic::Response<super::TransactionsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grpc.tradeapi.v1.accounts.AccountsService/Transactions",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"grpc.tradeapi.v1.accounts.AccountsService",
"Transactions",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn subscribe_account(
&mut self,
request: impl tonic::IntoRequest<super::GetAccountRequest>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::GetAccountResponse>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grpc.tradeapi.v1.accounts.AccountsService/SubscribeAccount",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"grpc.tradeapi.v1.accounts.AccountsService",
"SubscribeAccount",
),
);
self.inner.server_streaming(req, path, codec).await
}
}
}