//!
//! AUTO-GENERATED CODE - DO NOT EDIT!
//!
//! IB REST API
//! Source: crates/bezant-spec/ibkr-openapi-3.1.json
//! Version: 2.29.0
//! Generated by `oas3-gen v0.25.3`
//!
//! The IB REST API reference documentation
use serde::{Deserialize, Serialize};
use validator::Validate;
pub const AUTHORIZATION: http::HeaderName = http::HeaderName::from_static("authorization");
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AccessToken200Response {
/// Indicates whether the authorizing username is paper or not.
pub is_true: Option<bool>,
/// Permanent OAuth access token for the consumer with respect to the authorizing username. 20 character hex value.
pub oauth_token: Option<String>,
/// OAuth token secret value. Base64-encoded string.
pub oauth_token_secret: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum Account200Response {
#[default]
FileDetails(FileDetailsResponse),
ResponseFile(ResponseFileResponse),
}
impl Account200Response {
pub fn file_details() -> Self {
Self::FileDetails(FileDetailsResponse::default())
}
pub fn file() -> Self {
Self::ResponseFile(ResponseFileResponse::default())
}
}
/// Array of objects representing accounts in the structure.
pub type Account200Response2 = Vec<AccountAttributes>;
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(default)]
pub struct AccountAttributes {
/// Indicates whether account has a prepaid crypto segment (Crypto Plus) with PAXOS.
#[serde(rename = "PrepaidCrypto-P")]
pub prepaid_crypto_p: Option<bool>,
/// Indicates whether account has a prepaid crypto segment (Crypto Plus) with ZEROHASH.
#[serde(rename = "PrepaidCrypto-Z")]
pub prepaid_crypto_z: Option<bool>,
/// User-defined alias assigned to the account for easy identification.
#[serde(rename = "accountAlias")]
pub account_alias: Option<String>,
/// Indicates the identifying number for the account.
#[serde(rename = "accountId")]
pub account_id: Option<String>,
/// Unix epoch timestamp of account opening.
#[serde(rename = "accountStatus")]
pub account_status: Option<i32>,
/// A name assigned to the account, typically the account holder name or business entity.
#[serde(rename = "accountTitle")]
pub account_title: Option<String>,
/// The account's virtual account number, or otherwise its IB accountId if no VAN is set.
#[serde(rename = "accountVan")]
pub account_van: Option<String>,
/// Identifies the type of client with which the account is associated, such as an individual or LLC.
#[serde(rename = "acctCustType")]
pub acct_cust_type: Option<String>,
/// Indicates whether account can receive live orders (do not mix with paper trading).
#[serde(rename = "brokerageAccess")]
pub brokerage_access: Option<bool>,
/// A descriptor of the nature of the account, reflecting the responsible group within IB.
#[serde(rename = "businessType")]
pub business_type: Option<AccountAttributesBusinessType>,
/// Designated account category. Only used in non-standard account structures.
pub category: Option<String>,
/// Status of the account with respect to clearing at IB. O is open, P pending, N new, A abandoned, C closed, R rejected.
#[serde(rename = "clearingStatus")]
pub clearing_status: Option<AccountAttributesClearingStatus>,
/// Indicates a Covestor account.
pub covestor: Option<bool>,
/// Base currency of the account.
#[default(Some("USD".to_string()))]
pub currency: Option<String>,
/// Internal human-readable description of the account.
pub desc: Option<String>,
/// Displayed name of the account in UI. Will reflect either the accountId or accountAlias, if set.
#[serde(rename = "displayName")]
pub display_name: Option<String>,
/// Indicates that the account is managed by a financial advisor.
#[serde(rename = "faClient")]
pub fa_client: Option<bool>,
/// IB business entity under which the account resides.
#[serde(rename = "ibEntity")]
pub ib_entity: Option<AccountAttributesIbEntity>,
/// The account's IB accountId.
pub id: Option<String>,
/// Indicates that trading by the client is disabled in the account.
#[serde(rename = "noClientTrading")]
pub no_client_trading: Option<bool>,
/// Describes account relations in partitioned or multiplexed (segemented) account structures.
pub parent: Option<AccountAttributesParent>,
/// Indicates that virtual forex positions are tracked in the account.
#[serde(rename = "trackVirtualFXPortfolio")]
pub track_virtual_fxportfolio: Option<bool>,
/// Internal identifier used by IB to reflect the trading permissions of the account.
#[serde(rename = "tradingType")]
#[default(Some("STKNOPT".to_string()))]
pub trading_type: Option<String>,
/// Indicates whether the account exists in production, paper, or demo environments.
#[serde(rename = "type")]
#[default(Some("DEMO".to_string()))]
pub r#type: Option<String>,
}
/// A descriptor of the nature of the account, reflecting the responsible group within IB.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
pub enum AccountAttributesBusinessType {
#[serde(rename = "IB_SALES")]
#[default]
IbSales,
#[serde(rename = "IB_PROSERVE")]
IbProserve,
}
impl core::fmt::Display for AccountAttributesBusinessType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::IbSales => write!(f, "IB_SALES"),
Self::IbProserve => write!(f, "IB_PROSERVE"),
}
}
}
/// Status of the account with respect to clearing at IB. O is open, P pending, N new, A abandoned, C closed, R rejected.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
pub enum AccountAttributesClearingStatus {
#[default]
O,
P,
N,
A,
R,
C,
}
impl core::fmt::Display for AccountAttributesClearingStatus {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::O => write!(f, "O"),
Self::P => write!(f, "P"),
Self::N => write!(f, "N"),
Self::A => write!(f, "A"),
Self::R => write!(f, "R"),
Self::C => write!(f, "C"),
}
}
}
/// IB business entity under which the account resides.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
pub enum AccountAttributesIbEntity {
#[serde(rename = "IBLLC-US")]
#[default]
IbllcUs,
#[serde(rename = "IB-CAN")]
IbCan,
#[serde(rename = "IB-UK")]
IbUk,
#[serde(rename = "IB-IE")]
IbIe,
}
impl core::fmt::Display for AccountAttributesIbEntity {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::IbllcUs => write!(f, "IBLLC-US"),
Self::IbCan => write!(f, "IB-CAN"),
Self::IbUk => write!(f, "IB-UK"),
Self::IbIe => write!(f, "IB-IE"),
}
}
}
/// Describes account relations in partitioned or multiplexed (segemented) account structures.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AccountAttributesParent {
/// Account ID of the parent account in a multiplex account structure.
#[serde(rename = "accountId")]
pub account_id: Option<String>,
/// Indicates that the given account is a multiplex child account.
#[serde(rename = "isMChild")]
pub is_mchild: Option<bool>,
/// Indicates that the given account is itself a multiplex parent account.
#[serde(rename = "isMParent")]
pub is_mparent: Option<bool>,
/// Indicates that the account is a multiplex account.
#[serde(rename = "isMultiplex")]
pub is_multiplex: Option<bool>,
/// Money manager client.
pub mmc: Option<Vec<serde_json::Value>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AccountData {
#[serde(rename = "accountAlias")]
pub account_alias: Option<String>,
#[serde(rename = "accountId")]
pub account_id: Option<String>,
#[serde(rename = "accountTitle")]
pub account_title: Option<String>,
#[serde(rename = "applicantType")]
pub applicant_type: Option<String>,
#[serde(rename = "baseCurrency")]
pub base_currency: Option<String>,
#[serde(rename = "businessDescription")]
pub business_description: Option<String>,
pub capabilities: Option<std::collections::HashMap<String, Vec<String>>>,
pub class_action_program: Option<String>,
#[serde(rename = "clearingStatus")]
pub clearing_status: Option<String>,
#[serde(rename = "clearingStatusDescription")]
pub clearing_status_description: Option<String>,
#[serde(rename = "countryOfCorporation")]
pub country_of_corporation: Option<String>,
#[serde(rename = "dateApproved")]
pub date_approved: Option<String>,
#[serde(rename = "dateBegun")]
pub date_begun: Option<String>,
#[serde(rename = "dateClosed")]
pub date_closed: Option<String>,
#[serde(rename = "dateDelinked")]
pub date_delinked: Option<String>,
#[serde(rename = "dateFunded")]
pub date_funded: Option<String>,
#[serde(rename = "dateLinked")]
pub date_linked: Option<String>,
#[serde(rename = "dateOpened")]
pub date_opened: Option<String>,
#[serde(rename = "dividendReinvestment")]
pub dividend_reinvestment: Option<std::collections::HashMap<String, bool>>,
#[serde(rename = "emailAddress")]
pub email_address: Option<String>,
pub equity: Option<f64>,
#[serde(rename = "externalId")]
pub external_id: Option<String>,
#[serde(rename = "feeTemplate")]
pub fee_template: Option<std::collections::HashMap<String, String>>,
pub household: Option<String>,
#[serde(rename = "investmentObjectives")]
pub investment_objectives: Option<Vec<String>>,
#[serde(rename = "limitedOptionTrading")]
pub limited_option_trading: Option<String>,
pub mailing: Option<std::collections::HashMap<String, String>>,
#[serde(rename = "mainAccount")]
pub main_account: Option<String>,
pub margin: Option<String>,
#[serde(rename = "masterAccountId")]
pub master_account_id: Option<String>,
#[serde(rename = "mifidCategory")]
pub mifid_category: Option<String>,
#[serde(rename = "mifirStatus")]
pub mifir_status: Option<String>,
#[serde(rename = "officialTitle")]
pub official_title: Option<String>,
#[serde(rename = "optionLevel")]
pub option_level: Option<i32>,
#[serde(rename = "orgType")]
pub org_type: Option<String>,
#[serde(rename = "primaryUser")]
pub primary_user: Option<String>,
#[serde(rename = "processType")]
pub process_type: Option<String>,
#[serde(rename = "propertyProfile")]
pub property_profile: Option<String>,
#[serde(rename = "registeredAddress")]
pub registered_address: Option<std::collections::HashMap<String, String>>,
#[serde(rename = "riskScore")]
pub risk_score: Option<i32>,
pub signatures: Option<Vec<String>>,
#[serde(rename = "sourceAccountId")]
pub source_account_id: Option<String>,
#[serde(rename = "stateCode")]
pub state_code: Option<String>,
#[serde(rename = "stockYieldProgram")]
pub stock_yield_program: Option<std::collections::HashMap<String, String>>,
#[serde(rename = "subType")]
pub sub_type: Option<String>,
#[serde(rename = "taxIds")]
pub tax_ids: Option<Vec<std::collections::HashMap<String, String>>>,
#[serde(rename = "taxTreatyDetails")]
pub tax_treaty_details: Option<Vec<std::collections::HashMap<String, String>>>,
#[serde(rename = "tradeIntentionType")]
pub trade_intention_type: Option<String>,
#[serde(rename = "trustType")]
pub trust_type: Option<String>,
#[serde(rename = "usTaxPurposeType")]
pub us_tax_purpose_type: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AccountDetailsResponse {
pub account: Option<AccountData>,
#[serde(rename = "associatedEntities")]
pub associated_entities: Option<Vec<AssociatedEntity>>,
#[serde(rename = "associatedPersons")]
pub associated_persons: Option<Vec<AssociatedPerson>>,
pub decedents: Option<Vec<std::collections::HashMap<String, String>>>,
#[serde(rename = "entityIRABeneficiaries")]
pub entity_irabeneficiaries: Option<Vec<EntityIRABene>>,
pub error: Option<Box<ErrorResponse>>,
#[serde(rename = "errorDescription")]
pub error_description: Option<String>,
#[serde(rename = "financialInformation")]
pub financial_information: Option<std::collections::HashMap<String, serde_json::Value>>,
#[serde(rename = "hasError")]
pub has_error: Option<bool>,
#[serde(rename = "individualIRABeneficiaries")]
pub individual_irabeneficiaries: Option<Vec<IndividualIRABene>>,
#[serde(rename = "marketData")]
pub market_data: Option<Vec<std::collections::HashMap<String, String>>>,
pub restrictions: Option<Vec<RestrictionInfo>>,
#[serde(rename = "sourcesOfWealth")]
pub sources_of_wealth: Option<Vec<std::collections::HashMap<String, serde_json::Value>>>,
#[serde(rename = "tradeBundles")]
pub trade_bundles: Option<Vec<String>>,
#[serde(rename = "withHoldingStatement")]
pub with_holding_statement: Option<std::collections::HashMap<String, String>>,
}
pub type AccountRequestBody = String;
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AccountStatusBulkResponse {
pub accounts: Option<Vec<AccountStatusResponse>>,
pub limit: Option<i32>,
pub offset: Option<i32>,
pub total: Option<i32>,
}
#[serde_with::skip_serializing_none]
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
)]
pub struct AccountStatusRequest {
#[serde(rename = "endDate")]
pub end_date: chrono::NaiveDate,
#[validate(range(min = 1i32, max = 1_000i32))]
pub limit: Option<i32>,
#[validate(range(min = 0i32))]
pub offset: Option<i32>,
#[serde(rename = "startDate")]
pub start_date: chrono::NaiveDate,
pub status: Option<RequestStatus>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AccountStatusResponse {
#[serde(rename = "accountId")]
pub account_id: Option<String>,
#[serde(rename = "adminAccountId")]
pub admin_account_id: Option<String>,
#[serde(rename = "dateClosed")]
pub date_closed: Option<chrono::DateTime<chrono::Utc>>,
#[serde(rename = "dateOpened")]
pub date_opened: Option<chrono::DateTime<chrono::Utc>>,
#[serde(rename = "dateStarted")]
pub date_started: Option<chrono::DateTime<chrono::Utc>>,
pub description: Option<String>,
#[serde(rename = "masterAccountId")]
pub master_account_id: Option<String>,
pub message: Option<String>,
pub state: Option<String>,
pub status: Option<String>,
}
/// Successful return contianing an array of at-a-glance account details.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AccountSummaryResponse {
/// Simple Moving Average of the account.
#[serde(rename = "SMA")]
pub sma: Option<f64>,
/// Describes the unique account type. For standard individual accounts, an empty string is returned.
#[serde(rename = "accountType")]
pub account_type: Option<String>,
/// Accrued interest is the interest accruing on a security since the previous coupon date. If a security is sold between two payment dates, the buyer usually compensates the seller for the interest accrued, either within the price or as a separate payment.
#[serde(rename = "accruedInterest")]
pub accrued_interest: Option<f64>,
/// The amount of equity you have available for trading. For both the Securities and Commodities segments, this is calculated as: Equity with Loan Value – Initial Margin.
#[serde(rename = "availableFunds")]
pub available_funds: Option<f64>,
/// Returns the total account balance.
pub balance: Option<f64>,
/// Total buying power available for the account.
#[serde(rename = "buyingPower")]
pub buying_power: Option<f64>,
/// An array containing balance information for all currencies held by the account.
#[serde(rename = "cashBalances")]
pub cash_balances: Option<Vec<AccountSummaryResponseCashBalance>>,
/// The basis for determining whether you have the necessary assets to either initiate or maintain security assets.
#[serde(rename = "equityWithLoanValue")]
pub equity_with_loan_value: Option<f64>,
/// The amount of cash in excess of the usual requirement in your account.
#[serde(rename = "excessLiquidity")]
pub excess_liquidity: Option<f64>,
/// The available initial margin for the account.
#[serde(rename = "initialMargin")]
pub initial_margin: Option<f64>,
/// The available maintenance margin for the account.
#[serde(rename = "maintenanceMargin")]
pub maintenance_margin: Option<f64>,
/// The basis for determining the price of the assets in your account.
#[serde(rename = "netLiquidationValue")]
pub net_liquidation_value: Option<f64>,
/// The Federal Reserve Board regulation governing the amount of credit that broker dealers may extend to clients who borrow money to buy securities on margin.
#[serde(rename = "regTLoan")]
pub reg_tloan: Option<f64>,
/// The initial margin requirements calculated under US Regulation T rules for both the securities and commodities segment of your account.
#[serde(rename = "regTMargin")]
pub reg_tmargin: Option<f64>,
/// Absolute value of the Long Stock Value + Short Stock Value + Long Option Value + Short Option Value + Fund Value.
#[serde(rename = "securitiesGVP")]
pub securities_gvp: Option<f64>,
/// If the account is currently non-tradeable, a status message will be dispalyed.
pub status: Option<String>,
/// Cash recognized at the time of trade + futures P&L. This value reflects real-time currency positions, including:
/// * Trades executed directly through the FX market.
/// * Trades executed as a result of automatic IB conversions, which occur when you trade a product in a non-base currency.
/// * Trades deliberately executed to close non-base currency positions using the FXCONV destination.
#[serde(rename = "totalCashValue")]
pub total_cash_value: Option<f64>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AccountSummaryResponseCashBalance {
/// The total available currency held in the account.
pub balance: Option<f64>,
/// The currency the values represent. Base currency represented as "Total (in {BaseCurrency})"
pub currency: Option<String>,
/// The available settled cash that can be withdrawn from the account.
#[serde(rename = "settledCash")]
pub settled_cash: Option<f64>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct AcctIdRequestBody {
/// Identifier for the unique account to retrieve information from.
/// - Example: `Some("U1234567".to_string())`
#[serde(rename = "acctId")]
pub acct_id: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct AcctIdRequestBody2 {
/// The account ID that should be set for future requests.
/// - Example: `"U1234567".to_string()`
#[serde(rename = "acctId")]
#[validate(length(min = 1u64))]
pub acct_id: String,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct AcctIdRequestBody3 {
/// An array of strings containing each account identifier to retrieve performance details for.
#[serde(rename = "acctIds")]
pub acct_ids: Option<Vec<String>>,
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct AchInstruction {
/// - Example: `"U223454".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64, max = 32u64))]
pub account_id: String,
/// - Example: `"DEBIT_CREDIT"`
#[serde(rename = "achType")]
pub ach_type: AchInstructionAchType,
/// - Example: `"USACH"`
#[serde(rename = "bankInstructionCode")]
pub bank_instruction_code: AchInstructionBankInstructionCode,
/// - Example: `"TestInstr".to_string()`
#[serde(rename = "bankInstructionName")]
#[validate(length(min = 1u64, max = 100u64))]
pub bank_instruction_name: String,
#[serde(rename = "clientAccountInfo")]
#[validate(nested)]
pub client_account_info: AchInstructionClientAccountInfo,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `"USD".to_string()`
#[validate(length(min = 1u64, max = 3u64))]
pub currency: String,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum AchInstructionAchType {
#[serde(rename = "DEBIT")]
#[default]
Debit,
#[serde(rename = "CREDIT")]
Credit,
#[serde(rename = "DEBIT_CREDIT")]
DebitCredit,
}
impl core::fmt::Display for AchInstructionAchType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Debit => write!(f, "DEBIT"),
Self::Credit => write!(f, "CREDIT"),
Self::DebitCredit => write!(f, "DEBIT_CREDIT"),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum AchInstructionBankInstructionCode {
#[serde(rename = "CAACH")]
#[default]
Caach,
#[serde(rename = "USACH")]
Usach,
}
impl core::fmt::Display for AchInstructionBankInstructionCode {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Caach => write!(f, "CAACH"),
Self::Usach => write!(f, "USACH"),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct AchInstructionClientAccountInfo {
/// - Example: `"101267576983".to_string()`
#[serde(rename = "bankAccountNumber")]
#[validate(length(min = 1u64, max = 32u64))]
pub bank_account_number: String,
/// - Example: `1`
#[serde(rename = "bankAccountTypeCode")]
pub bank_account_type_code: AchInstructionClientAccountInfoBankAccountTypeCode,
/// - Example: `"JPM Chase".to_string()`
#[serde(rename = "bankName")]
#[validate(length(min = 1u64, max = 100u64))]
pub bank_name: String,
/// - Example: `"202012983".to_string()`
#[serde(rename = "bankRoutingNumber")]
#[validate(length(min = 1u64, max = 24u64))]
pub bank_routing_number: String,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum AchInstructionClientAccountInfoBankAccountTypeCode {
#[serde(rename = "0")]
#[default]
Value0,
#[serde(rename = "1")]
Value1,
#[serde(rename = "2")]
Value2,
}
impl core::fmt::Display for AchInstructionClientAccountInfoBankAccountTypeCode {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Value0 => write!(f, "0"),
Self::Value1 => write!(f, "1"),
Self::Value2 => write!(f, "2"),
}
}
}
/// Respond to a server prompt received via ntf websocket message.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct AckServerPromptRequest {
pub body: NotificationRequestBody,
}
impl AckServerPromptRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<AckServerPromptResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<String>::json_with_diagnostics(req).await?;
return Ok(AckServerPromptResponse::Ok(data));
}
let _ = req.bytes().await?;
return Ok(AckServerPromptResponse::Unknown);
}
}
/// Response types for ackServerPrompt
#[derive(Debug, Clone)]
pub enum AckServerPromptResponse {
///200: Status of submitted prompt
Ok(String),
///default: Unknown response
Unknown,
}
/// Activate or Deactivate existing alerts created for this account. This does not delete alerts, but disables notifications until reactivated.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct ActivateAlertRequest {
#[validate(nested)]
pub path: ActivateAlertRequestPath,
pub body: AlertActivationRequest,
}
impl ActivateAlertRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<ActivateAlertResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<AlertActivationResponse>::json_with_diagnostics(
req,
)
.await?;
return Ok(ActivateAlertResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(ActivateAlertResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(ActivateAlertResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(ActivateAlertResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct ActivateAlertRequestPath {
/// - Example: `"U1234567".to_string()`
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for activateAlert
#[derive(Debug, Clone)]
pub enum ActivateAlertResponse {
///200: An object containing details about the activated/deactivated alert.
Ok(AlertActivationResponse),
///401: Invalid or expired access token
Unauthorized,
///500: Internal Server Error; unable to process incoming request due to invalid data in it
InternalServerError,
///default: Unknown response
Unknown,
}
/// Relates a message generated in response to the rejection of the submitted order ticket. In some cases, it may also present a mechanism to resubmit the same order following a prompted decision.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AdvancedOrderReject {
/// Indicates whether this prompt is dismissable.
pub dismissable: Option<Vec<serde_json::Value>>,
/// IB internal identifier for the nature or category of the returned message.
#[serde(rename = "messageId")]
pub message_id: Option<String>,
/// Choices available to the client in response to the rejection message.
pub options: Option<Vec<String>>,
/// The order ID assigned by IB to the rejected order ticket.
#[serde(rename = "orderId")]
pub order_id: Option<i32>,
/// Indicates that the message is a prompt offering a set of decisions, one or more of which may permit the rejected order to be resubmitted.
pub prompt: Option<bool>,
/// IB's internal identifier assigned to the returned message.
#[serde(rename = "reqId")]
pub req_id: Option<String>,
/// Human-readable text of the messages emitted by IB in response to order submission.
pub text: Option<String>,
/// The specific type of message returned.
#[serde(rename = "type")]
pub r#type: Option<String>,
}
/// An array containing all alerts as separate objects.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct Alert {
/// The account the alert was attributed to.
pub account: Option<String>,
/// Determines if the alert is active [1] or not [0]
pub alert_active: Option<AlertActivationRequestAlertActive>,
/// The requested name for the alert.
pub alert_name: Option<String>,
/// Confirms if the alert is enabled to occur more than once.
pub alert_repeatable: Option<AlertActivationRequestAlertActive>,
/// Confirms if the order is triggered or not.
pub alert_triggered: Option<bool>,
/// The order id (alert id)
pub order_id: Option<i32>,
/// UTC-formatted time of the alert's creation.
pub order_time: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct AlertActivationRequest {
/// Set whether or not the alert should be active (1) or inactive (0).
#[serde(rename = "alertActive")]
pub alert_active: AlertActivationRequestAlertActive,
/// The alert Identifier
#[serde(rename = "alertId")]
pub alert_id: i32,
}
/// Determines if the alert is active [1] or not [0]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
pub enum AlertActivationRequestAlertActive {
#[serde(rename = "1")]
#[default]
Value1,
#[serde(rename = "0")]
Value0,
}
impl core::fmt::Display for AlertActivationRequestAlertActive {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Value1 => write!(f, "1"),
Self::Value0 => write!(f, "0"),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AlertActivationResponse {
/// If "success" returns false, will list failed order Ids
pub failure_list: Option<String>,
/// The tracking number of the alert. Occasssionally referenced as the alertId or alert_id.
pub order_id: Option<i32>,
pub request_id: Option<i32>,
/// Displays result status of alert request
pub success: Option<bool>,
/// Response message to clarify success status reason.
pub text: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AlertCondition {
/// Condition logic_bind value set.
pub condition_logic_bind: Option<bool>,
/// Condition operator set for alert.
pub condition_operator: Option<String>,
/// Condition timeZone value set.
pub condition_time_zone: Option<String>,
/// TriggerMethod value set.
pub condition_trigger_method: Option<i32>,
/// The type of condition set.
pub condition_type: Option<i32>,
/// Condition value set.
pub condition_value: Option<String>,
/// Returns conid and exchange in the format "conid@exchange"
pub conidex: Option<String>,
/// Includes relevant descriptions (if applicable).
pub contract_description_1: Option<String>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct AlertCreationRequest {
/// Alert message which will be sent
#[serde(rename = "alertMessage")]
#[validate(length(min = 1u64))]
pub alert_message: String,
/// Alert name.
#[serde(rename = "alertName")]
#[validate(length(min = 1u64))]
pub alert_name: String,
/// Boolean number (0, 1) signifies if an alert can be triggered more than once. A value of '1' is required for MTA alerts
#[serde(rename = "alertRepeatable")]
pub alert_repeatable: AlertActivationRequestAlertActive,
/// Container for all conditions applied for an alert to trigger.
#[validate(nested)]
pub conditions: Vec<AlertCreationRequestCondition>,
/// Email address you want to send email alerts to
pub email: Option<String>,
/// Used with a tif of "GTD" only. Signifies time when the alert should terminate if no alert is triggered.
#[serde(rename = "expireTime")]
pub expire_time: Option<String>,
/// allow (0) or disallow (1) alerts to trigger alerts through the mobile app
#[serde(rename = "iTWSOrdersOnly")]
pub i_twsorders_only: Option<i32>,
/// optional; used in case of modification and represent Alert Id
#[serde(rename = "orderId")]
pub order_id: Option<i64>,
/// Allow (1) or disallow (0) the alert to be triggered outside of regular trading hours
#[serde(rename = "outsideRth")]
pub outside_rth: AlertActivationRequestAlertActive,
/// allow (1) or disallow (0) alerts to trigger email messages
#[serde(rename = "sendMessage")]
pub send_message: Option<AlertActivationRequestAlertActive>,
/// allow (1) or disallow (0) alerts to trigger TWS Pop-up messages
#[serde(rename = "showPopup")]
pub show_popup: Option<i32>,
/// Time in Force duration of alert.
pub tif: AlertCreationRequestTif,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
#[serde(default)]
pub struct AlertCreationRequestCondition {
/// Concatenation of conid and exchange. Formatted as "conid@exchange"
/// - Example: `"265598@SMART".to_string()`
#[validate(length(min = 1u64))]
pub conidex: String,
/// Describes how multiple conditions should behave together. Available logic types:
/// * `a` - AND
/// * `o` - OR
/// * `n` - END
#[serde(rename = "logicBind")]
#[default(Some(Default::default()))]
pub logic_bind: Option<AlertCreationRequestConditionLogicBind>,
/// Indicates whether the trigger should be above or below the given value. (one of: >=, <=, >, <, ==)
#[validate(length(min = 1u64))]
pub operator: String,
/// Only needed for some MTA alert condition.
#[serde(rename = "timeZone")]
pub time_zone: Option<String>,
/// Pass the string representation of zero, "0"
#[serde(rename = "triggerMethod")]
#[validate(length(min = 1u64))]
pub trigger_method: String,
/// Designate what condition type to use. Note the "MTA" types listed are only supported if iTWSOrdersOnly=1 Available condition types:
/// * `1` - Price
/// * `3` - Time
/// * `4` - Margin
/// * `5` - Trade
/// * `6` - Volume
/// * `7` - MTA Market
/// * `8` - MTA Postion
/// * `9` - MTA Account Daily PnL
#[serde(rename = "type")]
pub r#type: AlertCreationRequestConditionType,
/// Trigger value based on Type.
#[default(Some("*".to_string()))]
pub value: Option<String>,
}
/// Describes how multiple conditions should behave together. Available logic types:
/// * `a` - AND
/// * `o` - OR
/// * `n` - END
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum AlertCreationRequestConditionLogicBind {
#[serde(rename = "a")]
#[default]
A,
#[serde(rename = "o")]
O,
#[serde(rename = "n")]
N,
}
impl core::fmt::Display for AlertCreationRequestConditionLogicBind {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::A => write!(f, "a"),
Self::O => write!(f, "o"),
Self::N => write!(f, "n"),
}
}
}
/// Designate what condition type to use. Note the "MTA" types listed are only supported if iTWSOrdersOnly=1 Available condition types:
/// * `1` - Price
/// * `3` - Time
/// * `4` - Margin
/// * `5` - Trade
/// * `6` - Volume
/// * `7` - MTA Market
/// * `8` - MTA Postion
/// * `9` - MTA Account Daily PnL
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum AlertCreationRequestConditionType {
#[serde(rename = "1")]
#[default]
Value1,
#[serde(rename = "3")]
Value3,
#[serde(rename = "4")]
Value4,
#[serde(rename = "5")]
Value5,
#[serde(rename = "6")]
Value6,
#[serde(rename = "7")]
Value7,
#[serde(rename = "8")]
Value8,
#[serde(rename = "9")]
Value9,
}
impl core::fmt::Display for AlertCreationRequestConditionType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Value1 => write!(f, "1"),
Self::Value3 => write!(f, "3"),
Self::Value4 => write!(f, "4"),
Self::Value5 => write!(f, "5"),
Self::Value6 => write!(f, "6"),
Self::Value7 => write!(f, "7"),
Self::Value8 => write!(f, "8"),
Self::Value9 => write!(f, "9"),
}
}
}
/// Time in Force duration of alert.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum AlertCreationRequestTif {
#[serde(rename = "GTC")]
#[default]
Gtc,
#[serde(rename = "GTD")]
Gtd,
}
impl core::fmt::Display for AlertCreationRequestTif {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Gtc => write!(f, "GTC"),
Self::Gtd => write!(f, "GTD"),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AlertCreationResponse {
/// The tracking number of the alert. Alert identifier internally referenced as order id.
pub order_id: Option<i32>,
/// Not applicable
pub order_status: Option<String>,
/// Not applicable
pub request_id: Option<i32>,
/// Displays result status of alert request
pub success: Option<bool>,
/// Response message to clarify submission status.
pub text: Option<String>,
/// Returns 'null'
pub warning_message: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AlertDeletionResponse {
/// If "success" returns false, will list failed order Ids
pub failure_list: Option<String>,
/// The tracking number of the alert. Occasssionally referenced as the alertId or alert_id.
pub order_id: Option<i32>,
/// Not applicable
pub request_id: Option<i32>,
/// Displays result status of alert request
pub success: Option<bool>,
/// Response message to clarify success status reason.
pub text: Option<String>,
}
/// details of the specified alert
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AlertDetails {
/// Requestor's account ID
pub account: Option<String>,
/// Human readable name of the alert.
#[serde(rename = "alertName")]
pub alert_name: Option<String>,
/// Returns if the alert is active [1] or disabled [0].
pub alert_active: Option<AlertActivationRequestAlertActive>,
/// Returns default type set for alerts. Configured in Client Portal.
pub alert_default_type: Option<i32>,
/// Returns the designated email address for sendMessage functionality.
pub alert_email: Option<String>,
/// Returns the body content of what your alert will report once triggered
pub alert_message: Option<String>,
/// Returns currency set for MTA alerts. Only valid for alert type 8 & 9.
pub alert_mta_currency: Option<String>,
/// Returns current MTA default values.
pub alert_mta_defaults: Option<String>,
/// Returns whether or not the alert will play audio
pub alert_play_audio: Option<i32>,
/// Returns if the alert can be sent more than once.
pub alert_repeatable: Option<i32>,
/// Returns whether or not the alert will send an email.
pub alert_send_message: Option<i32>,
/// Returns whether or not the alert will trigger TWS Pop-up messages
pub alert_show_popup: Option<i32>,
/// Returns whether or not the alert was triggered yet.
pub alert_triggered: Option<i32>,
/// Background color. Not applicable to API.
pub bg_color: Option<String>,
/// Returns whether or not the alert will trigger outside of regular trading hours.
pub condition_outside_rth: Option<i32>,
/// Returns the total number of conditions in the alert.
pub condition_size: Option<i32>,
/// Returns all conditions
pub conditions: Option<Vec<AlertCondition>>,
/// Returns the UTC formatted date used in GTD orders.
pub expire_time: Option<String>,
/// Foreground color. Not applicable to API.
pub fg_color: Option<String>,
/// Returns whether or not the alert will trigger mobile notifications.
pub itws_orders_only: Option<i32>,
/// Alert's tracking ID. Can be used for modifying or deleting alerts.
pub order_id: Option<i32>,
/// Returns if the order can be edited.
pub order_not_editable: Option<bool>,
/// represent order statusAlways returns "Presubmitted".
pub order_status: Option<AlertDetailsOrderStatus>,
/// Time in Force effective for the Alert
pub tif: Option<String>,
/// Returned for time-specific conditions.
pub time_zone: Option<String>,
/// Tracking ID for MTA alerts only. Returns 'null' for standard alerts.
pub tool_id: Option<i32>,
}
/// represent order statusAlways returns "Presubmitted".
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
pub enum AlertDetailsOrderStatus {
#[default]
Presubmitted,
Submitted,
}
impl core::fmt::Display for AlertDetailsOrderStatus {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Presubmitted => write!(f, "Presubmitted"),
Self::Submitted => write!(f, "Submitted"),
}
}
}
pub type Alerts = Vec<Alert>;
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AlgoParam {
/// Default parameter value. Type defined in valueClassName field
#[serde(rename = "defaultValue")]
pub default_value: Option<AlgoParamDefaultValue>,
pub description: Option<String>,
/// Positional ranking for the algo. Used for Client Portal.
#[serde(rename = "guiRank")]
pub gui_rank: Option<i32>,
/// Parameter identifier for the algo.
pub id: Option<String>,
/// Allowed values for the parameter.
#[serde(rename = "legalStrings")]
pub legal_strings: Option<Vec<String>>,
#[serde(rename = "maxValue")]
pub max_value: Option<i32>,
#[serde(rename = "minValue")]
pub min_value: Option<f64>,
/// Parameter name.
pub name: Option<String>,
/// States whether the parameter is required for the given algo order to place.
pub required: Option<bool>,
/// Returns the variable type of the parameter.
#[serde(rename = "valueClassName")]
pub value_class_name: Option<AlgoParamValueClassName>,
}
/// Default parameter value. Type defined in valueClassName field
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum AlgoParamDefaultValue {
#[default]
String(String),
Integer(i32),
Boolean(bool),
Number(f64),
}
/// Returns the variable type of the parameter.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
pub enum AlgoParamValueClassName {
#[default]
String,
Boolean,
Time,
Double,
Integer,
}
impl core::fmt::Display for AlgoParamValueClassName {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::String => write!(f, "String"),
Self::Boolean => write!(f, "Boolean"),
Self::Time => write!(f, "Time"),
Self::Double => write!(f, "Double"),
Self::Integer => write!(f, "Integer"),
}
}
}
/// available algos
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AlgosResponse {
/// Contains all relevant algos for the contract.
pub algos: Option<Vec<AlgosResponseAlgo>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AlgosResponseAlgo {
/// Algo identifier used for requests.
pub id: String,
/// Common name of the algo
pub name: String,
pub parameters: Option<Vec<AlgoParam>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(default)]
pub struct AllocationGroup {
/// Contains a series of objects depicting which accounts are involved and, for user-defined allocation methods, the distribution value for each sub-account.
pub accounts: Option<Vec<AllocationGroupAccount>>,
/// Interactive Brokers supports two forms of allocation methods. Allocation methods that have calculations completed by Interactive Brokers, and a set of allocation methods calculated by the user and then specified. IB-computed allocation methods:
/// * `A` - Available Equity
/// * `E` - Equal
/// * `N` - Net Liquidation Value
///
/// User-specified allocation methods:
/// * `C` - Cash Quantity
/// * `P` - Percentage
/// * `R` - Ratios
/// * `S` - Shares
#[default(Some(Default::default()))]
pub default_method: Option<AllocationMethod>,
/// Name used to refer to your allocation group. This will be used while placing orders.
pub name: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AllocationGroupAccount {
/// The total distribution value for each sub-account for user-defined allocation methods.
pub amount: Option<f64>,
/// The accountId of a given sub-account.
pub name: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AllocationGroups {
/// array, which contains all allocation groups under the advisor account
pub data: Option<Vec<AllocationGroupsDatum>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(default)]
pub struct AllocationGroupsDatum {
/// Interactive Brokers supports two forms of allocation methods. Allocation methods that have calculations completed by Interactive Brokers, and a set of allocation methods calculated by the user and then specified. IB-computed allocation methods:
/// * `A` - Available Equity
/// * `E` - Equal
/// * `N` - Net Liquidation Value
///
/// User-specified allocation methods:
/// * `C` - Cash Quantity
/// * `P` - Percentage
/// * `R` - Ratios
/// * `S` - Shares
#[default(Some(Default::default()))]
pub allocation_method: Option<AllocationMethod>,
/// The name set for the given allocation group.
pub name: Option<String>,
/// Represents the total number of sub-accounts within the group.
pub size: Option<i32>,
}
/// Interactive Brokers supports two forms of allocation methods. Allocation methods that have calculations completed by Interactive Brokers, and a set of allocation methods calculated by the user and then specified. IB-computed allocation methods:
/// * `A` - Available Equity
/// * `E` - Equal
/// * `N` - Net Liquidation Value
///
/// User-specified allocation methods:
/// * `C` - Cash Quantity
/// * `P` - Percentage
/// * `R` - Ratios
/// * `S` - Shares
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
pub enum AllocationMethod {
#[default]
A,
E,
N,
C,
P,
R,
S,
}
impl core::fmt::Display for AllocationMethod {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::A => write!(f, "A"),
Self::E => write!(f, "E"),
Self::N => write!(f, "N"),
Self::C => write!(f, "C"),
Self::P => write!(f, "P"),
Self::R => write!(f, "R"),
Self::S => write!(f, "S"),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AmRequestStatusResponse {
#[serde(rename = "acctId")]
pub acct_id: Option<String>,
pub message: Option<String>,
#[serde(rename = "requestId")]
pub request_id: Option<String>,
#[serde(rename = "requestType")]
pub request_type: Option<String>,
pub status: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AnswerResponse {
pub answer: Option<String>,
#[serde(rename = "answerId")]
pub answer_id: Option<i64>,
#[serde(rename = "dependentAnswerId")]
pub dependent_answer_id: Option<i64>,
#[serde(rename = "dependentQuestionId")]
pub dependent_question_id: Option<i64>,
#[serde(rename = "multiAnswerDetail")]
pub multi_answer_detail: Option<Vec<String>>,
}
/// Applies verified CSV changes. Requires both Bearer token (header) and signed JWT (body). CSV must be verified via /csv/v2/verify first. JWT validity: 1 minute.<br><br>**Scope**: `restrictions.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct ApplyCsvRequest {
#[validate(nested)]
pub header: ApplyCsvRequestHeader,
/// Signed JWT token (format: header.payload.signature). Generate using: oauth2_cli sign -C userName={user} -C requestId={id} -C payload={csv} -C iss={user} -k {key}
pub body: RestrictionRequestBody,
}
impl ApplyCsvRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<ApplyCsvResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<CSVResponse>::json_with_diagnostics(req).await?;
return Ok(ApplyCsvResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(ApplyCsvResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(ApplyCsvResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(ApplyCsvResponse::Forbidden);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(ApplyCsvResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(ApplyCsvResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct ApplyCsvRequestHeader {
/// OAuth 2.0 Bearer token. Format: Bearer {access_token}. Token contains accountId claim. Validity: ~50 minutes.
/// - Example: `"Bearer eyJ0eXAiOiJhdCtKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjFkOTEx...".to_string()`
#[validate(length(min = 1u64))]
pub authorization: String,
}
impl core::convert::TryFrom<&ApplyCsvRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(headers: &ApplyCsvRequestHeader) -> core::result::Result<Self, Self::Error> {
let mut map = http::HeaderMap::with_capacity(1usize);
let header_value = http::HeaderValue::try_from(&headers.authorization)?;
map.insert(AUTHORIZATION, header_value);
Ok(map)
}
}
impl core::convert::TryFrom<ApplyCsvRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(headers: ApplyCsvRequestHeader) -> core::result::Result<Self, Self::Error> {
http::HeaderMap::try_from(&headers)
}
}
/// Response types for applyCSV
#[derive(Debug, Clone)]
pub enum ApplyCsvResponse {
///200: CSV application result
Ok(CSVResponse),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
///403: Insufficient permissions or JWT validation failed
Forbidden,
///500: Internal server error
InternalServerError,
///default: Unknown response
Unknown,
}
pub type ArrayNode = serde_json::Value;
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AssociatedEntity {
#[serde(rename = "AssociatedPersons")]
pub associated_persons: Option<Vec<AssociatedPerson>>,
pub associations: Option<Vec<String>>,
pub email: Option<String>,
#[serde(rename = "entityId")]
pub entity_id: Option<i32>,
#[serde(rename = "externalCode")]
pub external_code: Option<String>,
#[serde(rename = "identityDocuments")]
pub identity_documents: Option<Vec<std::collections::HashMap<String, String>>>,
pub mailing: Option<std::collections::HashMap<String, String>>,
pub name: Option<String>,
#[serde(rename = "organizationCountry")]
pub organization_country: Option<String>,
pub phones: Option<std::collections::HashMap<String, String>>,
pub residence: Option<std::collections::HashMap<String, String>>,
#[serde(rename = "taxTreatyDetails")]
pub tax_treaty_details: Option<Vec<std::collections::HashMap<String, String>>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AssociatedPerson {
pub associations: Option<Vec<String>>,
pub commercial: Option<String>,
#[serde(rename = "countryOfBirth")]
pub country_of_birth: Option<String>,
#[serde(rename = "countryOfCitizenship")]
pub country_of_citizenship: Option<String>,
#[serde(rename = "countryOfLegalResidence")]
pub country_of_legal_residence: Option<String>,
#[serde(rename = "dateOfBirth")]
pub date_of_birth: Option<String>,
pub email: Option<String>,
#[serde(rename = "employmentDetails")]
pub employment_details: Option<std::collections::HashMap<String, serde_json::Value>>,
#[serde(rename = "employmentType")]
pub employment_type: Option<String>,
#[serde(rename = "entityId")]
pub entity_id: Option<i32>,
#[serde(rename = "externalCode")]
pub external_code: Option<String>,
#[serde(rename = "firstName")]
pub first_name: Option<String>,
pub gender: Option<String>,
#[serde(rename = "identityDocuments")]
pub identity_documents: Option<Vec<std::collections::HashMap<String, String>>>,
#[serde(rename = "lastLogin")]
pub last_login: Option<String>,
#[serde(rename = "lastName")]
pub last_name: Option<String>,
pub mailing: Option<std::collections::HashMap<String, String>>,
#[serde(rename = "maritalStatus")]
pub marital_status: Option<String>,
#[serde(rename = "mdSubscriberStatus")]
pub md_subscriber_status: Option<String>,
#[serde(rename = "middleInitial")]
pub middle_initial: Option<String>,
#[serde(rename = "middleName")]
pub middle_name: Option<String>,
#[serde(rename = "motersMaidenName")]
pub moters_maiden_name: Option<String>,
#[serde(rename = "numberOfDependents")]
pub number_of_dependents: Option<i32>,
#[serde(rename = "passwordDate")]
pub password_date: Option<String>,
pub phones: Option<std::collections::HashMap<String, String>>,
pub residence: Option<std::collections::HashMap<String, String>>,
pub salutation: Option<String>,
#[serde(rename = "securityDevice")]
pub security_device: Option<String>,
#[serde(rename = "stateOfLegalResidence")]
pub state_of_legal_residence: Option<String>,
#[serde(rename = "subscribedServices")]
pub subscribed_services: Option<Vec<std::collections::HashMap<String, serde_json::Value>>>,
pub suffix: Option<String>,
#[serde(rename = "taxTreatyDetails")]
pub tax_treaty_details: Option<Vec<std::collections::HashMap<String, String>>>,
#[serde(rename = "userStatus")]
pub user_status: Option<String>,
#[serde(rename = "userStatusTrading")]
pub user_status_trading: Option<String>,
pub username: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AsynchronousInstructionResponse {
#[serde(rename = "instructionResult")]
pub instruction_result: Option<InstructionResult>,
/// - Example: `-1988905739.0`
#[serde(rename = "instructionSetId")]
pub instruction_set_id: f64,
/// - Example: `202.0`
pub status: f64,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AsynchronousInstructionSetResponse {
#[serde(rename = "instructionResults")]
pub instruction_results: Option<Vec<AsynchronousInstructionSetResponseInstructionResult>>,
/// - Example: `-1988905739.0`
#[serde(rename = "instructionSetId")]
pub instruction_set_id: f64,
/// - Example: `202i32`
pub status: i32,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AsynchronousInstructionSetResponseInstructionResult {
#[serde(rename = "instructionResult")]
pub instruction_result: InstructionResult,
/// - Example: `9094.0`
#[serde(rename = "instructionSetId")]
pub instruction_set_id: f64,
/// - Example: `202i32`
pub status: i32,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct Au10TixDetailResponse {
#[serde(rename = "entityId")]
pub entity_id: Option<i32>,
pub error: Option<Box<ErrorResponse>>,
#[serde(rename = "errorDescription")]
pub error_description: Option<String>,
#[serde(rename = "expiryDate")]
pub expiry_date: Option<chrono::DateTime<chrono::Utc>>,
#[serde(rename = "externalId")]
pub external_id: Option<String>,
#[serde(rename = "hasError")]
pub has_error: Option<bool>,
#[serde(rename = "startDate")]
pub start_date: Option<chrono::DateTime<chrono::Utc>>,
pub state: Option<String>,
pub url: Option<String>,
}
/// Contains a combined overview of Commidity, Security and Crypto fund values.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AvailableFundsResponse {
/// Contains commodities specific fund values.
#[serde(rename = "Crypto at Paxos")]
pub crypto_at_paxos: Option<Funds>,
/// Contains commodities specific fund values.
pub commodities: Option<Funds>,
/// Contains an overview of Security specific fund values.
pub securities: Option<AvailableFundsResponseSecurities>,
/// total values
pub total: Option<AvailableFundsResponseTotal>,
}
/// Contains an overview of Security specific fund values.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AvailableFundsResponseSecurities {
/// This value reflects your available funds at the next margin change.
#[serde(rename = "Lk Ahd Avlbl Fnds")]
pub lk_ahd_avlbl_fnds: Option<String>,
/// * `Securities` - Equity with loan value. Look ahead maintenance margin.
/// * `Commodities` - Net Liquidation value. Look ahead maintenance margin.
#[serde(rename = "Lk Ahd Excss Lqdty")]
pub lk_ahd_excss_lqdty: Option<String>,
/// Displays predicted post-expiration account value.
#[serde(rename = "Prdctd Pst-xpry Excss")]
pub prdctd_pst_xpry_excss: Option<String>,
#[serde(rename = "SMA")]
pub sma: Option<String>,
/// Describes currently avialable funds in your account for trading.
pub current_available: Option<String>,
/// Describes total value of the account.
pub current_excess: Option<String>,
/// Describes the total combined leverage.
pub leverage: Option<String>,
/// Describes available funds for overnight trading.
pub overnight_available: Option<String>,
/// Overnight refers to the window of time after the local market trading day is closed.
/// * `Securities` - Equivalent to regular trading hours.
/// * `Commodities` - Commodities Net Liquidation value. Overnight Maintenance margin.
pub overnight_excess: Option<String>,
}
/// total values
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AvailableFundsResponseTotal {
/// This value reflects your available funds at the next margin change.
#[serde(rename = "Lk Ahd Avlbl Fnds")]
pub lk_ahd_avlbl_fnds: Option<String>,
/// * `Securities` - Equity with loan value. Look ahead maintenance margin.
/// * `Commodities` - Net Liquidation value. Look ahead maintenance margin.
#[serde(rename = "Lk Ahd Excss Lqdty")]
pub lk_ahd_excss_lqdty: Option<String>,
/// Describes when the next 'Look Ahead' calculation will take place.
#[serde(rename = "Lk Ahd Nxt Chng")]
pub lk_ahd_nxt_chng: Option<String>,
/// Displays predicted post-expiration account value.
#[serde(rename = "Prdctd Pst-xpry Excss")]
pub prdctd_pst_xpry_excss: Option<String>,
/// Describes the total buying power of the account including existing balance with margin.
pub buying_power: Option<String>,
/// Describes currently avialable funds in your account for trading.
pub current_available: Option<String>,
/// Describes total value of the account.
pub current_excess: Option<String>,
/// Describes the number of trades remaining before flagging the Pattern Day Trader status. "Unlimited" is used for existing Pattern Day Traders.
pub day_trades_left: Option<String>,
/// Describes the total combined leverage.
pub leverage: Option<String>,
/// Describes available funds for overnight trading.
pub overnight_available: Option<String>,
/// Overnight refers to the window of time after the local market trading day is closed.
/// * `Securities` - Equivalent to regular trading hours.
/// * `Commodities` - Commodities Net Liquidation value. Overnight Maintenance margin.
pub overnight_excess: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AvailableStatementDatesData {
/// - Example: `Some("String".to_string())`
#[serde(rename = "dataType")]
pub data_type: Option<String>,
pub value: Option<AvailableStatementDatesDataValue>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AvailableStatementDatesDataValue {
/// annual available reports
pub annual: Option<Vec<String>>,
pub daily: Option<AvailableStatementDatesDataValueDaily>,
/// monthly available reports
pub monthly: Option<Vec<String>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AvailableStatementDatesDataValueDaily {
/// daily report end date
#[serde(rename = "endDate")]
pub end_date: Option<String>,
/// daily report start date
#[serde(rename = "startDate")]
pub start_date: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AvailableTaxFormsData {
/// - Example: `Some("String".to_string())`
#[serde(rename = "dataType")]
pub data_type: Option<String>,
pub value: Option<AvailableTaxFormsDataValue>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct AvailableTaxFormsDataValue {
/// available tax forms
pub forms: Option<Vec<TaxFormType>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct BNResponse {
/// Returns the number of unread notifications.
#[serde(rename = "BN")]
pub bn: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
pub enum BankInstructionMethod {
#[serde(rename = "ACH")]
#[default]
Ach,
#[serde(rename = "WIRE")]
Wire,
#[serde(rename = "USACH")]
Usach,
#[serde(rename = "CAACH")]
Caach,
#[serde(rename = "SEPA")]
Sepa,
#[serde(rename = "eDDA")]
EDDA,
#[serde(rename = "eGIRO")]
EGIRO,
#[serde(rename = "OPEN_BANKING")]
OpenBanking,
}
impl core::fmt::Display for BankInstructionMethod {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Ach => write!(f, "ACH"),
Self::Wire => write!(f, "WIRE"),
Self::Usach => write!(f, "USACH"),
Self::Caach => write!(f, "CAACH"),
Self::Sepa => write!(f, "SEPA"),
Self::EDDA => write!(f, "eDDA"),
Self::EGIRO => write!(f, "eGIRO"),
Self::OpenBanking => write!(f, "OPEN_BANKING"),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct BankInstructionsBulkRequestBody {
#[serde(rename = "instructionType")]
pub instruction_type: InstructionRequestBodyInstructionType,
pub instructions: Vec<serde_json::Value>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct BondFiltersResponse {
/// Contains all filters pertaining to the given issuerId
#[serde(rename = "bondFilters")]
pub bond_filters: Option<Vec<BondFiltersResponseFilter>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct BondFiltersResponseFilter {
/// Used for user interfaces. Internal use only.
#[serde(rename = "columnId")]
pub column_id: Option<i32>,
/// An identifier used to document returned options/values. This can be thought of as a key value.
#[serde(rename = "displayText")]
pub display_text: Option<BondFiltersResponseFilterDisplayText>,
/// Contains all objects with values corresponding to the parent displayText key.
pub options: Option<Vec<BondFiltersResponseFilterOption>>,
}
/// An identifier used to document returned options/values. This can be thought of as a key value.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
pub enum BondFiltersResponseFilterDisplayText {
#[serde(rename = "Maturity Date")]
#[default]
MaturityDate,
#[serde(rename = "Issue Date")]
IssueDate,
Coupon,
Currency,
}
impl core::fmt::Display for BondFiltersResponseFilterDisplayText {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::MaturityDate => write!(f, "Maturity Date"),
Self::IssueDate => write!(f, "Issue Date"),
Self::Coupon => write!(f, "Coupon"),
Self::Currency => write!(f, "Currency"),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct BondFiltersResponseFilterOption {
/// In some instances, a text value will be returned, which indicates the standardized value format such as plaintext dates, rather than solely numerical values.
pub text: Option<String>,
/// Returns value directly correlating to the displayText key. This may include exchange, maturity date, issue date, coupon, or currency.
pub value: String,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct BrokerageSessionInitRequest {
/// Determines if other brokerage sessions should be disconnected to prioritize this connection.
pub compete: Option<bool>,
/// publish brokerage session token at the same time when brokerage session initialized. If set false, then session token should be published before calling init. Setting true is preferred way.
pub publish: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct BrokerageSessionStatus {
/// Device MAC information.
#[serde(rename = "MAC")]
pub mac: Option<String>,
/// Returns whether your brokerage session is authenticated or not.
pub authenticated: Option<bool>,
/// Returns whether you have a competing brokerage session in another connection.
pub competing: Option<bool>,
/// Returns whether you are connected to the gateway or not.
pub connected: Option<bool>,
/// Returns whether your brokerage session is fully established and ready to handle requests. Set to true when the login message is received from underlying brokerage infrastructure, indicating authentication is complete and account information is loaded.
pub established: Option<bool>,
/// Returns the reason for failing to retrieve authentication status.
pub fail: Option<String>,
/// Client Portal use only.
pub hardware_info: Option<String>,
/// A message about your authenticate status if any.
pub message: Option<String>,
#[serde(rename = "serverInfo")]
pub server_info: Option<BrokerageSessionStatusServerInfo>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct BrokerageSessionStatusServerInfo {
/// IBKR server information. Internal use only.
#[serde(rename = "serverName")]
pub server_name: Option<String>,
/// IBKR version information. Internal use only.
#[serde(rename = "serverVersion")]
pub server_version: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct BulkMultiStatusResponse {
#[serde(rename = "instructionResults")]
pub instruction_results: Option<Vec<serde_json::Value>>,
/// - Example: `-1988905739.0`
#[serde(rename = "instructionSetId")]
pub instruction_set_id: f64,
/// - Example: `207i32`
pub status: i32,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct CSVResponse {
/// Result message: 'OK' or error description
/// - Example: `"OK".to_string()`
pub message: String,
/// Request ID echo
/// - Example: `127i32`
#[serde(rename = "requestId")]
pub request_id: i32,
/// Operation success status
pub success: bool,
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
#[serde(default)]
pub struct CancelBulkRequestBody {
#[serde(rename = "instructionType")]
#[default("CANCEL_INSTRUCTION".to_string())]
pub instruction_type: String,
pub instructions: Vec<serde_json::Value>,
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct CancelInstruction {
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `43085477.0`
#[serde(rename = "instructionId")]
pub instruction_id: f64,
/// - Example: `"Testing".to_string()`
#[validate(length(min = 1u64, max = 256u64))]
pub reason: String,
}
/// Cancel an existing, unfilled order.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct CancelOpenOrderRequest {
#[validate(nested)]
pub path: CancelOpenOrderRequestPath,
pub query: CancelOpenOrderRequestQuery,
}
impl CancelOpenOrderRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<CancelOpenOrderResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Order200Response2>::json_with_diagnostics(req)
.await?;
return Ok(CancelOpenOrderResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(CancelOpenOrderResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(CancelOpenOrderResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(CancelOpenOrderResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(CancelOpenOrderResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(CancelOpenOrderResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct CancelOpenOrderRequestPath {
/// The account to which the order will clear.
/// - Example: `"DU123456".to_string()`
#[validate(length(min = 1u64))]
pub account_id: String,
/// The IB-assigned order ID of the desired order ticket.
/// - Example: `"1799796559".to_string()`
#[validate(length(min = 1u64))]
pub order_id: String,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct CancelOpenOrderRequestQuery {
/// ExtOperator is used to identify external operator.
#[serde(rename = "extOperator")]
pub ext_operator: Option<String>,
/// For all orders for US Futures products, clients must submit this flag to indicate whether the order was originated manually (by a natural person) or automatically (by an automated trading system transmitting orders without human intervention). Submit a True value to indicate a manually originated order, and submit a False value to indicate an automated order. Orders for USFUT products that do not include this field will be rejected.
#[serde(rename = "manualIndicator")]
pub manual_indicator: Option<bool>,
/// Time of manual cancel.
/// - Example: `Some(1_799_796_559i32)`
#[serde(rename = "manualCancelTime")]
pub manual_cancel_time: Option<i32>,
}
/// Response types for cancelOpenOrder
#[derive(Debug, Clone)]
pub enum CancelOpenOrderResponse {
///200: Status of submission
Ok(Order200Response2),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
#[serde(default)]
pub struct CancelRequestBody {
#[validate(nested)]
pub instruction: CancelInstruction,
#[serde(rename = "instructionType")]
#[default("CANCEL_INSTRUCTION".to_string())]
pub instruction_type: String,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct CategoryTreeResponse {
/// A JSON object containing all category IDs and their relevant information.
pub categories: Option<CategoryTreeResponseCategories>,
}
/// A JSON object containing all category IDs and their relevant information.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct CategoryTreeResponseCategories {
/// Category identifier.
#[serde(rename = "categoryId")]
pub category_id: Option<CategoryTreeResponseCategoriesCategoryId>,
}
/// Category identifier.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct CategoryTreeResponseCategoriesCategoryId {
/// List of affiliated markets (if applicable).
pub markets: Option<Vec<serde_json::Value>>,
/// Category name.
pub name: Option<String>,
/// Identifier of parent category (if applicable).
pub parent_id: Option<String>,
}
/// Instruct IServer to close all of its open backend data streams for all instruments.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct CloseAllMdStreamsRequest {}
impl CloseAllMdStreamsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<CloseAllMdStreamsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<UnsubscribedResponse>::json_with_diagnostics(req)
.await?;
return Ok(CloseAllMdStreamsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(CloseAllMdStreamsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(CloseAllMdStreamsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(CloseAllMdStreamsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(CloseAllMdStreamsResponse::Unknown);
}
}
/// Response types for closeAllMdStreams
#[derive(Debug, Clone)]
pub enum CloseAllMdStreamsResponse {
///200: Indicates a successful request to unsubscribe all streams.
Ok(UnsubscribedResponse),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Instruct IServer to close its backend stream for the instrument when real-time snapshots are no longer needed.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct CloseMdStreamRequest {
pub body: ConidRequestBody,
}
impl CloseMdStreamRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<CloseMdStreamResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<SuccessResponse3>::json_with_diagnostics(req)
.await?;
return Ok(CloseMdStreamResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(CloseMdStreamResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(CloseMdStreamResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(CloseMdStreamResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(CloseMdStreamResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(CloseMdStreamResponse::Unknown);
}
}
/// Response types for closeMdStream
#[derive(Debug, Clone)]
pub enum CloseMdStreamResponse {
///200: Acknowledges a successful request
Ok(SuccessResponse3),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Array of objects each containing a single combo position.
pub type ComboPositionResponse = Vec<ComboPositionResponseComboPositionResponse>;
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ComboPositionResponseComboPositionResponse {
/// The ratio and conids included in the position.
pub description: Option<String>,
/// List of the legs that make up a position.
pub legs: Option<Vec<ComboPositionResponseComboPositionResponseLeg>>,
/// Internal identifier of a combination position.
pub name: Option<String>,
/// List of the positions that make up a combination.
pub positions: Option<Vec<IndividualComboPosition>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ComboPositionResponseComboPositionResponseLeg {
/// Contract identifier of the given leg.
pub conid: Option<String>,
/// Ratio of the leg compared to the quantity.
pub ratio: Option<i32>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct ComplexAssetTransferInstruction {
/// - Example: `"U46377".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64, max = 32u64))]
pub account_id: String,
/// - Example: `Some("7NXXXX0".to_string())`
#[serde(rename = "accountIdAtCurrentBroker")]
#[validate(length(min = 1u64, max = 64u64))]
pub account_id_at_current_broker: Option<String>,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
#[serde(rename = "contraBrokerInfo")]
#[validate(nested)]
pub contra_broker_info: ContraBrokerInfo,
/// - Example: `"IN"`
pub direction: InstructionDirection,
#[serde(rename = "nonDisclosedDetail")]
#[validate(nested)]
pub non_disclosed_detail: Option<NonDisclosedDetail>,
/// - Example: `1000.0`
pub quantity: f64,
#[serde(rename = "tradingInstrument")]
pub trading_instrument: TradingInstrument,
}
/// Confirm an order reply message and continue with submission of order ticket.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct ConfirmOrderReplyRequest {
#[validate(nested)]
pub path: ConfirmOrderReplyRequestPath,
pub body: ConfirmedRequestBody,
}
impl ConfirmOrderReplyRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<ConfirmOrderReplyResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Reply200Response>::json_with_diagnostics(req)
.await?;
return Ok(ConfirmOrderReplyResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(ConfirmOrderReplyResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(ConfirmOrderReplyResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(ConfirmOrderReplyResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(ConfirmOrderReplyResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct ConfirmOrderReplyRequestPath {
/// The UUID of the reply message to be confirmed, obtained from an order submission response. This is delivered from the POST /iserver/account/{accountId}/orders endpoint when triggering certain warning messages.
/// - Example: `"99097238-9824-4830-84ef-46979aa22593".to_string()`
#[validate(length(min = 1u64))]
pub reply_id: String,
}
/// Response types for confirmOrderReply
#[derive(Debug, Clone)]
pub enum ConfirmOrderReplyResponse {
///200: Status of reply
Ok(Reply200Response),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct ConfirmedRequestBody {
/// Value of true answers the question in the affirmative and proceeds with order submission.
pub confirmed: Option<bool>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct ConidRequestBody {
/// The IB contract ID of the instrument whose market data feed is to be unsubscribed.
/// - Example: `Some(265_598i32)`
pub conid: Option<i32>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct ContraBrokerInfo {
/// - Example: `Some("Equatex U.S. Inc. For the Benefit of the Plan Participants of UBS AG".to_string())`
#[serde(rename = "accountTitle")]
#[validate(length(min = 1u64, max = 128u64))]
pub account_title: Option<String>,
/// - Example: `"ORG".to_string()`
#[serde(rename = "accountType")]
#[validate(length(min = 1u64, max = 32u64))]
pub account_type: String,
/// - Example: `"as3456567678578N".to_string()`
#[serde(rename = "brokerAccountId")]
#[validate(length(min = 1u64, max = 64u64))]
pub broker_account_id: String,
/// - Example: `"JP MORGAN".to_string()`
#[serde(rename = "brokerName")]
#[validate(length(min = 1u64, max = 128u64))]
pub broker_name: String,
/// - Example: `"a@gmail.com".to_string()`
#[serde(rename = "contactEmail")]
#[validate(length(min = 1u64, max = 64u64))]
pub contact_email: String,
/// - Example: `Some("as".to_string())`
#[serde(rename = "contactName")]
#[validate(length(min = 1u64, max = 64u64))]
pub contact_name: Option<String>,
/// - Example: `"2039126155".to_string()`
#[serde(rename = "contactPhone")]
#[validate(length(min = 1u64, max = 16u64))]
pub contact_phone: String,
/// - Example: `"United States".to_string()`
#[validate(length(min = 1u64, max = 64u64))]
pub country: String,
/// - Example: `"1234".to_string()`
#[serde(rename = "depositoryId")]
#[validate(length(min = 1u64, max = 64u64))]
pub depository_id: String,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ContractInfo {
/// Allowed to sell shares you own.
pub allow_sell_long: Option<bool>,
/// Indicates the industry category of the instrument.
pub category: Option<String>,
/// Classification of Financial Instrument codes
pub cfi_code: Option<String>,
pub classifier: Option<String>,
/// Indicates the name of the company or index.
pub company_name: Option<String>,
/// Indicates the contract identifier of the given contract.
pub con_id: Option<i32>,
pub contract_clarification_type: Option<String>,
/// Indicates the year and month the contract expires.
pub contract_month: Option<String>,
/// Base currency contract is traded in.
pub currency: Option<String>,
/// Returns the CUSIP for the given instrument. Only used in BOND trading.
pub cusip: Option<String>,
/// Indicates the primary exchange for which the contract can be traded.
pub exchange: Option<String>,
/// Returns the expiration month of the contract.
pub expiry_full: Option<String>,
/// Specific group of companies or businesses.
pub industry: Option<String>,
/// Asset class of the instrument.
pub instrument_type: Option<String>,
/// Indicates if the contract supports zero commission trading.
pub is_zero_commission_security: Option<bool>,
/// Contract's symbol from primary exchange. For options it is the OCC symbol.
pub local_symbol: Option<String>,
/// Indicates the final maturity date of the given contract.
pub maturity_date: Option<String>,
/// Indicates the multiplier of the contract.
pub multiplier: Option<String>,
/// Indicates if the contract can be traded outside regular trading hours or not.
pub r_t_h: Option<bool>,
/// Indicates if the contract can be smart routed or not.
pub smart_available: Option<bool>,
/// Underlying symbol
pub symbol: Option<String>,
/// Indicates the display name of the contract, as shown with Client Portal.
pub text: Option<String>,
/// Designated trading class of the contract.
pub trading_class: Option<String>,
/// Underlying contract identifier for the requested contract.
pub underlying_con_id: Option<i32>,
/// Indicates the issuer of the underlying.
pub underlying_issuer: Option<String>,
/// Comma separated list of support exchanges or trading venues.
pub valid_exchanges: Option<String>,
}
/// detailed contract information
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ContractRules {
/// Indicates if the contract can trade algos or not.
#[serde(rename = "algoEligible")]
pub algo_eligible: Option<bool>,
/// indicates all or non option is eligible for given contract.
#[serde(rename = "allOrNoneEligible")]
pub all_or_none_eligible: Option<bool>,
/// Indicates permitted accountIDs that may trade the contract.
#[serde(rename = "canTradeAcctIds")]
pub can_trade_acct_ids: Option<Vec<String>>,
/// Indicates base currency for the instrument.
#[serde(rename = "cashCcy")]
pub cash_ccy: Option<String>,
/// Indicates cash quantity increment rules.
#[serde(rename = "cashQtyIncr")]
pub cash_qty_incr: Option<i32>,
/// Default cash value quantity.
#[serde(rename = "cashSize")]
pub cash_size: Option<f64>,
/// Indicates whether or not a cost report has been requested (Client Portal only).
#[serde(rename = "costReport")]
pub cost_report: Option<bool>,
/// Indicates accepted order types for use with cash quantity.
#[serde(rename = "cqtTypes")]
pub cqt_types: Option<Vec<ContractRulesCqtType>>,
/// Default total quantity value for orders.
#[serde(rename = "defaultSize")]
pub default_size: Option<i32>,
/// Standard display increment rule for the instrument.
#[serde(rename = "displaySize")]
pub display_size: Option<i32>,
/// If rules information can not be received for any reason, it will be expressed here.
pub error: Option<String>,
/// Indicates if the order preview is forced upon the user before submission.
#[serde(rename = "forceOrderPreview")]
pub force_order_preview: Option<bool>,
/// Indicates decimal places for fractional order size.
#[serde(rename = "fraqInt")]
pub fraq_int: Option<i32>,
/// Indicates permitted order types for use with fractional trading.
#[serde(rename = "fraqTypes")]
pub fraq_types: Option<Vec<ContractRulesCqtType>>,
#[serde(rename = "hasSecondary")]
pub has_secondary: Option<bool>,
/// Indicates permitted algo types for use with the given contract.
#[serde(rename = "ibAlgoTypes")]
pub ib_algo_types: Option<Vec<ContractRulesIbAlgoType>>,
/// Minimum increment values for prices
pub increment: Option<f64>,
/// Number of decimal places to indicate the increment value.
#[serde(rename = "incrementDigits")]
pub increment_digits: Option<i32>,
/// Indicates increment rule values including lowerEdge and increment value.
#[serde(rename = "incrementRules")]
pub increment_rules: Option<Vec<ContractRulesIncrementRule>>,
/// Indicates the type of increment style.
#[serde(rename = "incrementType")]
pub increment_type: Option<i32>,
/// Default limit price for the given contract.
#[serde(rename = "limitPrice")]
pub limit_price: Option<f64>,
/// Lists the available order types supported when modifying the order.
#[serde(rename = "modTypes")]
pub mod_types: Option<Vec<serde_json::Value>>,
/// Indicates if the value of the contract can be negative (true) or if it is always positive (false).
#[serde(rename = "negativeCapable")]
pub negative_capable: Option<bool>,
/// Indicates default order type for the given security type.
#[serde(rename = "orderDefaults")]
pub order_defaults: Option<ContractRulesOrderDefaults>,
/// Order origin designation for US securities options and Options Clearing Corporation
#[serde(rename = "orderOrigination")]
pub order_origination: Option<String>,
/// Indicates permitted order types for use with standard quantity trading.
#[serde(rename = "orderTypes")]
pub order_types: Option<Vec<ContractRulesOrderType>>,
/// Indicates permitted order types for use outside of regular trading hours.
#[serde(rename = "orderTypesOutside")]
pub order_types_outside: Option<Vec<ContractRulesOrderTypesOutside>>,
/// Indicates if the order preview is required (for client portal only)
pub preview: Option<bool>,
/// Signifies the magnifier of a given contract. This is separate from the price multiplier, and will typically return 'null'
#[serde(rename = "priceMagnifier")]
pub price_magnifier: Option<i32>,
/// Indicates quantity increase for the contract.
#[serde(rename = "sizeIncrement")]
pub size_increment: Option<i32>,
/// Default stop price for the given contract.
#[serde(rename = "stopPrice")]
pub stop_price: Option<f64>,
/// Object containing details about your TIF value defaults. These defaults can be viewed and modified in TWS's within the Global Configuration.
#[serde(rename = "tifDefaults")]
pub tif_defaults: Option<ContractRulesTifDefaults>,
/// Indicates allowed tif types supported for the contract.
#[serde(rename = "tifTypes")]
pub tif_types: Option<Vec<String>>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
pub enum ContractRulesCqtType {
#[serde(rename = "limit")]
#[default]
Limit,
#[serde(rename = "market")]
Market,
#[serde(rename = "stop")]
Stop,
#[serde(rename = "stop_limit")]
StopLimit,
#[serde(rename = "mit")]
Mit,
#[serde(rename = "lit")]
Lit,
#[serde(rename = "trailing_stop")]
TrailingStop,
#[serde(rename = "trailing_stop_limit")]
TrailingStopLimit,
}
impl core::fmt::Display for ContractRulesCqtType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Limit => write!(f, "limit"),
Self::Market => write!(f, "market"),
Self::Stop => write!(f, "stop"),
Self::StopLimit => write!(f, "stop_limit"),
Self::Mit => write!(f, "mit"),
Self::Lit => write!(f, "lit"),
Self::TrailingStop => write!(f, "trailing_stop"),
Self::TrailingStopLimit => write!(f, "trailing_stop_limit"),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
pub enum ContractRulesIbAlgoType {
#[serde(rename = "limit")]
#[default]
Limit,
#[serde(rename = "stop_limit")]
StopLimit,
#[serde(rename = "lit")]
Lit,
#[serde(rename = "trailing_stop_limit")]
TrailingStopLimit,
#[serde(rename = "relative")]
Relative,
#[serde(rename = "marketonclose")]
Marketonclose,
#[serde(rename = "limitonclose")]
Limitonclose,
}
impl core::fmt::Display for ContractRulesIbAlgoType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Limit => write!(f, "limit"),
Self::StopLimit => write!(f, "stop_limit"),
Self::Lit => write!(f, "lit"),
Self::TrailingStopLimit => write!(f, "trailing_stop_limit"),
Self::Relative => write!(f, "relative"),
Self::Marketonclose => write!(f, "marketonclose"),
Self::Limitonclose => write!(f, "limitonclose"),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ContractRulesIncrementRule {
/// The price of the instrument must be submitted as a mulitple of the increment value.
pub increment: Option<f64>,
/// If the current mark price of the instrument is at or above the lower edge, the given increment value is used for order prices.
#[serde(rename = "lowerEdge")]
pub lower_edge: Option<f64>,
}
/// Indicates default order type for the given security type.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ContractRulesOrderDefaults {
#[serde(rename = "LMT")]
pub lmt: Option<ContractRulesOrderDefaultsLmt>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ContractRulesOrderDefaultsLmt {
/// Indicates a Limit Price default value.
#[serde(rename = "LP")]
pub lp: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
pub enum ContractRulesOrderType {
#[serde(rename = "limit")]
#[default]
Limit,
#[serde(rename = "midprice")]
Midprice,
#[serde(rename = "market")]
Market,
#[serde(rename = "stop")]
Stop,
#[serde(rename = "stop_limit")]
StopLimit,
#[serde(rename = "mit")]
Mit,
#[serde(rename = "lit")]
Lit,
#[serde(rename = "trailing_stop")]
TrailingStop,
#[serde(rename = "trailing_stop_limit")]
TrailingStopLimit,
#[serde(rename = "relative")]
Relative,
#[serde(rename = "marketonclose")]
Marketonclose,
#[serde(rename = "limitonclose")]
Limitonclose,
}
impl core::fmt::Display for ContractRulesOrderType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Limit => write!(f, "limit"),
Self::Midprice => write!(f, "midprice"),
Self::Market => write!(f, "market"),
Self::Stop => write!(f, "stop"),
Self::StopLimit => write!(f, "stop_limit"),
Self::Mit => write!(f, "mit"),
Self::Lit => write!(f, "lit"),
Self::TrailingStop => write!(f, "trailing_stop"),
Self::TrailingStopLimit => write!(f, "trailing_stop_limit"),
Self::Relative => write!(f, "relative"),
Self::Marketonclose => write!(f, "marketonclose"),
Self::Limitonclose => write!(f, "limitonclose"),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
pub enum ContractRulesOrderTypesOutside {
#[serde(rename = "limit")]
#[default]
Limit,
#[serde(rename = "stop_limit")]
StopLimit,
#[serde(rename = "lit")]
Lit,
#[serde(rename = "trailing_stop_limit")]
TrailingStopLimit,
#[serde(rename = "relative")]
Relative,
}
impl core::fmt::Display for ContractRulesOrderTypesOutside {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Limit => write!(f, "limit"),
Self::StopLimit => write!(f, "stop_limit"),
Self::Lit => write!(f, "lit"),
Self::TrailingStopLimit => write!(f, "trailing_stop_limit"),
Self::Relative => write!(f, "relative"),
}
}
}
/// Object containing details about your TIF value defaults. These defaults can be viewed and modified in TWS's within the Global Configuration.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ContractRulesTifDefaults {
/// default account (multi account only)
#[serde(rename = "DEFAULT_ACCT")]
pub default_acct: Option<String>,
#[serde(rename = "PMALGO")]
pub pmalgo: Option<bool>,
/// The default size value for orders.
#[serde(rename = "SIZE")]
pub size: Option<String>,
/// The default TIF type for orders.
#[serde(rename = "TIF")]
pub tif: Option<String>,
}
/// Endpoint used to create a new alert, or modify an existing alert.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct CreateAlertRequest {
#[validate(nested)]
pub path: CreateAlertRequestPath,
#[validate(nested)]
pub body: AlertCreationRequest,
}
impl CreateAlertRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<CreateAlertResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<AlertCreationResponse>::json_with_diagnostics(req)
.await?;
return Ok(CreateAlertResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(CreateAlertResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(CreateAlertResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(CreateAlertResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(CreateAlertResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(CreateAlertResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct CreateAlertRequestPath {
/// - Example: `"U1234567".to_string()`
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for createAlert
#[derive(Debug, Clone)]
pub enum CreateAlertResponse {
///200: An object containing valid accounts and the account properties regarding trading access. This endpoint is also used to confirm account validation.
Ok(AlertCreationResponse),
///400: bad request; body is empty
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: Internal Server Error. Unable to process request if incoming values are not valid. For example operator is "abc" Or if modification request contains unmodified fields
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Add a new allocation group. This group can be used to trade in place of the {accountId} for the /iserver/account/{accountId}/orders endpoint.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct CreateAllocationGroupRequest {
#[validate(nested)]
pub body: GroupRequestBody2,
}
impl CreateAllocationGroupRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<CreateAllocationGroupResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<SuccessResponse>::json_with_diagnostics(req)
.await?;
return Ok(CreateAllocationGroupResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(CreateAllocationGroupResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(CreateAllocationGroupResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(CreateAllocationGroupResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(CreateAllocationGroupResponse::Unknown);
}
}
/// Response types for createAllocationGroup
#[derive(Debug, Clone)]
pub enum CreateAllocationGroupResponse {
///200: Returns a confirmation that the modification was successful.
Ok(SuccessResponse),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct CreateBrowserSessionResponse {
pub active: Option<bool>,
/// - Example: `Some("https://www.interactivebrokers.com/sso/...".to_string())`
pub url: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct CreateSessionResponse {
/// - Example: `"eyJ0eXAiOiJKV1...".to_string()`
pub access_token: String,
pub active: Option<bool>,
/// - Example: `Some("Bearer".to_string())`
pub token_type: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct CurrencyPairs {
/// Additional properties not defined in the schema.
#[serde(flatten)]
pub additional_properties: std::collections::HashMap<String, Vec<serde_json::Value>>,
}
/// Permanently delete an existing alert. Deleting an MTA alert will reset it to the default state.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct DeleteAlertRequest {
#[validate(nested)]
pub path: DeleteAlertRequestPath,
pub body: ArrayNode,
}
impl DeleteAlertRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<DeleteAlertResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<AlertDeletionResponse>::json_with_diagnostics(req)
.await?;
return Ok(DeleteAlertResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(DeleteAlertResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(DeleteAlertResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(DeleteAlertResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct DeleteAlertRequestPath {
/// - Example: `"U1234567".to_string()`
#[validate(length(min = 1u64))]
pub account_id: String,
/// order_id returned from the original alert creation, or from the list of available alerts.
/// - Example: `"9876543210".to_string()`
#[validate(length(min = 1u64))]
pub alert_id: String,
}
/// Response types for deleteAlert
#[derive(Debug, Clone)]
pub enum DeleteAlertResponse {
///200: An object containing details on the deleted endpoint.
Ok(AlertDeletionResponse),
///401: Invalid or expired access token
Unauthorized,
///500: Internal Server Error; Unable to delete alert in case when provided alert id doesn't exist
InternalServerError,
///default: Unknown response
Unknown,
}
/// Deletes a previously created allocation group. This endpoint is only supported for Financial Advisors and IBroker Accounts.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct DeleteAllocationGroupRequest {
#[validate(nested)]
pub body: NameRequestBody,
}
impl DeleteAllocationGroupRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<CreateAllocationGroupResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<SuccessResponse>::json_with_diagnostics(req)
.await?;
return Ok(CreateAllocationGroupResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(CreateAllocationGroupResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(CreateAllocationGroupResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(CreateAllocationGroupResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(CreateAllocationGroupResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct DeleteBankInstruction {
/// - Example: `"U399192".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64, max = 32u64))]
pub account_id: String,
/// - Example: `"WIRE"`
#[serde(rename = "bankInstructionMethod")]
pub bank_instruction_method: DeleteBankInstructionBankInstructionMethod,
/// - Example: `"Test-instruction".to_string()`
#[serde(rename = "bankInstructionName")]
#[validate(length(min = 1u64, max = 150u64))]
pub bank_instruction_name: String,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `"USD".to_string()`
#[validate(length(min = 1u64, max = 3u64))]
pub currency: String,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum DeleteBankInstructionBankInstructionMethod {
#[serde(rename = "WIRE")]
#[default]
Wire,
#[serde(rename = "ACH")]
Ach,
}
impl core::fmt::Display for DeleteBankInstructionBankInstructionMethod {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Wire => write!(f, "WIRE"),
Self::Ach => write!(f, "ACH"),
}
}
}
/// Delete a specific device from our saved list of notification devices.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct DeleteFyiDeviceRequest {
pub path: DeleteFyiDeviceRequestPath,
}
impl DeleteFyiDeviceRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<DeleteFyiDeviceResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let _ = req.bytes().await?;
return Ok(DeleteFyiDeviceResponse::Ok);
}
let _ = req.bytes().await?;
return Ok(DeleteFyiDeviceResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, oas3_gen_support::Default)]
pub struct DeleteFyiDeviceRequestPath {
/// Display the device identifier to delete from IB's saved list. Can be retrieved from /fyi/deliveryoptions.
pub device_id: serde_json::Value,
}
/// Response types for deleteFyiDevice
#[derive(Debug, Clone)]
pub enum DeleteFyiDeviceResponse {
///200: No response message is returned. Instead, you will only receive an empty string with a 200 OK status code indicating a successfully deleted account.
Ok,
///default: Unknown response
Unknown,
}
/// Delete a specified watchlist from the username's settings.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct DeleteWatchlistRequest {
#[validate(nested)]
pub query: DeleteWatchlistRequestQuery,
}
impl DeleteWatchlistRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<DeleteWatchlistResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<WatchlistDeleteSuccess>::json_with_diagnostics(req)
.await?;
return Ok(DeleteWatchlistResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(DeleteWatchlistResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(DeleteWatchlistResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(DeleteWatchlistResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(DeleteWatchlistResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(DeleteWatchlistResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct DeleteWatchlistRequestQuery {
/// Watchlist ID of the watchlist to be deleted.
/// - Example: `"1234".to_string()`
#[validate(length(min = 1u64))]
pub id: String,
}
/// Response types for deleteWatchlist
#[derive(Debug, Clone)]
pub enum DeleteWatchlistResponse {
///200: Successful deletion of specified watchlist.
Ok(WatchlistDeleteSuccess),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct DeliveryOptions {
/// Returns an array of device information.
#[serde(rename = "E")]
pub e: Option<Vec<DeliveryOptionsE>>,
/// Email option is enabled or not.
#[serde(rename = "M")]
pub m: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct DeliveryOptionsE {
/// Device is enabled or not.
#[serde(rename = "A")]
pub a: Option<String>,
/// Returns the deice identifier.
#[serde(rename = "I")]
pub i: Option<String>,
/// Returns the human readable device name.
#[serde(rename = "NM")]
pub nm: Option<String>,
/// Returns the unique device ID.
#[serde(rename = "UI")]
pub ui: Option<String>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct DepositFundsInstruction {
/// - Example: `"U46377".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64, max = 32u64))]
pub account_id: String,
/// - Example: `100.0`
pub amount: f64,
/// - Example: `"WIRE"`
#[serde(rename = "bankInstructionMethod")]
pub bank_instruction_method: DepositFundsInstructionBankInstructionMethod,
/// - Example: `Some("Instruction".to_string())`
#[serde(rename = "bankInstructionName")]
#[validate(length(min = 0u64, max = 150u64))]
pub bank_instruction_name: Option<String>,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `"USD".to_string()`
#[validate(length(min = 1u64, max = 3u64))]
pub currency: String,
/// - Example: `Some("identifier".to_string())`
#[validate(length(min = 0u64, max = 64u64))]
pub identifier: Option<String>,
#[serde(rename = "iraDepositDetail")]
pub ira_deposit_detail: Option<DepositFundsInstructionIraDepositDetail>,
#[serde(rename = "openBanking")]
#[validate(nested)]
pub open_banking: Option<DepositFundsInstructionOpenBanking>,
#[serde(rename = "recurringInstructionDetail")]
#[validate(nested)]
pub recurring_instruction_detail: Option<RecurringInstructionDetail>,
/// - Example: `Some("Senders Institution name".to_string())`
#[serde(rename = "senderInstitutionName")]
#[validate(length(min = 0u64, max = 128u64))]
pub sender_institution_name: Option<String>,
/// - Example: `Some("Sending Institution name".to_string())`
#[serde(rename = "sendingInstitution")]
#[validate(length(min = 0u64, max = 128u64))]
pub sending_institution: Option<String>,
/// - Example: `Some("U46377".to_string())`
#[serde(rename = "specialInstruction")]
#[validate(length(min = 0u64, max = 128u64))]
pub special_instruction: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum DepositFundsInstructionBankInstructionMethod {
#[serde(rename = "ACH")]
#[default]
Ach,
#[serde(rename = "WIRE")]
Wire,
#[serde(rename = "eDDA")]
EDDA,
#[serde(rename = "OPEN_BANKING")]
OpenBanking,
}
impl core::fmt::Display for DepositFundsInstructionBankInstructionMethod {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Ach => write!(f, "ACH"),
Self::Wire => write!(f, "WIRE"),
Self::EDDA => write!(f, "eDDA"),
Self::OpenBanking => write!(f, "OPEN_BANKING"),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct DepositFundsInstructionIraDepositDetail {
/// - Example: `"TRADITIONAL"`
#[serde(rename = "fromIraType")]
pub from_ira_type: DepositFundsInstructionIraDepositDetailFromIraType,
/// - Example: `"ROLLOVER"`
#[serde(rename = "iraContributionType")]
pub ira_contribution_type: DepositFundsInstructionIraDepositDetailIraContributionType,
/// - Example: `"CURRENT"`
#[serde(rename = "iraTaxYearType")]
pub ira_tax_year_type: DepositFundsInstructionIraDepositDetailIraTaxYearType,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum DepositFundsInstructionIraDepositDetailFromIraType {
#[serde(rename = "NONE")]
#[default]
None,
#[serde(rename = "TRADITIONAL")]
Traditional,
#[serde(rename = "ROLLOVER")]
Rollover,
#[serde(rename = "ROTH")]
Roth,
#[serde(rename = "SEP")]
Sep,
#[serde(rename = "EDUCATION")]
Education,
#[serde(rename = "TRADITIONAL_INHERITED")]
TraditionalInherited,
#[serde(rename = "ROTH_INHERITED")]
RothInherited,
#[serde(rename = "SEP_INHERITED")]
SepInherited,
#[serde(rename = "RETIREMENT_SAVING_PLAN")]
RetirementSavingPlan,
#[serde(rename = "SPOUSAL_RETIREMENT_SAVING_PLAN")]
SpousalRetirementSavingPlan,
#[serde(rename = "TAX_FREE_SAVING_ACCOUNT")]
TaxFreeSavingAccount,
}
impl core::fmt::Display for DepositFundsInstructionIraDepositDetailFromIraType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::None => write!(f, "NONE"),
Self::Traditional => write!(f, "TRADITIONAL"),
Self::Rollover => write!(f, "ROLLOVER"),
Self::Roth => write!(f, "ROTH"),
Self::Sep => write!(f, "SEP"),
Self::Education => write!(f, "EDUCATION"),
Self::TraditionalInherited => write!(f, "TRADITIONAL_INHERITED"),
Self::RothInherited => write!(f, "ROTH_INHERITED"),
Self::SepInherited => write!(f, "SEP_INHERITED"),
Self::RetirementSavingPlan => write!(f, "RETIREMENT_SAVING_PLAN"),
Self::SpousalRetirementSavingPlan => {
write!(f, "SPOUSAL_RETIREMENT_SAVING_PLAN")
}
Self::TaxFreeSavingAccount => write!(f, "TAX_FREE_SAVING_ACCOUNT"),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum DepositFundsInstructionIraDepositDetailIraContributionType {
#[serde(rename = "ROLLOVER")]
#[default]
Rollover,
#[serde(rename = "LATE_ROLLOVER")]
LateRollover,
#[serde(rename = "DIRECT_ROLLOVER")]
DirectRollover,
#[serde(rename = "CONTRIBUTION")]
Contribution,
#[serde(rename = "SPOUSAL_CONTRIBUTION")]
SpousalContribution,
#[serde(rename = "EMPLOYER_SEP_CONTRIBUTION")]
EmployerSepContribution,
}
impl core::fmt::Display for DepositFundsInstructionIraDepositDetailIraContributionType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Rollover => write!(f, "ROLLOVER"),
Self::LateRollover => write!(f, "LATE_ROLLOVER"),
Self::DirectRollover => write!(f, "DIRECT_ROLLOVER"),
Self::Contribution => write!(f, "CONTRIBUTION"),
Self::SpousalContribution => write!(f, "SPOUSAL_CONTRIBUTION"),
Self::EmployerSepContribution => write!(f, "EMPLOYER_SEP_CONTRIBUTION"),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum DepositFundsInstructionIraDepositDetailIraTaxYearType {
#[serde(rename = "CURRENT")]
#[default]
Current,
#[serde(rename = "PRIOR")]
Prior,
}
impl core::fmt::Display for DepositFundsInstructionIraDepositDetailIraTaxYearType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Current => write!(f, "CURRENT"),
Self::Prior => write!(f, "PRIOR"),
}
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
#[serde(default)]
pub struct DepositFundsInstructionOpenBanking {
#[serde(rename = "plaidOptions")]
#[validate(nested)]
pub plaid_options: Option<DepositFundsInstructionOpenBankingPlaidOptions>,
/// - Example: `"PLAID".to_string()`
#[serde(rename = "serviceProvider")]
#[default("PLAID".to_string())]
pub service_provider: String,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct DepositFundsInstructionOpenBankingPlaidOptions {
/// This should be a URI with a custom scheme and this can be any value you'd like, as long as it isn't a reserved one such as http or tel. By convention, it's often one associated with the name of your application.
/// - Example: `Some("wonderwallet://hosted-link-complete".to_string())`
#[serde(rename = "completionRedirectUri")]
#[validate(length(min = 0u64))]
pub completion_redirect_uri: Option<String>,
#[serde(rename = "isMobileApp")]
pub is_mobile_app: Option<bool>,
/// Client Name displayed on Plaid Link UI
/// - Example: `Some("WonderWallet".to_string())`
#[serde(rename = "linkDisplayName")]
pub link_display_name: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct DepositFundsPollingResponse {
#[serde(rename = "instructionResult")]
pub instruction_result: Option<DepositFundsPollingResult>,
/// - Example: `-1988905739.0`
#[serde(rename = "instructionSetId")]
pub instruction_set_id: f64,
/// - Example: `202.0`
pub status: f64,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct DepositFundsPollingResult {
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
#[serde(rename = "depositDetails")]
pub deposit_details: Option<DepositFundsPollingResultDepositDetails>,
/// - Example: `Some("Please poll for status after 10 minutes".to_string())`
pub description: Option<String>,
pub error: Option<ResultError>,
/// - Example: `Some(23456745.0)`
#[serde(rename = "ibReferenceId")]
pub ib_reference_id: Option<f64>,
/// - Example: `45123654.0`
#[serde(rename = "instructionId")]
pub instruction_id: f64,
/// - Example: `"PENDING"`
#[serde(rename = "instructionStatus")]
pub instruction_status: PollingInstructionResultInstructionStatus,
/// - Example: `"INTERNAL_CASH_TRANSFER"`
#[serde(rename = "instructionType")]
pub instruction_type: InstructionResultInstructionType,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct DepositFundsPollingResultDepositDetails {
pub amount: Option<f64>,
pub currency: Option<String>,
#[serde(rename = "openBanking")]
pub open_banking: Option<DepositFundsPollingResultDepositDetailsOpenBanking>,
#[serde(rename = "whenAvailable")]
pub when_available: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct DepositFundsPollingResultDepositDetailsOpenBanking {
#[serde(rename = "providerResponse")]
pub provider_response: Option<serde_json::Value>,
#[serde(rename = "serviceProvider")]
pub service_provider: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct Detail200Response {
/// Collection of accounts held in the model.
#[serde(rename = "accountInfoList")]
pub account_info_list: Option<Vec<Detail200ResponseAccountInfoList>>,
/// Base currency of the model.
#[serde(rename = "baseCcyMaster")]
pub base_ccy_master: Option<String>,
/// Model retrieving accounts from.
pub model: Option<String>,
/// Unique identifier for the request.
#[serde(rename = "reqID")]
pub req_id: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct Detail200ResponseAccountInfoList {
/// Account identifier.
pub account: Option<String>,
/// Account's imbalance from the target allocation.
#[serde(rename = "accountImbalance")]
pub account_imbalance: Option<String>,
/// Account alias.
pub alias: Option<String>,
/// Base currency of the account.
#[serde(rename = "baseCcyAccount")]
pub base_ccy_account: Option<String>,
/// Cost basis.
#[serde(rename = "costBasis")]
pub cost_basis: Option<String>,
/// Exchange rate of the account base currency to the model base currency.
#[serde(rename = "exchangeRate")]
pub exchange_rate: Option<f64>,
/// The net liquidation value of the instrument.
pub nlv: Option<String>,
/// The number of instruments held by the account outside of the alloted range from the presets.
#[serde(rename = "numInstrumentsOutsideRange")]
pub num_instruments_outside_range: Option<i32>,
/// The unrealized profit and loss of the model within the account.
#[serde(rename = "unrealizedPnL")]
pub unrealized_pn_l: Option<String>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct DetailRequestBody {
/// Determine if Profit and Loss values
#[serde(rename = "calcPnls")]
pub calc_pnls: Option<bool>,
/// Request model to pull account details from.
pub model: Option<String>,
/// Request identifier to uniquely track a request.
/// - Example: `Some(540_608i32)`
#[serde(rename = "reqID")]
pub req_id: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct DetailedContractInformation {
/// Confirms if the currency type. If trading exclusively in your base currency, "base" will be returned.
#[serde(rename = "currencyType")]
pub currency_type: Option<String>,
/// Returns the request identifier, getPerformanceAllPeriods.
pub id: Option<String>,
/// Returns an array containing accounts reviewed.
pub included: Option<Vec<String>>,
/// Returns the total data points.
pub nd: Option<i32>,
/// Portfolio Measure. Used to indicate TWR or MWR values returned.
pub pm: Option<String>,
/// Returns the data identifier (Internal Use Only).
pub rc: Option<i32>,
/// Returns the accountIds being viewed and returned.
pub view: Option<Vec<String>>,
/// Additional properties not defined in the schema.
#[serde(flatten)]
pub additional_properties: std::collections::HashMap<String, serde_json::Value>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct DisclaimerInfo {
/// Returns the Disclaimer message.
#[serde(rename = "DT")]
pub dt: Option<String>,
/// Returns the Typecode for the given disclaimer.
#[serde(rename = "FC")]
pub fc: Option<String>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
#[serde(default)]
pub struct DwacInstruction {
/// - Example: `"U46377".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64, max = 32u64))]
pub account_id: String,
/// - Example: `Some("Title".to_string())`
#[serde(rename = "accountTitle")]
#[validate(length(min = 0u64, max = 140u64))]
pub account_title: Option<String>,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `"12345678A".to_string()`
#[serde(rename = "contraBrokerAccountId")]
#[validate(length(min = 1u64, max = 20u64))]
pub contra_broker_account_id: String,
/// - Example: `"123456789".to_string()`
#[serde(rename = "contraBrokerTaxId")]
#[validate(length(min = 1u64, max = 25u64))]
pub contra_broker_tax_id: String,
/// - Example: `"IN".to_string()`
#[default("IN".to_string())]
pub direction: String,
/// - Example: `1000.0`
pub quantity: f64,
/// - Example: `Some("refId".to_string())`
#[serde(rename = "referenceId")]
#[validate(length(min = 0u64, max = 20u64))]
pub reference_id: Option<String>,
#[serde(rename = "tradingInstrument")]
pub trading_instrument: TradingInstrument,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct DynAccountSearchResponse {
/// Contains a series of objects that pertain to the account information requested.
#[serde(rename = "matchedAccounts")]
pub matched_accounts: Option<Vec<DynAccountSearchResponseMatchedAccount>>,
/// Displays the searchPattern used for the request.
pub pattern: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct DynAccountSearchResponseMatchedAccount {
/// Returns a matching account ID that corresponds to the matching value.
#[serde(rename = "accountId")]
pub account_id: Option<String>,
/// Returns the corresponding alias or alternative name for the specific account ID. May be a duplicate of the accountId value in most cases.
pub alias: Option<String>,
/// Returns the allocation identifier used internally for the account.
#[serde(rename = "allocationId")]
pub allocation_id: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct EchoResponse {
/// - Example: `Some({})`
#[serde(rename = "queryParameters")]
pub query_parameters: Option<serde_json::Value>,
/// - Example: `"GET"`
#[serde(rename = "requestMethod")]
pub request_method: EchoResponseRequestMethod,
/// - Example: `"HTTPS"`
#[serde(rename = "securityPolicy")]
pub security_policy: EchoResponseSecurityPolicy,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
pub enum EchoResponseRequestMethod {
#[serde(rename = "GET")]
#[default]
Get,
#[serde(rename = "POST")]
Post,
#[serde(rename = "PATCH")]
Patch,
#[serde(rename = "PUT")]
Put,
}
impl core::fmt::Display for EchoResponseRequestMethod {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Get => write!(f, "GET"),
Self::Post => write!(f, "POST"),
Self::Patch => write!(f, "PATCH"),
Self::Put => write!(f, "PUT"),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
pub enum EchoResponseSecurityPolicy {
#[serde(rename = "HTTPS")]
#[default]
Https,
#[serde(rename = "SIGNED_JWT")]
SignedJwt,
#[serde(rename = "ENCRYPTED_JWE")]
EncryptedJwe,
}
impl core::fmt::Display for EchoResponseSecurityPolicy {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Https => write!(f, "HTTPS"),
Self::SignedJwt => write!(f, "SIGNED_JWT"),
Self::EncryptedJwe => write!(f, "ENCRYPTED_JWE"),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct EddaInstruction {
/// - Example: `"U2323232".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64, max = 32u64))]
pub account_id: String,
/// - Example: `"132456".to_string()`
#[serde(rename = "bankAccountNumber")]
#[validate(length(min = 1u64, max = 32u64))]
pub bank_account_number: String,
/// - Example: `"003".to_string()`
#[serde(rename = "bankBranchCode")]
#[validate(length(min = 1u64, max = 3u64))]
pub bank_branch_code: String,
/// - Example: `"003".to_string()`
#[serde(rename = "bankClearingCode")]
#[validate(length(min = 1u64, max = 3u64))]
pub bank_clearing_code: String,
/// - Example: `"Instruction Name".to_string()`
#[serde(rename = "bankInstructionName")]
#[validate(length(min = 1u64, max = 100u64))]
pub bank_instruction_name: String,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `"CNH".to_string()`
#[validate(length(min = 1u64, max = 3u64))]
pub currency: String,
/// - Example: `"hkId"`
#[serde(rename = "debtorIdentificationDocumentType")]
pub debtor_identification_document_type: EddaInstructionDebtorIdentificationDocumentType,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum EddaInstructionDebtorIdentificationDocumentType {
#[serde(rename = "hkId")]
#[default]
HkId,
#[serde(rename = "passport")]
Passport,
#[serde(rename = "chinaId")]
ChinaId,
#[serde(rename = "hkMacaoEntryPermit")]
HkMacaoEntryPermit,
}
impl core::fmt::Display for EddaInstructionDebtorIdentificationDocumentType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::HkId => write!(f, "hkId"),
Self::Passport => write!(f, "passport"),
Self::ChinaId => write!(f, "chinaId"),
Self::HkMacaoEntryPermit => write!(f, "hkMacaoEntryPermit"),
}
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct EnabledRequestBody {
/// the notification should be enabled or disabled.
pub enabled: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct EntityIRABene {
#[serde(rename = "articleOfWill")]
pub article_of_will: Option<String>,
#[serde(rename = "entityType")]
pub entity_type: Option<String>,
pub location: Option<std::collections::HashMap<String, String>>,
pub name: Option<String>,
#[serde(rename = "type")]
pub r#type: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct EnumerationResponse {
#[serde(rename = "enumerationsType")]
pub enumerations_type: Option<String>,
#[serde(rename = "formNumber")]
pub form_number: Option<String>,
#[serde(rename = "jsonData")]
pub json_data: Option<serde_json::Value>,
}
/// <ul><li>exchange-bundles - query most up to date list of exchange-bundles for tradingPermissions</li><li>business-and-occupation - list of occupation and employerBusiness for employmentDetails</li><li>employee-track - query most up to date companyId for account. For affiliation details, if company has an existing IBKR Employee Track account</li><li>fin-info-ranges - query most up to date range IDs by currency for annualNetIncome, netWorth, liquidNetWorth</li><li>acats - query most up to date values for brokerId and brokerName. Used if funding via US ACATS extPositionsTransfers</li><li>aton - query most up to date values for brokerId and brokerName. Used if funding via US ACATS extPositionsTransfers</li><li>market-data - query most up to date values for brokerId and brokerName. Used if funding via ATON Canada extPositionsTransfers</li><li>edd-avt - query questions associated with EDD (Enhanced Due Diligence) or AVT (Additional Verification) tasks assigned to an account</li><li>prohibited-country - view list of prohibited countries. Applicants that reside in prohibited country are restricted from opening an account with IBKR. Error will be thrown IF legalResidenceCountry, OR country (included within Residence, mailingAddress and employerAddress, taxResidency node) is a prohibited country</li><li>employee-plans - view EPA that are linked to master account (applicable IF offering SEP IRA accounts)</li><li>questionnaires - obtain list of questionnaires</li><li>security-questions - obtain list of questions supported for IBKR security questions</li><li>quiz-questions - obtain list of questions associated with IBKR knowledge assessment</li><li>wire-instructions - obtain list of wire instructions</li><li>product-country-bundles - obtain list of product country bundles</li></ul>
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum EnumerationType {
#[serde(rename = "exchange-bundles")]
#[default]
ExchangeBundles,
#[serde(rename = "business-and-occupation")]
BusinessAndOccupation,
#[serde(rename = "employee-track")]
EmployeeTrack,
#[serde(rename = "fin-info-ranges")]
FinInfoRanges,
#[serde(rename = "acats")]
Acats,
#[serde(rename = "aton")]
Aton,
#[serde(rename = "market-data")]
MarketData,
#[serde(rename = "edd-avt")]
EddAvt,
#[serde(rename = "prohibited-country")]
ProhibitedCountry,
#[serde(rename = "employee-plans")]
EmployeePlans,
#[serde(rename = "questionnaires")]
Questionnaires,
#[serde(rename = "security-questions")]
SecurityQuestions,
#[serde(rename = "quiz-questions")]
QuizQuestions,
#[serde(rename = "wire-instructions")]
WireInstructions,
#[serde(rename = "product-country-bundles")]
ProductCountryBundles,
}
impl core::fmt::Display for EnumerationType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::ExchangeBundles => write!(f, "exchange-bundles"),
Self::BusinessAndOccupation => write!(f, "business-and-occupation"),
Self::EmployeeTrack => write!(f, "employee-track"),
Self::FinInfoRanges => write!(f, "fin-info-ranges"),
Self::Acats => write!(f, "acats"),
Self::Aton => write!(f, "aton"),
Self::MarketData => write!(f, "market-data"),
Self::EddAvt => write!(f, "edd-avt"),
Self::ProhibitedCountry => write!(f, "prohibited-country"),
Self::EmployeePlans => write!(f, "employee-plans"),
Self::Questionnaires => write!(f, "questionnaires"),
Self::SecurityQuestions => write!(f, "security-questions"),
Self::QuizQuestions => write!(f, "quiz-questions"),
Self::WireInstructions => write!(f, "wire-instructions"),
Self::ProductCountryBundles => write!(f, "product-country-bundles"),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ErrorResponse {
pub error: Option<Box<ErrorResponse>>,
#[serde(rename = "errorDescription")]
pub error_description: Option<String>,
#[serde(rename = "hasError")]
pub has_error: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct ExternalAssetTransfersBulkRequestBody {
#[serde(rename = "instructionType")]
pub instruction_type: TransferRequestBody2InstructionType,
pub instructions: Vec<serde_json::Value>,
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct ExternalCashTransfersBulkRequestBody {
#[serde(rename = "instructionType")]
pub instruction_type: TransferRequestBody3InstructionType,
pub instructions: Vec<serde_json::Value>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
#[serde(default)]
pub struct ExternalPositionTransfer {
/// - Example: `"SOL12345".to_string()`
#[serde(rename = "accountAtBroker")]
#[validate(length(min = 1u64, max = 34u64))]
pub account_at_broker: String,
/// - Example: `"U2323232".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64, max = 32u64))]
pub account_id: String,
/// - Example: `"0226".to_string()`
#[serde(rename = "brokerId")]
#[validate(length(min = 1u64, max = 20u64))]
pub broker_id: String,
/// - Example: `"Wall Street Financial Group".to_string()`
#[serde(rename = "brokerName")]
#[validate(length(min = 1u64, max = 256u64))]
pub broker_name: String,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `"sample signature".to_string()`
#[validate(length(min = 1u64, max = 140u64))]
pub signature: String,
/// - Example: `Some("RO")`
#[serde(rename = "sourceIRAType")]
pub source_iratype: Option<ExternalPositionTransferSourceIratype>,
/// - Example: `"ACATS"`
#[serde(rename = "subType")]
pub sub_type: SubType,
/// - Example: `"FULL".to_string()`
#[serde(rename = "type")]
#[default("FULL".to_string())]
pub r#type: String,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum ExternalPositionTransferSourceIratype {
#[serde(rename = "RO")]
#[default]
Ro,
#[serde(rename = "RI")]
Ri,
#[serde(rename = "RT")]
Rt,
#[serde(rename = "SP")]
Sp,
#[serde(rename = "ED")]
Ed,
#[serde(rename = "TH")]
Th,
#[serde(rename = "RH")]
Rh,
#[serde(rename = "SH")]
Sh,
}
impl core::fmt::Display for ExternalPositionTransferSourceIratype {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Ro => write!(f, "RO"),
Self::Ri => write!(f, "RI"),
Self::Rt => write!(f, "RT"),
Self::Sp => write!(f, "SP"),
Self::Ed => write!(f, "ED"),
Self::Th => write!(f, "TH"),
Self::Rh => write!(f, "RH"),
Self::Sh => write!(f, "SH"),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct FailedTickleResponse {
/// reason why tickle was accepted by not processed
pub error: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct Features {
/// Displayed as the string of your symbol Contains a series of objects for each symbol that matches the requested.
pub symbol: Option<Vec<FeaturesSymbol>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct FeaturesSymbol {
/// Contract identifier for the specific symbol
pub conid: Option<i32>,
/// Expiration date of the specific future contract.
#[serde(rename = "expirationDate")]
pub expiration_date: Option<i32>,
/// Represents the final day for contract rollover for long futures.
#[serde(rename = "longFuturesCutOff")]
pub long_futures_cut_off: Option<i32>,
/// Last trade date of the future contract.
pub ltd: Option<i32>,
/// Represents the final day for contract rollover for shorted futures.
#[serde(rename = "shortFuturesCutOff")]
pub short_futures_cut_off: Option<i32>,
/// The requested symbol value.
pub symbol: Option<String>,
/// Contract identifier for the future's underlying contract.
#[serde(rename = "underlyingConid")]
pub underlying_conid: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct FileData {
pub data: Option<serde_json::Value>,
pub name: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct FileDetailsResponse {
#[serde(rename = "accountId")]
pub account_id: Option<String>,
#[serde(rename = "requestFileName")]
pub request_file_name: Option<String>,
#[serde(rename = "responseFileName")]
pub response_file_name: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct FopInstruction {
/// - Example: `"U46377".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64, max = 32u64))]
pub account_id: String,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `"12345678A".to_string()`
#[serde(rename = "contraBrokerAccountId")]
#[validate(length(min = 1u64, max = 20u64))]
pub contra_broker_account_id: String,
/// - Example: `"534".to_string()`
#[serde(rename = "contraBrokerDtcCode")]
#[validate(length(min = 1u64, max = 20u64))]
pub contra_broker_dtc_code: String,
/// - Example: `"IN"`
pub direction: InstructionDirection,
/// - Example: `1000.0`
pub quantity: f64,
#[serde(rename = "tradingInstrument")]
pub trading_instrument: TradingInstrument,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ForecastDetailsResponse {
/// The affiliated market category declared in /forecast/category/tree.
pub category: Option<String>,
/// Contract identifier of "no" contract
pub conid_no: Option<i32>,
/// Contract identifier of "yes" contract
pub conid_yes: Option<i32>,
/// Contract exchange.
pub exchange: Option<String>,
/// Contract expiration date in YYYYMMDD format.
pub expiration: Option<String>,
/// Logo category to use in logo service to get image.
pub logo_category: Option<String>,
/// name of contract's market.
pub market_name: Option<String>,
/// measured period
pub measured_period: Option<String>,
/// Ratio of payout scaling.
pub payout: Option<f64>,
/// Contract question (i.e. "Will this happen on this date?")
pub question: Option<String>,
/// "Y" or "N", yes or no contract.
pub side: Option<String>,
/// Contract strike.
pub strike: Option<f64>,
/// Strike label to display.
pub strike_label: Option<String>,
/// Contract symbol.
pub symbol: Option<String>,
/// Immediate underlier to contract (i.e. future conid for FOPs)
pub underlying_conid: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ForecastMarketResponse {
/// List of contracts matching the requested market.
pub contracts: Option<Vec<ForecastMarketResponseContract>>,
/// Exchange that was passed in request or determined internally.
pub exchange: Option<String>,
/// Indicates whether UI should or should not display underlying chart.
pub exclude_historical_data: Option<bool>,
/// Logo category to use in logo service to retrieve image.
pub logo_category: Option<String>,
/// Market contract identifier.
pub market_name: Option<String>,
/// Ratio of payout scaling.
pub payout: Option<f64>,
/// Market symbol.
pub symbol: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ForecastMarketResponseContract {
/// Market contract identifier.
pub conid: Option<i32>,
/// Contract expiration date in YYYYMMDD format.
pub expiration: Option<String>,
/// Label UI to show for the expiration tabs.
pub expiry_label: Option<String>,
/// "Y" or "N" denoting a Yes or No contract.
pub side: Option<String>,
/// Contract strike price.
pub strike: Option<f64>,
/// Strike label to display.
pub strike_label: Option<String>,
/// Specified date of expiration.
pub time_specifier: Option<String>,
/// Immediate underlier to contract (i.e. future conid for FOPs).
pub underlying_conid: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ForecastRulesResponse {
/// Product asset class.
pub asset_class: Option<String>,
/// Link to data from source agency.
pub data_and_resolution_link: Option<String>,
/// Long product description.
pub description: Option<String>,
/// Exchange timezone.
pub exchange_timezone: Option<String>,
/// last trade time in epoch seconds.
pub last_trade_time: Option<i32>,
/// Name of the contract's market.
pub market_name: Option<String>,
/// Link to market rules document.
pub market_rules_link: Option<String>,
/// Measured period of the contract.
pub measured_period: Option<String>,
/// Formatted payout amount.
pub payout: Option<String>,
/// Payout time in epoch seconds.
pub payout_time: Option<i32>,
/// Formatted price increment amount.
pub price_increment: Option<String>,
/// Product code (symbol).
pub product_code: Option<String>,
/// Release time in epoch seconds.
pub release_time: Option<i32>,
/// Name of the contract's source agency.
pub source_agency: Option<String>,
/// Either strike or strike label depending on contract type.
pub threshold: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ForecastSchedulesResponse {
/// Exchange timezone of event contract.
pub timezone: Option<String>,
/// List containing trading objects for each date.
pub trading_schedules: Option<Vec<ForecastSchedulesResponseTradingSchedule>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ForecastSchedulesResponseTradingSchedule {
/// Provides the day of the week corresponding to the trading schedule.
pub day_of_week: Option<String>,
/// List containing the opening times for the event contract. Multiple trading blocks may be returned if the contract has an intraday trading closure.
pub trading_times: Option<Vec<ForecastSchedulesResponseTradingScheduleTradingTime>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ForecastSchedulesResponseTradingScheduleTradingTime {
/// The closing time for the given trading session.
pub close: Option<String>,
/// The opening time for the given trading session.
pub open: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct FormDetails {
#[serde(rename = "acceptableDocs")]
pub acceptable_docs: Option<Vec<String>>,
pub action: Option<String>,
#[serde(rename = "apiSupportedTask")]
pub api_supported_task: Option<bool>,
#[serde(rename = "dateModified")]
pub date_modified: Option<chrono::DateTime<chrono::Utc>>,
pub error: Option<Box<ErrorResponse>>,
#[serde(rename = "errorDescription")]
pub error_description: Option<String>,
#[serde(rename = "fileLength")]
pub file_length: Option<i64>,
#[serde(rename = "fileName")]
pub file_name: Option<String>,
#[serde(rename = "formName")]
pub form_name: Option<String>,
#[serde(rename = "formNumber")]
pub form_number: Option<i32>,
#[serde(rename = "hasError")]
pub has_error: Option<bool>,
pub language: Option<String>,
pub payload: Option<FormPayload>,
pub questionnaire: Option<Vec<QuestionnaireResponse>>,
#[serde(rename = "sha1Checksum")]
pub sha1checksum: Option<String>,
#[serde(rename = "type")]
pub r#type: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct FormFileResponse {
pub error: Option<Box<ErrorResponse>>,
#[serde(rename = "errorDescription")]
pub error_description: Option<String>,
#[serde(rename = "fileData")]
pub file_data: Option<FileData>,
#[serde(rename = "formDetails")]
pub form_details: Option<Vec<FormDetails>>,
#[serde(rename = "hasError")]
pub has_error: Option<bool>,
pub timestamp: Option<chrono::DateTime<chrono::Utc>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct FormPayload {
pub data: Option<String>,
#[serde(rename = "mimeType")]
pub mime_type: Option<String>,
}
/// Contains commodities specific fund values.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct Funds {
/// This value reflects your available funds at the next margin change.
#[serde(rename = "Lk Ahd Avlbl Fnds")]
pub lk_ahd_avlbl_fnds: Option<String>,
/// Displays predicted post-expiration account value.
#[serde(rename = "Prdctd Pst-xpry Excss")]
pub prdctd_pst_xpry_excss: Option<String>,
/// Describes currently avialable funds in your account for trading.
pub current_available: Option<String>,
/// Describes total value of the account.
pub current_excess: Option<String>,
/// Describes available funds for overnight trading.
pub overnight_available: Option<String>,
/// Overnight refers to the window of time after the local market trading day is closed.
/// * `Securities` - Equivalent to regular trading hours.
/// * `Commodities` - Commodities Net Liquidation value. Overnight Maintenance margin.
pub overnight_excess: Option<String>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct FyiEnableDeviceOption {
#[serde(rename = "deviceId")]
pub device_id: Option<String>,
#[serde(rename = "deviceName")]
pub device_name: Option<String>,
/// enable or disable device
pub enabled: Option<bool>,
#[serde(rename = "uiName")]
pub ui_name: Option<String>,
}
pub type FyiSettings = Vec<FyiSettingsFyiSetting>;
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct FyiSettingsFyiSetting {
/// Returns ony if the subscription can be disabled/enabled manually. See /fyi/settings/{typecode} for how to enable/disable.
#[serde(rename = "A")]
pub a: Option<i32>,
/// Fyi code for enabling or disabling the notification.
#[serde(rename = "FC")]
pub fc: Option<String>,
/// Returns a detailed description of the topic.
#[serde(rename = "FD")]
pub fd: Option<String>,
/// Returns a human readable title for the notification.
#[serde(rename = "FN")]
pub r#fn: Option<String>,
/// Disclaimer if the notification was read.
#[serde(rename = "H")]
pub h: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct FyiVT {
/// Returns the time in ms to complete the edit.
#[serde(rename = "T")]
pub t: Option<i32>,
/// Returns 1 to state message was acknowledged.
#[serde(rename = "V")]
pub v: Option<i32>,
}
/// Generate OAuth 2.0 access tokens based on request parameters.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GenerateTokenRequest {
pub body: TokenRequest,
}
impl GenerateTokenRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GenerateTokenResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<TokenResponse>::json_with_diagnostics(req).await?;
return Ok(GenerateTokenResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GenerateTokenResponse::BadRequest);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GenerateTokenResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GenerateTokenResponse::Unknown);
}
}
/// Response types for generateToken
#[derive(Debug, Clone)]
pub enum GenerateTokenResponse {
///200: Returns a token response.
Ok(TokenResponse),
///400: Returns a [Problem detail](https://datatracker.ietf.org/doc/html/rfc9457) instance representing a bad request.
BadRequest,
///500: Returns a [Problem detail](https://datatracker.ietf.org/doc/html/rfc9457) instance representing an internal server error.
InternalServerError,
///default: Unknown response
Unknown,
}
/// Returns a summary of an account's market value, by currency and asset class.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetAccountMarketSummaryRequest {
#[validate(nested)]
pub path: GetAccountMarketSummaryRequestPath,
}
impl GetAccountMarketSummaryRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetAccountMarketSummaryResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<SummaryMarketValueResponse>::json_with_diagnostics(
req,
)
.await?;
return Ok(GetAccountMarketSummaryResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetAccountMarketSummaryResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetAccountMarketSummaryResponse::Unauthorized);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetAccountMarketSummaryResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetAccountMarketSummaryResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetAccountMarketSummaryRequestPath {
/// Pass the account identifier to receive information for.
/// - Example: `"U1234567".to_string()`
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for getAccountMarketSummary
#[derive(Debug, Clone)]
pub enum GetAccountMarketSummaryResponse {
///200: Indicates a successful market value request.
Ok(SummaryMarketValueResponse),
///400: bad request; passed input cannot pass initial validation and detected right away
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Receive a list of all applicant names on the account and for which account and entity is represented.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetAccountOwnersRequest {
#[validate(nested)]
pub path: GetAccountOwnersRequestPath,
}
impl GetAccountOwnersRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetAccountOwnersResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<SignatureAndOwners>::json_with_diagnostics(req)
.await?;
return Ok(GetAccountOwnersResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetAccountOwnersResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetAccountOwnersResponse::Unauthorized);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetAccountOwnersResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetAccountOwnersResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetAccountOwnersRequestPath {
/// The account identifier to receive information for
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for getAccountOwners
#[derive(Debug, Clone)]
pub enum GetAccountOwnersResponse {
///200: An object containing valid accounts and the account properties regarding trading access. This endpoint is also used to confirm account validation.
Ok(SignatureAndOwners),
///400: bad request; accountId is empty
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Provides a general overview of the account details such as balance values.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetAccountSummaryRequest {
#[validate(nested)]
pub path: GetAccountSummaryRequestPath,
}
impl GetAccountSummaryRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetAccountSummaryResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<AccountSummaryResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetAccountSummaryResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetAccountSummaryResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetAccountSummaryResponse::Unauthorized);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetAccountSummaryResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetAccountSummaryResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetAccountSummaryRequestPath {
/// Pass the account identifier to receive information for.
/// - Example: `"U1234567".to_string()`
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for getAccountSummary
#[derive(Debug, Clone)]
pub enum GetAccountSummaryResponse {
///200: Provides a general overview of the account details such as balance values.
Ok(AccountSummaryResponse),
///400: bad request; passed input cannot pass initial validation and detected right away
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Request all accounts held within a model.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetAccountsInModelRequest {
pub body: DetailRequestBody,
}
impl GetAccountsInModelRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetAccountsInModelResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Detail200Response>::json_with_diagnostics(req)
.await?;
return Ok(GetAccountsInModelResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetAccountsInModelResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetAccountsInModelResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetAccountsInModelResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetAccountsInModelResponse::Unknown);
}
}
/// Response types for getAccountsInModel
#[derive(Debug, Clone)]
pub enum GetAccountsInModelResponse {
///200: Successfully retrieve account details of in a model.
Ok(Detail200Response),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Request details of a specific alert by providing the assigned alertId Id.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetAlertDetailsRequest {
pub path: GetAlertDetailsRequestPath,
pub query: GetAlertDetailsRequestQuery,
}
impl GetAlertDetailsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetAlertDetailsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<AlertDetails>::json_with_diagnostics(req).await?;
return Ok(GetAlertDetailsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetAlertDetailsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetAlertDetailsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetAlertDetailsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetAlertDetailsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetAlertDetailsResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, oas3_gen_support::Default)]
pub struct GetAlertDetailsRequestPath {
/// alert identifier, internally referenced as order id
pub alert_id: i64,
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetAlertDetailsRequestQuery {
/// queryType
#[serde(rename = "type")]
#[default("Q".to_string())]
pub r#type: String,
}
/// Response types for getAlertDetails
#[derive(Debug, Clone)]
pub enum GetAlertDetailsResponse {
///200: An object containing all unique details of the specified alert.
Ok(AlertDetails),
///400: bad request if orderId is empty or type is invalid
BadRequest,
///401: Invalid or expired access token
Unauthorized,
///500: orderId is not parsable; unable to process request
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns supported IB Algos for an instrument. A pre-flight request must be submitted before retrieving information.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetAlgosByInstrumentRequest {
#[validate(nested)]
pub path: GetAlgosByInstrumentRequestPath,
pub query: GetAlgosByInstrumentRequestQuery,
}
impl GetAlgosByInstrumentRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetAlgosByInstrumentResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<AlgosResponse>::json_with_diagnostics(req).await?;
return Ok(GetAlgosByInstrumentResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetAlgosByInstrumentResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetAlgosByInstrumentResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetAlgosByInstrumentResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetAlgosByInstrumentResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetAlgosByInstrumentRequestPath {
/// Contract identifier for the requested contract of interest.
#[validate(length(min = 1u64))]
pub conid: String,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetAlgosByInstrumentRequestQuery {
/// List of algo ids delimited by ";" to filter by. Max of 8 algos ids can be specified. Case sensitive to algo id.
pub algos: Option<GetAlgosByInstrumentRequestQueryAlgos>,
/// Whether or not to add algo descriptions to response. Set to 1 for yes, 0 for no.
#[serde(rename = "addDescription")]
#[default(Some(Default::default()))]
pub add_description: Option<AlertActivationRequestAlertActive>,
/// Whether or not to show algo parameters. Set to 1 for yes, 0 for no.
#[serde(rename = "addParams")]
#[default(Some(Default::default()))]
pub add_params: Option<AlertActivationRequestAlertActive>,
}
/// List of algo ids delimited by ";" to filter by. Max of 8 algos ids can be specified. Case sensitive to algo id.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum GetAlgosByInstrumentRequestQueryAlgos {
#[default]
Adaptive,
Vwap,
}
impl core::fmt::Display for GetAlgosByInstrumentRequestQueryAlgos {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Adaptive => write!(f, "Adaptive"),
Self::Vwap => write!(f, "Vwap"),
}
}
}
/// Response types for getAlgosByInstrument
#[derive(Debug, Clone)]
pub enum GetAlgosByInstrumentResponse {
///200: Returns a list of available algos and a description of their behavior.
Ok(AlgosResponse),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Get positions in accounts for a given instrument (no secDef await control)
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetAllAccountsForConidRequest {
pub path: GetAllAccountsForConidRequestPath,
}
impl GetAllAccountsForConidRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetAllAccountsForConidResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Position200Response>::json_with_diagnostics(req)
.await?;
return Ok(GetAllAccountsForConidResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetAllAccountsForConidResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetAllAccountsForConidResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetAllAccountsForConidResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetAllAccountsForConidResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetAllAccountsForConidResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, oas3_gen_support::Default)]
pub struct GetAllAccountsForConidRequestPath {
/// Conid of the instrument for which positions are requested.
/// - Example: `8_314i32`
pub conid: i32,
}
/// Response types for getAllAccountsForConid
#[derive(Debug, Clone)]
pub enum GetAllAccountsForConidResponse {
///200: Object containing positions in the requested conid broken out by account.
Ok(Position200Response),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// return accounts
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetAllAccountsRequest {}
impl GetAllAccountsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetAllAccountsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Account200Response2>::json_with_diagnostics(req)
.await?;
return Ok(GetAllAccountsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetAllAccountsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetAllAccountsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetAllAccountsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetAllAccountsResponse::Unknown);
}
}
/// Response types for getAllAccounts
#[derive(Debug, Clone)]
pub enum GetAllAccountsResponse {
///200: returned array with user account
Ok(Account200Response2),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Retrieve a list of all alerts attached to the provided account.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetAllAlertsRequest {
#[validate(nested)]
pub path: GetAllAlertsRequestPath,
}
impl GetAllAlertsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetAllAlertsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<Alerts>::json_with_diagnostics(req).await?;
return Ok(GetAllAlertsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetAllAlertsResponse::Unauthorized);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetAllAlertsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetAllAlertsResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetAllAlertsRequestPath {
/// Identifier for the unique account to retrieve information from.
/// - Example: `"U1234567".to_string()`
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for getAllAlerts
#[derive(Debug, Clone)]
pub enum GetAllAlertsResponse {
///200: An array of objects detailing contract information.
Ok(Alerts),
///401: Invalid or expired access token
Unauthorized,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Get a list of available notifications.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetAllFyisRequest {
pub query: GetAllFyisRequestQuery,
}
impl GetAllFyisRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetAllFyisResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Notifications>::json_with_diagnostics(req).await?;
return Ok(GetAllFyisResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetAllFyisResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetAllFyisResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetAllFyisResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetAllFyisResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetAllFyisResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetAllFyisRequestQuery {
/// Specify the maximum number of notifications to receive. Can request a maximum of 10 notifications.
/// - Example: `10i32`
pub max: i32,
/// Include only the specified typecode notifications in the request.
pub include: Option<serde_json::Value>,
/// Include all subscribed notifications except the typecodes passed here.
pub exclude: Option<serde_json::Value>,
/// if more required, notifcationId of last notification should be used to define next batch border
pub id: Option<serde_json::Value>,
}
/// Response types for getAllFyis
#[derive(Debug, Clone)]
pub enum GetAllFyisResponse {
///200: Successfully enabled or disabled your email notifications.
Ok(Notifications),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Request all positions held within the model.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetAllModelPositionsRequest {
pub body: PositionRequestBody2,
}
impl GetAllModelPositionsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetAllModelPositionsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<ModelPositionResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetAllModelPositionsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetAllModelPositionsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetAllModelPositionsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetAllModelPositionsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetAllModelPositionsResponse::Unknown);
}
}
/// Response types for getAllModelPositions
#[derive(Debug, Clone)]
pub enum GetAllModelPositionsResponse {
///200: Successfully retrieve position details
Ok(ModelPositionResponse),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Retrieve attributes of the subaccounts in the account structure.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetAllSubaccountsRequest {}
impl GetAllSubaccountsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetAllSubaccountsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Subaccount200Response>::json_with_diagnostics(req)
.await?;
return Ok(GetAllSubaccountsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetAllSubaccountsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetAllSubaccountsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetAllSubaccountsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetAllSubaccountsResponse::Unknown);
}
}
/// Response types for getAllSubaccounts
#[derive(Debug, Clone)]
pub enum GetAllSubaccountsResponse {
///200: Array of objects representing accounts in the structure.
Ok(Subaccount200Response),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns all saved watchlists stored on IB backend for the username in use in the current Web API session.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetAllWatchlistsRequest {
pub query: GetAllWatchlistsRequestQuery,
}
impl GetAllWatchlistsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetAllWatchlistsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<WatchlistsResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetAllWatchlistsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetAllWatchlistsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetAllWatchlistsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetAllWatchlistsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetAllWatchlistsResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetAllWatchlistsRequestQuery {
/// Can only be used with value USER_WATCHLIST, which returns only user-created watchlists and excludes those created by IB.
/// - Example: `Some("USER_WATCHLIST".to_string())`
#[serde(rename = "SC")]
#[default(Some("USER_WATCHLIST".to_string()))]
pub sc: Option<String>,
}
/// Response types for getAllWatchlists
#[derive(Debug, Clone)]
pub enum GetAllWatchlistsResponse {
///200: Historical data query successfully returned data.
Ok(WatchlistsResponse),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Retrieve summaries for all models under the advisor account.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetAllmodelsRequest {
pub body: ReqIDRequestBody,
}
impl GetAllmodelsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetAllmodelsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<ModelListResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetAllmodelsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetAllmodelsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetAllmodelsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetAllmodelsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetAllmodelsResponse::Unknown);
}
}
/// Response types for getAllmodels
#[derive(Debug, Clone)]
pub enum GetAllmodelsResponse {
///200: Successfully retrieve the model list
Ok(ModelListResponse),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Retrieves a list of all sub-accounts and returns their net liquidity and available equity for advisors to make decisions on what accounts should be allocated and how. This endpoint is only supported for Financial Advisors and IBroker Accounts.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetAllocatableSubaccountsRequest {}
impl GetAllocatableSubaccountsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetAllocatableSubaccountsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<SubAccounts>::json_with_diagnostics(req).await?;
return Ok(GetAllocatableSubaccountsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetAllocatableSubaccountsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetAllocatableSubaccountsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetAllocatableSubaccountsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetAllocatableSubaccountsResponse::Unknown);
}
}
/// Response types for getAllocatableSubaccounts
#[derive(Debug, Clone)]
pub enum GetAllocatableSubaccountsResponse {
///200: Indicates data is being returned successfully.
Ok(SubAccounts),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Retrieves a list of all of the advisor's allocation groups. This describes the name of the allocation group, number of subaccounts within the group, and the method in use for the group. This endpoint is only supported for Financial Advisors and IBroker Accounts.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetAllocationGroupsRequest {}
impl GetAllocationGroupsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetAllocationGroupsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<AllocationGroups>::json_with_diagnostics(req)
.await?;
return Ok(GetAllocationGroupsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetAllocationGroupsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetAllocationGroupsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetAllocationGroupsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetAllocationGroupsResponse::Unknown);
}
}
/// Response types for getAllocationGroups
#[derive(Debug, Clone)]
pub enum GetAllocationGroupsResponse {
///200: Returns the "data" array, which contains all allocation groups under the advisor account.
Ok(AllocationGroups),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Retrieve the preset behavior for allocation groups for specific events. This endpoint is only supported for Financial Advisors and IBroker Accounts.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetAllocationPresetsRequest {}
impl GetAllocationPresetsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetAllocationPresetsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<Presets>::json_with_diagnostics(req).await?;
return Ok(GetAllocationPresetsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetAllocationPresetsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetAllocationPresetsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetAllocationPresetsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetAllocationPresetsResponse::Unknown);
}
}
/// Response types for getAllocationPresets
#[derive(Debug, Clone)]
pub enum GetAllocationPresetsResponse {
///200: Successfully retrieve preset details
Ok(Presets),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Get an account's allocations by asset class, sector group, and sector.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetAssetAllocationRequest {
#[validate(nested)]
pub path: GetAssetAllocationRequestPath,
pub query: GetAssetAllocationRequestQuery,
}
impl GetAssetAllocationRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetAssetAllocationResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<PortfolioAllocations>::json_with_diagnostics(req)
.await?;
return Ok(GetAssetAllocationResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetAssetAllocationResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetAssetAllocationResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetAssetAllocationResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetAssetAllocationResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetAssetAllocationResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetAssetAllocationRequestPath {
/// Account ID whose allocations are requested.
#[validate(length(min = 1u64))]
pub account_id: String,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetAssetAllocationRequestQuery {
/// model
pub model: Option<serde_json::Value>,
}
/// Response types for getAssetAllocation
#[derive(Debug, Clone)]
pub enum GetAssetAllocationResponse {
///200: response with allocations
Ok(PortfolioAllocations),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct GetAvailableStmtDatesResponse {
pub data: Option<AvailableStatementDatesData>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct GetAvailableTaxFormsResponse {
pub data: Option<AvailableTaxFormsData>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct GetAvailableTradeConfirmationDatesResponse {
pub data: Option<GetAvailableTradeConfirmationDatesResponseData>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct GetAvailableTradeConfirmationDatesResponseData {
/// - Example: `Some("String".to_string())`
#[serde(rename = "dataType")]
pub data_type: Option<String>,
/// available trade confirmation dates
pub value: Option<Vec<String>>,
}
/// Returns a summary of an account's equity and cash balances, in total and by account segment.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetBalanceSummaryRequest {
#[validate(nested)]
pub path: GetBalanceSummaryRequestPath,
}
impl GetBalanceSummaryRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetBalanceSummaryResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<
SummaryOfAccountBalancesResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(GetBalanceSummaryResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetBalanceSummaryResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetBalanceSummaryResponse::Unauthorized);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetBalanceSummaryResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetBalanceSummaryResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetBalanceSummaryRequestPath {
/// Pass the account identifier to receive information for.
/// - Example: `"U1234567".to_string()`
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for getBalanceSummary
#[derive(Debug, Clone)]
pub enum GetBalanceSummaryResponse {
///200: Indicates a successful return of available funds.
Ok(SummaryOfAccountBalancesResponse),
///400: bad request; passed input cannot pass initial validation and detected right away
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Request a list of filters relating to a given Bond issuerID. The issuerId is retrieved from /iserver/secdef/search and can be used in /iserver/secdef/info?issuerId={issuerId} for retrieving conIds.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetBondFiltersRequest {
#[validate(nested)]
pub query: GetBondFiltersRequestQuery,
}
impl GetBondFiltersRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetBondFiltersResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<BondFiltersResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetBondFiltersResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetBondFiltersResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetBondFiltersResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetBondFiltersResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetBondFiltersResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetBondFiltersRequestQuery {
/// This should always be set to "BOND"
/// - Example: `"BOND".to_string()`
#[validate(length(min = 1u64))]
pub symbol: String,
/// Specifies the issuerId of the bond issuer type. IssuerId can be retrieved from the /iserver/secdef/search endpoint searching for a genric bond symbol and using the BOND secType.
/// - Example: `"e1400715".to_string()`
#[serde(rename = "issuerId")]
#[validate(length(min = 1u64))]
pub issuer_id: String,
}
/// Response types for getBondFilters
#[derive(Debug, Clone)]
pub enum GetBondFiltersResponse {
///200: Successful requests return the currency exchange rate of the target currency value divided by the source currency.
Ok(BondFiltersResponse),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct GetBrokerListResponse {
pub brokers: Vec<String>,
/// - Example: `"COMPLEX_ASSET_TRANSFER".to_string()`
#[serde(rename = "instructionType")]
pub instruction_type: String,
}
/// Returns a list of accounts the user has trading access to, their respective aliases and the currently selected account. Note this endpoint must be called before modifying an order or querying open orders.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetBrokerageAccountsRequest {}
impl GetBrokerageAccountsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetBrokerageAccountsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<UserAccountsResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetBrokerageAccountsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetBrokerageAccountsResponse::Unauthorized);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetBrokerageAccountsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetBrokerageAccountsResponse::Unknown);
}
}
/// Response types for getBrokerageAccounts
#[derive(Debug, Clone)]
pub enum GetBrokerageAccountsResponse {
///200: An object containing valid accounts and the account properties regarding trading access. This endpoint is also used to confirm account validation.
Ok(UserAccountsResponse),
///401: Invalid or expired access token
Unauthorized,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Current Authentication status to the Brokerage system. Market Data and Trading is not possible if not authenticated.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetBrokerageStatusRequest {}
impl GetBrokerageStatusRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetBrokerageStatusResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<BrokerageSessionStatus>::json_with_diagnostics(req)
.await?;
return Ok(GetBrokerageStatusResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetBrokerageStatusResponse::Unauthorized);
}
let _ = req.bytes().await?;
return Ok(GetBrokerageStatusResponse::Unknown);
}
}
/// Response types for getBrokerageStatus
#[derive(Debug, Clone)]
pub enum GetBrokerageStatusResponse {
///200: Detailed status of the Brokerage session
Ok(BrokerageSessionStatus),
///401: Invalid or expired access token
Unauthorized,
///default: Unknown response
Unknown,
}
/// Provides all positions held in the account acquired as a combination, including values such as ratios, size, and market value.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetComboPositionsRequest {
#[validate(nested)]
pub path: GetComboPositionsRequestPath,
pub query: GetComboPositionsRequestQuery,
}
impl GetComboPositionsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetComboPositionsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<ComboPositionResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetComboPositionsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetComboPositionsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetComboPositionsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetComboPositionsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetComboPositionsResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetComboPositionsRequestPath {
#[validate(length(min = 1u64))]
pub account_id: String,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetComboPositionsRequestQuery {
/// Set if request should be made without caching.
#[default(Some(false))]
pub nocache: Option<bool>,
}
/// Response types for getComboPositions
#[derive(Debug, Clone)]
pub enum GetComboPositionsResponse {
///200: response with combo position definitions
Ok(ComboPositionResponse),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Send out a request to retrieve all contracts made available on a requested exchange. This returns all contracts that are tradable on the exchange, even those that are not using the exchange as their primary listing.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetConidsByExchangeRequest {
#[validate(nested)]
pub query: GetConidsByExchangeRequestQuery,
}
impl GetConidsByExchangeRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetConidsByExchangeResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Vec<serde_json::Value>>::json_with_diagnostics(req)
.await?;
return Ok(GetConidsByExchangeResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetConidsByExchangeResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetConidsByExchangeResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetConidsByExchangeResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetConidsByExchangeResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetConidsByExchangeRequestQuery {
/// Exchange from which derivatives should be retrieved from.
/// - Example: `"AMEX".to_string()`
#[validate(length(min = 1u64))]
pub exchange: String,
/// asset class
#[serde(rename = "assetClass")]
#[default(Some(Default::default()))]
pub asset_class: Option<serde_json::Value>,
}
/// Response types for getConidsByExchange
#[derive(Debug, Clone)]
pub enum GetConidsByExchangeResponse {
///200: Successful response containing a contract's security definition.
Ok(Vec<serde_json::Value>),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns the attributes of the instrument.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetContractInfoRequest {
pub query: GetContractInfoRequestQuery,
}
impl GetContractInfoRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetContractInfoResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<SecDefInfoResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetContractInfoResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetContractInfoResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetContractInfoResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetContractInfoResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetContractInfoResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetContractInfoResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetContractInfoRequestQuery {
/// Contract identifier of the underlying. May also pass the final derivative conid directly.
/// - Example: `Some("265598".to_string())`
pub conid: Option<String>,
/// Security type of the requested contract of interest.
pub sectype: Option<serde_json::Value>,
/// Expiration month for the given derivative.
pub month: Option<serde_json::Value>,
/// Designate the exchange you wish to receive information for in relation to the contract.
pub exchange: Option<serde_json::Value>,
/// Set the strike price for the requested contract details
pub strike: Option<serde_json::Value>,
/// Set the right for the given contract. * `C` - for Call options. * `P` - for Put options.
pub right: Option<IndividualPositionPutOrCall>,
/// Set the issuerId for the given bond issuer type.
/// - Example: `Some("e1234567".to_string())`
#[serde(rename = "issuerId")]
pub issuer_id: Option<String>,
/// comma separted list of additional filters. Applicable when SecTyp is BOND
pub filters: Option<serde_json::Value>,
}
/// Response types for getContractInfo
#[derive(Debug, Clone)]
pub enum GetContractInfoResponse {
///200: Successful response containing a contract's security definition.
Ok(SecDefInfoResponse),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns trading related rules for a specific contract and side.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetContractRulesRequest {
pub body: RuleRequestBody,
}
impl GetContractRulesRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetContractRulesResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<ContractRules>::json_with_diagnostics(req).await?;
return Ok(GetContractRulesResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetContractRulesResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetContractRulesResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetContractRulesResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetContractRulesResponse::Unknown);
}
}
/// Response types for getContractRules
#[derive(Debug, Clone)]
pub enum GetContractRulesResponse {
///200: An array of objects detailing contract information.
Ok(ContractRules),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns lists of valid strikes for options contracts on a given underlier, for all currently trading expirations. The /iserver/secdef/search endpoint must be called prior for the underlying. Otherwise empty arrays will return for "puts" and "calls".
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetContractStrikesRequest {
#[validate(nested)]
pub query: GetContractStrikesRequestQuery,
}
impl GetContractStrikesRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetContractStrikesResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Strike200Response>::json_with_diagnostics(req)
.await?;
return Ok(GetContractStrikesResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetContractStrikesResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetContractStrikesResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetContractStrikesResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetContractStrikesResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetContractStrikesResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetContractStrikesRequestQuery {
/// Contract identifier of the underlying. May also pass the final derivative conid directly.
/// - Example: `"265598".to_string()`
#[validate(length(min = 1u64))]
pub conid: String,
/// Security type of the requested contract of interest. Valid asset classes are:
/// * `FOP` - Futures Option
/// * `OPT` - Option
/// * `WAR` - Warrant
pub sectype: GetContractStrikesRequestQuerySectype,
/// Expiration month for the given derivative. Expiration months can be retrieved from /iserver/secdef/search under an {object}/sections/{object}/months
/// - Example: `"JAN24".to_string()`
#[validate(length(min = 1u64))]
pub month: String,
/// Exchange from which derivatives should be retrieved from. This field is mandatory when requesting Futures Options strikes.
/// - Example: `Some("CME".to_string())`
#[default(Some("SMART".to_string()))]
pub exchange: Option<String>,
}
/// Security type of the requested contract of interest. Valid asset classes are:
/// * `FOP` - Futures Option
/// * `OPT` - Option
/// * `WAR` - Warrant
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum GetContractStrikesRequestQuerySectype {
#[serde(rename = "OPT")]
#[default]
Opt,
#[serde(rename = "FOP")]
Fop,
#[serde(rename = "WAR")]
War,
}
impl core::fmt::Display for GetContractStrikesRequestQuerySectype {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Opt => write!(f, "OPT"),
Self::Fop => write!(f, "FOP"),
Self::War => write!(f, "WAR"),
}
}
}
/// Response types for getContractStrikes
#[derive(Debug, Clone)]
pub enum GetContractStrikesResponse {
///200: Successful response containing a contract's security definition.
Ok(Strike200Response),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns a list of contracts based on the search symbol provided as a query param.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetContractSymbolsFromBodyRequest {
#[validate(nested)]
pub body: SearchRequestBody,
}
impl GetContractSymbolsFromBodyRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetContractSymbolsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<SecdefSearchResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetContractSymbolsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetContractSymbolsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetContractSymbolsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetContractSymbolsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetContractSymbolsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetContractSymbolsResponse::Unknown);
}
}
/// Returns a list of contracts based on the search symbol provided as a query param.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetContractSymbolsRequest {
pub query: GetContractSymbolsRequestQuery,
}
impl GetContractSymbolsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetContractSymbolsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<SecdefSearchResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetContractSymbolsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetContractSymbolsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetContractSymbolsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetContractSymbolsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetContractSymbolsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetContractSymbolsResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetContractSymbolsRequestQuery {
/// The ticker symbol, bond issuer type, or company name of the equity you are looking to trade.
/// - Example: `Some("AAPL".to_string())`
pub symbol: Option<String>,
/// Available underlying security types:
/// * `STK` - Represents an underlying as a Stock security type.
/// * `IND` - Represents an underlying as an Index security type.
/// * `BOND` - Represents an underlying as a Bond security type.
#[serde(rename = "secType")]
#[default(Some(Default::default()))]
pub sec_type: Option<GetContractSymbolsRequestQuerySecType>,
/// Denotes if the symbol value is the ticker symbol or part of the company's name.
pub name: Option<bool>,
pub more: Option<bool>,
/// fund search
pub fund: Option<bool>,
#[serde(rename = "fundFamilyConidEx")]
pub fund_family_conid_ex: Option<String>,
/// pattern search
pub pattern: Option<bool>,
pub referrer: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum GetContractSymbolsRequestQuerySecType {
#[serde(rename = "STK")]
#[default]
Stk,
#[serde(rename = "IND")]
Ind,
#[serde(rename = "BOND")]
Bond,
}
impl core::fmt::Display for GetContractSymbolsRequestQuerySecType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Stk => write!(f, "STK"),
Self::Ind => write!(f, "IND"),
Self::Bond => write!(f, "BOND"),
}
}
}
/// Response types for getContractSymbols
#[derive(Debug, Clone)]
pub enum GetContractSymbolsResponse {
///200: An array of objects detailing contract information.
Ok(SecdefSearchResponse),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Obtains available currency pairs corresponding to the given target currency.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetCurrencyPairsRequest {
#[validate(nested)]
pub query: GetCurrencyPairsRequestQuery,
}
impl GetCurrencyPairsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetCurrencyPairsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<CurrencyPairs>::json_with_diagnostics(req).await?;
return Ok(GetCurrencyPairsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetCurrencyPairsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetCurrencyPairsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetCurrencyPairsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetCurrencyPairsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetCurrencyPairsResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetCurrencyPairsRequestQuery {
/// Specify the target currency you would like to receive official pairs of.
/// - Example: `"USD".to_string()`
#[validate(length(min = 1u64))]
pub currency: String,
}
/// Response types for getCurrencyPairs
#[derive(Debug, Clone)]
pub enum GetCurrencyPairsResponse {
///200: Returns a list of valid forex pairs for the given currency. The currency can apply as both the target or base currency.
Ok(CurrencyPairs),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns a list of accounts matching a query pattern set in the request. Broker accounts configured with the DYNACCT property will not receive account information at login. Instead, they must dynamically query then set their account number. Customers without the DYNACCT property will receive a 503 error.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetDynamicAccountsRequest {
#[validate(nested)]
pub path: GetDynamicAccountsRequestPath,
}
impl GetDynamicAccountsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetDynamicAccountsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<DynAccountSearchResponse>::json_with_diagnostics(
req,
)
.await?;
return Ok(GetDynamicAccountsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetDynamicAccountsResponse::Unauthorized);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetDynamicAccountsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetDynamicAccountsResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetDynamicAccountsRequestPath {
/// The pattern used to describe credentials to search for. Including part of part of an account ID will return the full value.
/// - Example: `"U123".to_string()`
#[validate(length(min = 1u64))]
pub search_pattern: String,
}
/// Response types for getDynamicAccounts
#[derive(Debug, Clone)]
pub enum GetDynamicAccountsResponse {
///200: Returns all accounts that match the searchPattern string.
Ok(DynAccountSearchResponse),
///401: Invalid or expired access token
Unauthorized,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Obtains the exchange rates of the currency pair.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetExchangeRatesRequest {
#[validate(nested)]
pub query: GetExchangeRatesRequestQuery,
}
impl GetExchangeRatesRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetExchangeRatesResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<RateResponse>::json_with_diagnostics(req).await?;
return Ok(GetExchangeRatesResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetExchangeRatesResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetExchangeRatesResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetExchangeRatesResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetExchangeRatesResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetExchangeRatesResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetExchangeRatesRequestQuery {
/// Specify the quote currency to request data for.
/// - Example: `"EUR".to_string()`
#[validate(length(min = 1u64))]
pub target: String,
/// Specify the base currency to request data for.
/// - Example: `"USD".to_string()`
#[validate(length(min = 1u64))]
pub source: String,
}
/// Response types for getExchangeRates
#[derive(Debug, Clone)]
pub enum GetExchangeRatesResponse {
///200: Successful requests return the currency exchange rate of the target currency value divided by the source currency.
Ok(RateResponse),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns the category names, parent ids, and markets for Event Contracts.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetForecastCategoriesRequest {}
impl GetForecastCategoriesRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetForecastCategoriesResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<CategoryTreeResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetForecastCategoriesResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetForecastCategoriesResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetForecastCategoriesResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetForecastCategoriesResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetForecastCategoriesResponse::Unknown);
}
}
/// Response types for getForecastCategories
#[derive(Debug, Clone)]
pub enum GetForecastCategoriesResponse {
///200: Returns a list of category identifiers and name to be used for more granular contract discovery.
Ok(CategoryTreeResponse),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Provides instrument details for the specific forecast contract.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetForecastContractRequest {
#[validate(nested)]
pub query: GetForecastContractRequestQuery,
}
impl GetForecastContractRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetForecastContractResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<ForecastDetailsResponse>::json_with_diagnostics(
req,
)
.await?;
return Ok(GetForecastContractResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetForecastContractResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetForecastContractResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetForecastContractResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetForecastContractResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetForecastContractRequestQuery {
/// Provide the contract identifier to retrieve the information for.
#[validate(length(min = 1u64))]
pub conid: String,
}
/// Response types for getForecastContract
#[derive(Debug, Clone)]
pub enum GetForecastContractResponse {
///200: Returns the expanded list of the event contract containing both Yes and No side identifier information.
Ok(ForecastDetailsResponse),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns all high level contract details affiliated with the underlying market conid provided.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetForecastMarketsRequest {
#[validate(nested)]
pub query: GetForecastMarketsRequestQuery,
}
impl GetForecastMarketsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetForecastMarketsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<ForecastMarketResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetForecastMarketsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetForecastMarketsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetForecastMarketsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetForecastMarketsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetForecastMarketsResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetForecastMarketsRequestQuery {
/// Underlying event index contract identifier.
#[serde(rename = "underlyingConid")]
#[validate(length(min = 1u64))]
pub underlying_conid: String,
/// Exchange to filter contract by.
pub exchange: Option<String>,
}
/// Response types for getForecastMarkets
#[derive(Debug, Clone)]
pub enum GetForecastMarketsResponse {
///200: Returns the liquid and extended trading hours of the coming and prior trading days.
Ok(ForecastMarketResponse),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Provides trading rules for specific event contracts.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetForecastRulesRequest {
#[validate(nested)]
pub query: GetForecastRulesRequestQuery,
}
impl GetForecastRulesRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetForecastRulesResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<ForecastRulesResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetForecastRulesResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetForecastRulesResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetForecastRulesResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetForecastRulesResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetForecastRulesResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetForecastRulesRequestQuery {
/// Provide the contract identifier to retrieve rules for.
#[validate(length(min = 1u64))]
pub conid: String,
}
/// Response types for getForecastRules
#[derive(Debug, Clone)]
pub enum GetForecastRulesResponse {
///200: Returns the corresponding contracts rules.
Ok(ForecastRulesResponse),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Provides forecast trading schedules.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetForecastScheduleRequest {
#[validate(nested)]
pub query: GetForecastScheduleRequestQuery,
}
impl GetForecastScheduleRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetForecastScheduleResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<ForecastSchedulesResponse>::json_with_diagnostics(
req,
)
.await?;
return Ok(GetForecastScheduleResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetForecastScheduleResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetForecastScheduleResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetForecastScheduleResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetForecastScheduleResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetForecastScheduleRequestQuery {
/// Provide the contract identifier to retrieve the trading schedule for.
#[validate(length(min = 1u64))]
pub conid: String,
}
/// Response types for getForecastSchedule
#[derive(Debug, Clone)]
pub enum GetForecastScheduleResponse {
///200: Returns the liquid and extended trading hours of the coming and prior trading days.
Ok(ForecastSchedulesResponse),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Provides a summary specific for avilable funds giving more depth than the standard /summary endpoint.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetFundSummaryRequest {
#[validate(nested)]
pub path: GetFundSummaryRequestPath,
}
impl GetFundSummaryRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetFundSummaryResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<AvailableFundsResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetFundSummaryResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetFundSummaryResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetFundSummaryResponse::Unauthorized);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetFundSummaryResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetFundSummaryResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetFundSummaryRequestPath {
/// Pass the account identifier to receive information for.
/// - Example: `"U1234567".to_string()`
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for getFundSummary
#[derive(Debug, Clone)]
pub enum GetFundSummaryResponse {
///200: Indicates a successful return of available funds.
Ok(AvailableFundsResponse),
///400: bad request; passed input cannot pass initial validation and detected right away
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns a list of non-expired future contracts for given symbol(s)
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetFutureBySymbolRequest {
#[validate(nested)]
pub query: GetFutureBySymbolRequestQuery,
}
impl GetFutureBySymbolRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetFutureBySymbolResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Features>::json_with_diagnostics(req).await?;
return Ok(GetFutureBySymbolResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetFutureBySymbolResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetFutureBySymbolResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetFutureBySymbolResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetFutureBySymbolResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetFutureBySymbolRequestQuery {
/// Indicate the symbol(s) of the underlier you are trying to retrieve futures on. Accepts comma delimited string of symbols.
/// - Example: `"ES,MES".to_string()`
#[validate(length(min = 1u64))]
pub symbols: String,
/// Primary listing exchange for the Future.
/// - Example: `Some("CME".to_string())`
pub exchange: Option<String>,
}
/// Response types for getFutureBySymbol
#[derive(Debug, Clone)]
pub enum GetFutureBySymbolResponse {
///200: Successful response containing a contract's security definition.
Ok(Features),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Options for sending fyis to email and other devices.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetFyiDeliveryRequest {}
impl GetFyiDeliveryRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetFyiDeliveryResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<DeliveryOptions>::json_with_diagnostics(req)
.await?;
return Ok(GetFyiDeliveryResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetFyiDeliveryResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetFyiDeliveryResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetFyiDeliveryResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetFyiDeliveryResponse::Unknown);
}
}
/// Response types for getFyiDelivery
#[derive(Debug, Clone)]
pub enum GetFyiDeliveryResponse {
///200: Successfully retrieve preset details
Ok(DeliveryOptions),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Receive additional disclaimers based on the specified typecode.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetFyiDisclaimerssRequest {
pub path: GetFyiDisclaimerssRequestPath,
}
impl GetFyiDisclaimerssRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetFyiDisclaimerssResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<DisclaimerInfo>::json_with_diagnostics(req).await?;
return Ok(GetFyiDisclaimerssResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetFyiDisclaimerssResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetFyiDisclaimerssResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetFyiDisclaimerssResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetFyiDisclaimerssResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, oas3_gen_support::Default)]
pub struct GetFyiDisclaimerssRequestPath {
/// Many FYI endpoints reference a "typecode" value. The table below lists the available codes and what they correspond to.
/// * `BA` - Borrow Availability
/// * `CA` - Comparable Algo
/// * `DA` - Dividends Advisory
/// * `EA` - Upcoming Earnings
/// * `MF` - Mutual Fund Advisory
/// * `OE` - Option Expiration
/// * `PR` - Portfolio Builder Rebalance
/// * `SE` - Suspend Order on Economic Event
/// * `SG` - Short Term Gain turning Long Term
/// * `SM` - System Messages
/// * `T2` - Assignment Realizing Long-Term Gains
/// * `TO` - Takeover
/// * `UA` - User Alert
/// * `M8` - M871 Trades
/// * `PS` - Platform Use Suggestions
/// * `DL` - Unexercised Option Loss Prevention Reminder
/// * `PT` - Position Transfer
/// * `CB` - Missing Cost Basis
/// * `MS` - Milestones
/// * `TD` - MiFID || 10% Deprecation Notice
/// * `ST` - Save Taxes
/// * `TI` - Trade Idea
/// * `CT` - Cash Transfer
pub typecode: Typecodes,
}
/// Response types for getFyiDisclaimerss
#[derive(Debug, Clone)]
pub enum GetFyiDisclaimerssResponse {
///200: Successfully disclaimer details
Ok(DisclaimerInfo),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Return the current choices of subscriptions for notifications.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetFyiSettingsRequest {}
impl GetFyiSettingsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetFyiSettingsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<FyiSettings>::json_with_diagnostics(req).await?;
return Ok(GetFyiSettingsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetFyiSettingsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetFyiSettingsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetFyiSettingsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetFyiSettingsResponse::Unknown);
}
}
/// Response types for getFyiSettings
#[derive(Debug, Clone)]
pub enum GetFyiSettingsResponse {
///200: Indicates data is being returned successfully.
Ok(FyiSettings),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// <br>**Scope**: `accounts.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1AccountsAccountidDetailsRequest {
#[validate(nested)]
pub path: GetGwApiV1AccountsAccountidDetailsRequestPath,
}
impl GetGwApiV1AccountsAccountidDetailsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1AccountsAccountidDetailsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<AccountDetailsResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetGwApiV1AccountsAccountidDetailsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidDetailsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidDetailsResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidDetailsResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidDetailsResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidDetailsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidDetailsResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1AccountsAccountidDetailsRequestPath {
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for get_gw_api_v1_accounts_accountid_details
#[derive(Debug, Clone)]
pub enum GetGwApiV1AccountsAccountidDetailsResponse {
///200: View information associated with account including contact data, financial information and trading configuration.
Ok(AccountDetailsResponse),
///400: Returns error description representing bad request
BadRequest,
///401: Returns error description representing access issue
Unauthorized,
///403: Returns error description representing access issue
Forbidden,
///415: Unsupported Media Type
UnsupportedMediaType,
///500: Returns error description representing internal server error
InternalServerError,
///default: Unknown response
Unknown,
}
/// Generate URL address to complete real-time KYC verification using Au10Tix<br><br>**Scope**: `accounts.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1AccountsAccountidKycRequest {
#[validate(nested)]
pub path: GetGwApiV1AccountsAccountidKycRequestPath,
}
impl GetGwApiV1AccountsAccountidKycRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1AccountsAccountidKycResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Au10TixDetailResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetGwApiV1AccountsAccountidKycResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidKycResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidKycResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidKycResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidKycResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidKycResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidKycResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1AccountsAccountidKycRequestPath {
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for get_gw_api_v1_accounts_accountid_kyc
#[derive(Debug, Clone)]
pub enum GetGwApiV1AccountsAccountidKycResponse {
///200: Generate URL address to complete real-time KYC verification using Au10Tix
Ok(Au10TixDetailResponse),
///400: Returns error description representing bad request
BadRequest,
///401: Returns error description representing access issue
Unauthorized,
///403: Returns error description representing access issue
Forbidden,
///415: Unsupported Media Type
UnsupportedMediaType,
///500: Returns error description representing internal server error
InternalServerError,
///default: Unknown response
Unknown,
}
/// Query login messages assigned by accountId<br><br>**Scope**: `accounts.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1AccountsAccountidLoginMessagesRequest {
#[validate(nested)]
pub path: GetGwApiV1AccountsAccountidLoginMessagesRequestPath,
pub query: GetGwApiV1AccountsAccountidLoginMessagesRequestQuery,
}
impl GetGwApiV1AccountsAccountidLoginMessagesRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1AccountsLoginMessagesResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<LoginMessageResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetGwApiV1AccountsLoginMessagesResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsLoginMessagesResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsLoginMessagesResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsLoginMessagesResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsLoginMessagesResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsLoginMessagesResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsLoginMessagesResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1AccountsAccountidLoginMessagesRequestPath {
#[validate(length(min = 1u64))]
pub account_id: String,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetGwApiV1AccountsAccountidLoginMessagesRequestQuery {
#[serde(rename = "type")]
pub r#type: Option<String>,
}
/// Query status of account by accountId<br><br>**Scope**: `accounts.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1AccountsAccountidStatusRequest {
#[validate(nested)]
pub path: GetGwApiV1AccountsAccountidStatusRequestPath,
}
impl GetGwApiV1AccountsAccountidStatusRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1AccountsAccountidStatusResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<AccountStatusResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetGwApiV1AccountsAccountidStatusResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidStatusResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidStatusResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidStatusResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidStatusResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidStatusResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidStatusResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1AccountsAccountidStatusRequestPath {
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for get_gw_api_v1_accounts_accountid_status
#[derive(Debug, Clone)]
pub enum GetGwApiV1AccountsAccountidStatusResponse {
///200: Query status of account by accountId.
Ok(AccountStatusResponse),
///400: Returns error description representing bad request
BadRequest,
///401: Returns error description representing access issue
Unauthorized,
///403: Returns error description representing access issue
Forbidden,
///415: Unsupported Media Type
UnsupportedMediaType,
///500: Returns error description representing internal server error
InternalServerError,
///default: Unknown response
Unknown,
}
/// Query registration tasks assigned to account and pending tasks that are required for account approval<br><br>**Scope**: `accounts.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1AccountsAccountidTasksRequest {
#[validate(nested)]
pub path: GetGwApiV1AccountsAccountidTasksRequestPath,
pub query: GetGwApiV1AccountsAccountidTasksRequestQuery,
}
impl GetGwApiV1AccountsAccountidTasksRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1AccountsAccountidTasksResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<Task200Response>::json_with_diagnostics(req)
.await?;
return Ok(GetGwApiV1AccountsAccountidTasksResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidTasksResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidTasksResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidTasksResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidTasksResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidTasksResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidTasksResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1AccountsAccountidTasksRequestPath {
#[validate(length(min = 1u64))]
pub account_id: String,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetGwApiV1AccountsAccountidTasksRequestQuery {
#[serde(rename = "type")]
#[default(Some(Default::default()))]
pub r#type: Option<GetGwApiV1AccountsAccountidTasksRequestQueryType>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum GetGwApiV1AccountsAccountidTasksRequestQueryType {
#[serde(rename = "pending")]
#[default]
Pending,
#[serde(rename = "registration")]
Registration,
}
impl core::fmt::Display for GetGwApiV1AccountsAccountidTasksRequestQueryType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Pending => write!(f, "pending"),
Self::Registration => write!(f, "registration"),
}
}
}
/// Response types for get_gw_api_v1_accounts_accountid_tasks
#[derive(Debug, Clone)]
pub enum GetGwApiV1AccountsAccountidTasksResponse {
///200: Query registration tasks assigned to account and pending tasks that are required for account approval
Ok(Task200Response),
///400: Returns error description representing bad request
BadRequest,
///401: Returns error description representing access issue
Unauthorized,
///403: Returns error description representing access issue
Forbidden,
///415: Unsupported Media Type
UnsupportedMediaType,
///500: Returns error description representing internal server error
InternalServerError,
///default: Unknown response
Unknown,
}
/// Query all accounts associated with ‘Client ID’ that have incomplete login message<br><br>**Scope**: `accounts.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1AccountsLoginMessagesRequest {
pub query: GetGwApiV1AccountsLoginMessagesRequestQuery,
}
impl GetGwApiV1AccountsLoginMessagesRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1AccountsLoginMessagesResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<LoginMessageResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetGwApiV1AccountsLoginMessagesResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsLoginMessagesResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsLoginMessagesResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsLoginMessagesResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsLoginMessagesResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsLoginMessagesResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsLoginMessagesResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetGwApiV1AccountsLoginMessagesRequestQuery {
#[serde(rename = "loginMessageRequest")]
pub login_message_request: serde_json::Value,
}
/// Response types for get_gw_api_v1_accounts_login_messages
#[derive(Debug, Clone)]
pub enum GetGwApiV1AccountsLoginMessagesResponse {
///200: Query all accounts associated with ‘Client ID’ that have incomplete login message
Ok(LoginMessageResponse),
///400: Returns error description representing bad request
BadRequest,
///401: Returns error description representing access issue
Unauthorized,
///403: Returns error description representing access issue
Forbidden,
///415: Unsupported Media Type
UnsupportedMediaType,
///500: Returns error description representing internal server error
InternalServerError,
///default: Unknown response
Unknown,
}
/// Retrieve the application request and IBKR response data based on IBKR accountId or externalId. Only available for accounts that originate via API<br><br>**Scope**: `accounts.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1AccountsRequest {
pub query: GetGwApiV1AccountsRequestQuery,
}
impl GetGwApiV1AccountsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1AccountsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Account200Response>::json_with_diagnostics(req)
.await?;
return Ok(GetGwApiV1AccountsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetGwApiV1AccountsRequestQuery {
#[serde(rename = "accountId")]
pub account_id: Option<String>,
#[serde(rename = "externalId")]
pub external_id: Option<String>,
}
/// Response types for get_gw_api_v1_accounts
#[derive(Debug, Clone)]
pub enum GetGwApiV1AccountsResponse {
///200: Retrieve the application request and IBKR response data based on IBKR accountId or externalId. Only available for accounts that originate via API
Ok(Account200Response),
///400: Returns error description representing bad request
BadRequest,
///401: Returns error description representing access issue
Unauthorized,
///403: Returns error description representing access issue
Forbidden,
///415: Unsupported Media Type
UnsupportedMediaType,
///500: Returns error description representing internal server error
InternalServerError,
///default: Unknown response
Unknown,
}
/// Query status of all accounts associated with ‘Client ID'<br><br>**Scope**: `accounts.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1AccountsStatusRequest {
pub query: GetGwApiV1AccountsStatusRequestQuery,
}
impl GetGwApiV1AccountsStatusRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1AccountsStatusResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<AccountStatusBulkResponse>::json_with_diagnostics(
req,
)
.await?;
return Ok(GetGwApiV1AccountsStatusResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsStatusResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsStatusResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsStatusResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsStatusResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsStatusResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsStatusResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetGwApiV1AccountsStatusRequestQuery {
#[serde(rename = "accountStatusRequest")]
pub account_status_request: serde_json::Value,
}
/// Response types for get_gw_api_v1_accounts_status
#[derive(Debug, Clone)]
pub enum GetGwApiV1AccountsStatusResponse {
///200: Query status of all accounts associated with ‘Client ID'
Ok(AccountStatusBulkResponse),
///400: Returns error description representing bad request
BadRequest,
///401: Returns error description representing access issue
Unauthorized,
///403: Returns error description representing access issue
Forbidden,
///415: Unsupported Media Type
UnsupportedMediaType,
///500: Returns error description representing internal server error
InternalServerError,
///default: Unknown response
Unknown,
}
/// Retrieve status of request by clientInstructionId.<br><br>**Scope**: `instructions.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1ClientInstructionsClientinstructionidRequest {
pub path: GetGwApiV1ClientInstructionsClientinstructionidRequestPath,
pub query: GetGwApiV1ClientInstructionsClientinstructionidRequestQuery,
}
impl GetGwApiV1ClientInstructionsClientinstructionidRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1InstructionsInstructionidResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Instruction200Response>::json_with_diagnostics(req)
.await?;
return Ok(GetGwApiV1InstructionsInstructionidResponse::Ok(data));
}
if status == http::StatusCode::NOT_FOUND {
let _ = req.bytes().await?;
return Ok(GetGwApiV1InstructionsInstructionidResponse::NotFound);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1InstructionsInstructionidResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1InstructionsInstructionidResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, oas3_gen_support::Default)]
pub struct GetGwApiV1ClientInstructionsClientinstructionidRequestPath {
/// The target instruction id.
/// - Example: `-1_988_905_739i32`
pub client_instruction_id: i32,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetGwApiV1ClientInstructionsClientinstructionidRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
}
/// <br>**Scope**: `echo.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1EchoHttpsRequest {}
impl GetGwApiV1EchoHttpsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1EchoHttpsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<EchoResponse>::json_with_diagnostics(req).await?;
return Ok(GetGwApiV1EchoHttpsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1EchoHttpsResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(GetGwApiV1EchoHttpsResponse::Forbidden);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1EchoHttpsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1EchoHttpsResponse::Unknown);
}
}
/// Response types for get_gw_api_v1_echo_https
#[derive(Debug, Clone)]
pub enum GetGwApiV1EchoHttpsResponse {
///200: Returns a JSON object containing the request parameters.
Ok(EchoResponse),
///401: Returns a Problem detail instance representing an unauthorized request.
Unauthorized,
///403: Returns a Problem detail instance representing a forbidden request.
Forbidden,
///500: Returns a Problem detail instance representing an internal server error.
InternalServerError,
///default: Unknown response
Unknown,
}
/// Get list of brokers supported for given asset transfer type<br><br>**Scope**: `enumerations.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1EnumerationsComplexAssetTransferRequest {
#[validate(nested)]
pub query: GetGwApiV1EnumerationsComplexAssetTransferRequestQuery,
}
impl GetGwApiV1EnumerationsComplexAssetTransferRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1EnumerationsComplexAssetTransferResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<GetBrokerListResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetGwApiV1EnumerationsComplexAssetTransferResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetGwApiV1EnumerationsComplexAssetTransferResponse::BadRequest);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1EnumerationsComplexAssetTransferResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1EnumerationsComplexAssetTransferResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1EnumerationsComplexAssetTransferRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
/// Asset transfer type to get the list of supported brokers
#[serde(rename = "instructionType")]
#[validate(length(min = 1u64))]
pub instruction_type: String,
}
/// Response types for get_gw_api_v1_enumerations_complex_asset_transfer
#[derive(Debug, Clone)]
pub enum GetGwApiV1EnumerationsComplexAssetTransferResponse {
///200: Returns list of brokers supported for given asset type
Ok(GetBrokerListResponse),
///400: Returns a Problem detail instance representing a not found request.
BadRequest,
///500: Unable to process request due to an Internal Error. Please try again later.
InternalServerError,
///default: Unknown response
Unknown,
}
/// Used to query list of enumerations for attributes included within extPositionsTransfers, occupation, employerBusiness, financialInformation, affiliationDetails, tradingPermissions, etc.<br><br>**Scope**: `accounts.read` OR `enumerations.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1EnumerationsEnumerationtypeRequest {
#[validate(nested)]
pub path: GetGwApiV1EnumerationsEnumerationtypeRequestPath,
pub query: GetGwApiV1EnumerationsEnumerationtypeRequestQuery,
}
impl GetGwApiV1EnumerationsEnumerationtypeRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1EnumerationsEnumerationtypeResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<EnumerationResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetGwApiV1EnumerationsEnumerationtypeResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetGwApiV1EnumerationsEnumerationtypeResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1EnumerationsEnumerationtypeResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(GetGwApiV1EnumerationsEnumerationtypeResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(GetGwApiV1EnumerationsEnumerationtypeResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1EnumerationsEnumerationtypeResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1EnumerationsEnumerationtypeResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1EnumerationsEnumerationtypeRequestPath {
#[validate(length(min = 1u64))]
pub enumeration_type: String,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetGwApiV1EnumerationsEnumerationtypeRequestQuery {
/// <ul><li>exchange-bundles - query most up to date list of exchange-bundles for tradingPermissions</li><li>business-and-occupation - list of occupation and employerBusiness for employmentDetails</li><li>employee-track - query most up to date companyId for account. For affiliation details, if company has an existing IBKR Employee Track account</li><li>fin-info-ranges - query most up to date range IDs by currency for annualNetIncome, netWorth, liquidNetWorth</li><li>acats - query most up to date values for brokerId and brokerName. Used if funding via US ACATS extPositionsTransfers</li><li>aton - query most up to date values for brokerId and brokerName. Used if funding via US ACATS extPositionsTransfers</li><li>market-data - query most up to date values for brokerId and brokerName. Used if funding via ATON Canada extPositionsTransfers</li><li>edd-avt - query questions associated with EDD (Enhanced Due Diligence) or AVT (Additional Verification) tasks assigned to an account</li><li>prohibited-country - view list of prohibited countries. Applicants that reside in prohibited country are restricted from opening an account with IBKR. Error will be thrown IF legalResidenceCountry, OR country (included within Residence, mailingAddress and employerAddress, taxResidency node) is a prohibited country</li><li>employee-plans - view EPA that are linked to master account (applicable IF offering SEP IRA accounts)</li><li>questionnaires - obtain list of questionnaires</li><li>security-questions - obtain list of questions supported for IBKR security questions</li><li>quiz-questions - obtain list of questions associated with IBKR knowledge assessment</li><li>wire-instructions - obtain list of wire instructions</li><li>product-country-bundles - obtain list of product country bundles</li></ul>
#[serde(rename = "type")]
pub r#type: Option<EnumerationType>,
pub currency: Option<String>,
#[serde(rename = "ibEntity")]
pub ib_entity: Option<String>,
#[serde(rename = "mdStatusNonPro")]
pub md_status_non_pro: Option<String>,
#[serde(rename = "form-number")]
pub form_number: Option<String>,
pub language: Option<GetGwApiV1EnumerationsEnumerationtypeRequestQueryLanguage>,
#[serde(rename = "accountId")]
pub account_id: Option<String>,
#[serde(rename = "userName")]
pub user_name: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum GetGwApiV1EnumerationsEnumerationtypeRequestQueryLanguage {
#[serde(rename = "en")]
#[default]
En,
#[serde(rename = "ar")]
Ar,
#[serde(rename = "de")]
De,
#[serde(rename = "es")]
Es,
#[serde(rename = "fr")]
Fr,
#[serde(rename = "he")]
He,
#[serde(rename = "hu")]
Hu,
#[serde(rename = "it")]
It,
#[serde(rename = "ja")]
Ja,
#[serde(rename = "nl")]
Nl,
#[serde(rename = "pt")]
Pt,
#[serde(rename = "ru")]
Ru,
#[serde(rename = "zh_CN")]
ZhCn,
#[serde(rename = "zh_TW")]
ZhTw,
}
impl core::fmt::Display for GetGwApiV1EnumerationsEnumerationtypeRequestQueryLanguage {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::En => write!(f, "en"),
Self::Ar => write!(f, "ar"),
Self::De => write!(f, "de"),
Self::Es => write!(f, "es"),
Self::Fr => write!(f, "fr"),
Self::He => write!(f, "he"),
Self::Hu => write!(f, "hu"),
Self::It => write!(f, "it"),
Self::Ja => write!(f, "ja"),
Self::Nl => write!(f, "nl"),
Self::Pt => write!(f, "pt"),
Self::Ru => write!(f, "ru"),
Self::ZhCn => write!(f, "zh_CN"),
Self::ZhTw => write!(f, "zh_TW"),
}
}
}
/// Response types for get_gw_api_v1_enumerations_enumerationtype
#[derive(Debug, Clone)]
pub enum GetGwApiV1EnumerationsEnumerationtypeResponse {
///200: Get enumerations
Ok(EnumerationResponse),
///400: Returns error description representing bad request
BadRequest,
///401: Returns error description representing access issue
Unauthorized,
///403: Returns error description representing access issue
Forbidden,
///415: Unsupported Media Type
UnsupportedMediaType,
///500: Returns error description representing internal server error
InternalServerError,
///default: Unknown response
Unknown,
}
/// Get forms<br><br>**Scope**: `accounts.read` OR `forms.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1FormsRequest {
pub query: GetGwApiV1FormsRequestQuery,
}
impl GetGwApiV1FormsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetGwApiV1FormsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<FormFileResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetGwApiV1FormsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetGwApiV1FormsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1FormsResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(GetGwApiV1FormsResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(GetGwApiV1FormsResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1FormsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1FormsResponse::Unknown);
}
}
#[serde_with::serde_as]
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetGwApiV1FormsRequestQuery {
#[serde_as(as = "Option<oas3_gen_support::StringWithCommaSeparator>")]
#[serde(rename = "formNo")]
pub form_no: Option<Vec<String>>,
#[serde(rename = "getDocs")]
pub get_docs: Option<String>,
#[serde(rename = "fromDate")]
pub from_date: Option<String>,
#[serde(rename = "toDate")]
pub to_date: Option<String>,
pub language: Option<String>,
#[default(Some(Default::default()))]
pub projection: Option<GetGwApiV1FormsRequestQueryProjection>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum GetGwApiV1FormsRequestQueryProjection {
#[serde(rename = "PAYLOAD")]
#[default]
Payload,
#[serde(rename = "DOCS")]
Docs,
#[serde(rename = "NONE")]
None,
}
impl core::fmt::Display for GetGwApiV1FormsRequestQueryProjection {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Payload => write!(f, "PAYLOAD"),
Self::Docs => write!(f, "DOCS"),
Self::None => write!(f, "NONE"),
}
}
}
/// Get required forms<br><br>**Scope**: `accounts.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1FormsRequiredFormsRequest {
pub query: GetGwApiV1FormsRequiredFormsRequestQuery,
}
impl GetGwApiV1FormsRequiredFormsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1FormsRequiredFormsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<RequiredFormsResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetGwApiV1FormsRequiredFormsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetGwApiV1FormsRequiredFormsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1FormsRequiredFormsResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(GetGwApiV1FormsRequiredFormsResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(GetGwApiV1FormsRequiredFormsResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1FormsRequiredFormsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1FormsRequiredFormsResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetGwApiV1FormsRequiredFormsRequestQuery {
#[serde(rename = "requiredFormsRequest")]
pub required_forms_request: serde_json::Value,
}
/// Response types for get_gw_api_v1_forms_required_forms
#[derive(Debug, Clone)]
pub enum GetGwApiV1FormsRequiredFormsResponse {
///200: Get required forms
Ok(RequiredFormsResponse),
///400: Returns error description representing bad request
BadRequest,
///401: Returns error description representing access issue
Unauthorized,
///403: Returns error description representing access issue
Forbidden,
///415: Unsupported Media Type
UnsupportedMediaType,
///500: Returns error description representing internal server error
InternalServerError,
///default: Unknown response
Unknown,
}
/// Response types for get_gw_api_v1_forms
#[derive(Debug, Clone)]
pub enum GetGwApiV1FormsResponse {
///200: Get forms
Ok(FormFileResponse),
///400: Returns error description representing bad request
BadRequest,
///401: Returns error description representing access issue
Unauthorized,
///403: Returns error description representing access issue
Forbidden,
///415: Unsupported Media Type
UnsupportedMediaType,
///500: Returns error description representing internal server error
InternalServerError,
///default: Unknown response
Unknown,
}
/// Retrieve status of all requests associated with instructionSetId.<br><br>**Scope**: `instructions.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1InstructionSetsInstructionsetidRequest {
pub path: GetGwApiV1InstructionSetsInstructionsetidRequestPath,
pub query: GetGwApiV1InstructionSetsInstructionsetidRequestQuery,
}
impl GetGwApiV1InstructionSetsInstructionsetidRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1InstructionSetsInstructionsetidResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<BulkMultiStatusResponse>::json_with_diagnostics(
req,
)
.await?;
return Ok(GetGwApiV1InstructionSetsInstructionsetidResponse::Ok(data));
}
if status == http::StatusCode::NOT_FOUND {
let _ = req.bytes().await?;
return Ok(GetGwApiV1InstructionSetsInstructionsetidResponse::NotFound);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1InstructionSetsInstructionsetidResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1InstructionSetsInstructionsetidResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, oas3_gen_support::Default)]
pub struct GetGwApiV1InstructionSetsInstructionsetidRequestPath {
/// The target instruction set id.
/// - Example: `-1_988_905_739i32`
pub instruction_set_id: i32,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetGwApiV1InstructionSetsInstructionsetidRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
}
/// Response types for get_gw_api_v1_instruction_sets_instructionsetid
#[derive(Debug, Clone)]
pub enum GetGwApiV1InstructionSetsInstructionsetidResponse {
///200: Returns the status multiple instructions.
Ok(BulkMultiStatusResponse),
///404: Returns a Problem detail instance representing a not found request.
NotFound,
///500: Unable to process request due to an Internal Error. Please try again later.
InternalServerError,
///default: Unknown response
Unknown,
}
/// Retrieve status of request by instructionId<br><br>**Scope**: `instructions.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1InstructionsInstructionidRequest {
pub path: GetGwApiV1InstructionsInstructionidRequestPath,
pub query: GetGwApiV1InstructionsInstructionidRequestQuery,
}
impl GetGwApiV1InstructionsInstructionidRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1InstructionsInstructionidResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Instruction200Response>::json_with_diagnostics(req)
.await?;
return Ok(GetGwApiV1InstructionsInstructionidResponse::Ok(data));
}
if status == http::StatusCode::NOT_FOUND {
let _ = req.bytes().await?;
return Ok(GetGwApiV1InstructionsInstructionidResponse::NotFound);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1InstructionsInstructionidResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1InstructionsInstructionidResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, oas3_gen_support::Default)]
pub struct GetGwApiV1InstructionsInstructionidRequestPath {
/// The target instruction id.
/// - Example: `-1_988_905_739i32`
pub instruction_id: i32,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetGwApiV1InstructionsInstructionidRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
}
/// Response types for get_gw_api_v1_instructions_instructionid
#[derive(Debug, Clone)]
pub enum GetGwApiV1InstructionsInstructionidResponse {
///200: Returns the status of an instruction.
Ok(Instruction200Response),
///404: Returns a Problem detail instance representing a not found request.
NotFound,
///500: Unable to process request due to an Internal Error. Please try again later.
InternalServerError,
///default: Unknown response
Unknown,
}
/// Get list of banks which support banking connection with Interactive Brokers.<br><br>**Scope**: `enumerations.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1ParticipatingBanksRequest {
#[validate(nested)]
pub query: GetGwApiV1ParticipatingBanksRequestQuery,
}
impl GetGwApiV1ParticipatingBanksRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1ParticipatingBanksResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<
GetParticipatingListResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(GetGwApiV1ParticipatingBanksResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetGwApiV1ParticipatingBanksResponse::BadRequest);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1ParticipatingBanksResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1ParticipatingBanksResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1ParticipatingBanksRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
/// Parameter for which the list of participating banks is fetched
#[serde(rename = "type")]
#[validate(length(min = 1u64))]
pub r#type: String,
}
/// Response types for get_gw_api_v1_participating_banks
#[derive(Debug, Clone)]
pub enum GetGwApiV1ParticipatingBanksResponse {
///200: Returns the list of participating banks.
Ok(GetParticipatingListResponse),
///400: Returns a Problem detail instance representing a not found request.
BadRequest,
///500: Unable to process request due to an Internal Error. Please try again later.
InternalServerError,
///default: Unknown response
Unknown,
}
/// Fetch Requests' Details By Timeframe<br><br>**Scope**: `accounts.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1RequestsRequest {
pub query: GetGwApiV1RequestsRequestQuery,
}
impl GetGwApiV1RequestsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1RequestsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<RequestDetailsResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetGwApiV1RequestsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetGwApiV1RequestsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1RequestsResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(GetGwApiV1RequestsResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(GetGwApiV1RequestsResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1RequestsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1RequestsResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetGwApiV1RequestsRequestQuery {
#[serde(rename = "requestDetails")]
pub request_details: serde_json::Value,
}
/// Response types for get_gw_api_v1_requests
#[derive(Debug, Clone)]
pub enum GetGwApiV1RequestsResponse {
///200: Fetch Requests' Details By Timeframe
Ok(RequestDetailsResponse),
///400: Returns error description representing bad request
BadRequest,
///401: Returns error description representing access issue
Unauthorized,
///403: Returns error description representing access issue
Forbidden,
///415: Unsupported Media Type
UnsupportedMediaType,
///500: Returns error description representing internal server error
InternalServerError,
///default: Unknown response
Unknown,
}
/// <br>**Scope**: `statements.read` OR `reports.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1StatementsAvailableRequest {
#[validate(nested)]
pub query: GetGwApiV1StatementsAvailableRequestQuery,
#[validate(nested)]
pub header: GetGwApiV1StatementsAvailableRequestHeader,
}
impl GetGwApiV1StatementsAvailableRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1StatementsAvailableResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<
GetAvailableStmtDatesResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(GetGwApiV1StatementsAvailableResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetGwApiV1StatementsAvailableResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1StatementsAvailableResponse::Unauthorized);
}
if status == http::StatusCode::PAYMENT_REQUIRED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1StatementsAvailableResponse::PaymentRequired);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(GetGwApiV1StatementsAvailableResponse::Forbidden);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1StatementsAvailableResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1StatementsAvailableResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1StatementsAvailableRequestHeader {
/// Specifies the authorization header value (e.g., Bearer eyJ0eXAiOiJKV1...).
/// - Example: `"Bearer eyJ0eXAiOiJKV1...".to_string()`
#[validate(length(min = 1u64))]
pub authorization: String,
}
impl core::convert::TryFrom<&GetGwApiV1StatementsAvailableRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(
headers: &GetGwApiV1StatementsAvailableRequestHeader,
) -> core::result::Result<Self, Self::Error> {
let mut map = http::HeaderMap::with_capacity(1usize);
let header_value = http::HeaderValue::try_from(&headers.authorization)?;
map.insert(AUTHORIZATION, header_value);
Ok(map)
}
}
impl core::convert::TryFrom<GetGwApiV1StatementsAvailableRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(
headers: GetGwApiV1StatementsAvailableRequestHeader,
) -> core::result::Result<Self, Self::Error> {
http::HeaderMap::try_from(&headers)
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1StatementsAvailableRequestQuery {
/// Specifies the account id to retrieve information
/// - Example: `"UXXXX".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for get_gw_api_v1_statements_available
#[derive(Debug, Clone)]
pub enum GetGwApiV1StatementsAvailableResponse {
///200: Returns a JSON object containing the available report dates.
Ok(GetAvailableStmtDatesResponse),
///400: Returns a Problem detail instance representing a bad request.
BadRequest,
///401: Returns a Problem detail instance representing an unauthorized request.
Unauthorized,
///402: Returns a Problem detail instance representing an unauthorized request.
PaymentRequired,
///403: Returns a Problem detail instance representing a forbidden request.
Forbidden,
///500: Returns a Problem detail instance representing an internal server error.
InternalServerError,
///default: Unknown response
Unknown,
}
/// <br>**Scope**: `statements.read` OR `reports.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1TaxDocumentsAvailableRequest {
#[validate(nested)]
pub query: GetGwApiV1TaxDocumentsAvailableRequestQuery,
#[validate(nested)]
pub header: GetGwApiV1TaxDocumentsAvailableRequestHeader,
}
impl GetGwApiV1TaxDocumentsAvailableRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1TaxDocumentsAvailableResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<
GetAvailableTaxFormsResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(GetGwApiV1TaxDocumentsAvailableResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetGwApiV1TaxDocumentsAvailableResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1TaxDocumentsAvailableResponse::Unauthorized);
}
if status == http::StatusCode::PAYMENT_REQUIRED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1TaxDocumentsAvailableResponse::PaymentRequired);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(GetGwApiV1TaxDocumentsAvailableResponse::Forbidden);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1TaxDocumentsAvailableResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1TaxDocumentsAvailableResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1TaxDocumentsAvailableRequestHeader {
/// Specifies the authorization header value (e.g., Bearer eyJ0eXAiOiJKV1...).
/// - Example: `"Bearer eyJ0eXAiOiJKV1...".to_string()`
#[validate(length(min = 1u64))]
pub authorization: String,
}
impl core::convert::TryFrom<&GetGwApiV1TaxDocumentsAvailableRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(
headers: &GetGwApiV1TaxDocumentsAvailableRequestHeader,
) -> core::result::Result<Self, Self::Error> {
let mut map = http::HeaderMap::with_capacity(1usize);
let header_value = http::HeaderValue::try_from(&headers.authorization)?;
map.insert(AUTHORIZATION, header_value);
Ok(map)
}
}
impl core::convert::TryFrom<GetGwApiV1TaxDocumentsAvailableRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(
headers: GetGwApiV1TaxDocumentsAvailableRequestHeader,
) -> core::result::Result<Self, Self::Error> {
http::HeaderMap::try_from(&headers)
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1TaxDocumentsAvailableRequestQuery {
/// Specifies the account id to retrieve information
/// - Example: `"UXXXX".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64))]
pub account_id: String,
/// Specifies the tax year to retrieve information
/// - Example: `2_024i32`
pub year: i32,
}
/// Response types for get_gw_api_v1_tax_documents_available
#[derive(Debug, Clone)]
pub enum GetGwApiV1TaxDocumentsAvailableResponse {
///200: Returns a JSON object containing the available report dates.
Ok(GetAvailableTaxFormsResponse),
///400: Returns a Problem detail instance representing a bad request.
BadRequest,
///401: Returns a Problem detail instance representing an unauthorized request.
Unauthorized,
///402: Returns a Problem detail instance representing an unauthorized request.
PaymentRequired,
///403: Returns a Problem detail instance representing a forbidden request.
Forbidden,
///500: Returns a Problem detail instance representing an internal server error.
InternalServerError,
///default: Unknown response
Unknown,
}
/// <br>**Scope**: `statements.read` OR `reports.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1TradeConfirmationsAvailableRequest {
#[validate(nested)]
pub query: GetGwApiV1TradeConfirmationsAvailableRequestQuery,
#[validate(nested)]
pub header: GetGwApiV1TradeConfirmationsAvailableRequestHeader,
}
impl GetGwApiV1TradeConfirmationsAvailableRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1TradeConfirmationsAvailableResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<
GetAvailableTradeConfirmationDatesResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(GetGwApiV1TradeConfirmationsAvailableResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetGwApiV1TradeConfirmationsAvailableResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1TradeConfirmationsAvailableResponse::Unauthorized);
}
if status == http::StatusCode::PAYMENT_REQUIRED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1TradeConfirmationsAvailableResponse::PaymentRequired);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(GetGwApiV1TradeConfirmationsAvailableResponse::Forbidden);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1TradeConfirmationsAvailableResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1TradeConfirmationsAvailableResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1TradeConfirmationsAvailableRequestHeader {
/// Specifies the authorization header value (e.g., Bearer eyJ0eXAiOiJKV1...).
/// - Example: `"Bearer eyJ0eXAiOiJKV1...".to_string()`
#[validate(length(min = 1u64))]
pub authorization: String,
}
impl core::convert::TryFrom<&GetGwApiV1TradeConfirmationsAvailableRequestHeader>
for http::HeaderMap
{
type Error = http::header::InvalidHeaderValue;
fn try_from(
headers: &GetGwApiV1TradeConfirmationsAvailableRequestHeader,
) -> core::result::Result<Self, Self::Error> {
let mut map = http::HeaderMap::with_capacity(1usize);
let header_value = http::HeaderValue::try_from(&headers.authorization)?;
map.insert(AUTHORIZATION, header_value);
Ok(map)
}
}
impl core::convert::TryFrom<GetGwApiV1TradeConfirmationsAvailableRequestHeader>
for http::HeaderMap
{
type Error = http::header::InvalidHeaderValue;
fn try_from(
headers: GetGwApiV1TradeConfirmationsAvailableRequestHeader,
) -> core::result::Result<Self, Self::Error> {
http::HeaderMap::try_from(&headers)
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1TradeConfirmationsAvailableRequestQuery {
/// Specifies the account id to retrieve information
/// - Example: `"UXXXX".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for get_gw_api_v1_trade_confirmations_available
#[derive(Debug, Clone)]
pub enum GetGwApiV1TradeConfirmationsAvailableResponse {
///200: Returns a JSON object containing the available user-traded dates.
Ok(GetAvailableTradeConfirmationDatesResponse),
///400: Returns a Problem detail instance representing a bad request.
BadRequest,
///401: Returns a Problem detail instance representing an unauthorized request.
Unauthorized,
///402: Returns a Problem detail instance representing an unauthorized request.
PaymentRequired,
///403: Returns a Problem detail instance representing a forbidden request.
Forbidden,
///500: Returns a Problem detail instance representing an internal server error.
InternalServerError,
///default: Unknown response
Unknown,
}
/// Verify whether user is valid and available<br><br>**Scope**: `accounts.read` OR `validations.read`<br>**Security Policy**: `HTTPS`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1ValidationsUsernamesUsernameRequest {
#[validate(nested)]
pub path: GetGwApiV1ValidationsUsernamesUsernameRequestPath,
}
impl GetGwApiV1ValidationsUsernamesUsernameRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1ValidationsUsernamesUsernameResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<UserNameAvailableResponse>::json_with_diagnostics(
req,
)
.await?;
return Ok(GetGwApiV1ValidationsUsernamesUsernameResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetGwApiV1ValidationsUsernamesUsernameResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1ValidationsUsernamesUsernameResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(GetGwApiV1ValidationsUsernamesUsernameResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(GetGwApiV1ValidationsUsernamesUsernameResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1ValidationsUsernamesUsernameResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1ValidationsUsernamesUsernameResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetGwApiV1ValidationsUsernamesUsernameRequestPath {
#[validate(length(min = 1u64))]
pub username: String,
}
/// Response types for get_gw_api_v1_validations_usernames_username
#[derive(Debug, Clone)]
pub enum GetGwApiV1ValidationsUsernamesUsernameResponse {
///200: Verify whether user is valid and available
Ok(UserNameAvailableResponse),
///400: Returns error description representing bad request
BadRequest,
///401: Returns error description representing access issue
Unauthorized,
///403: Returns error description representing access issue
Forbidden,
///415: Unsupported Media Type
UnsupportedMediaType,
///500: Returns error description representing internal server error
InternalServerError,
///default: Unknown response
Unknown,
}
/// Requests full contract details and trading rules for the given conid. A follow-up request will provide additional trading rules.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetInfoAndRulesRequest {
#[validate(nested)]
pub path: GetInfoAndRulesRequestPath,
}
impl GetInfoAndRulesRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetInfoAndRulesResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<Rule200Response>::json_with_diagnostics(req)
.await?;
return Ok(GetInfoAndRulesResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetInfoAndRulesResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetInfoAndRulesResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetInfoAndRulesResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetInfoAndRulesResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetInfoAndRulesRequestPath {
/// Contract identifier for the requested contract of interest.
/// - Example: `"265598".to_string()`
#[validate(length(min = 1u64))]
pub conid: String,
}
/// Response types for getInfoAndRules
#[derive(Debug, Clone)]
pub enum GetInfoAndRulesResponse {
///200: Returns all contract information and trading rules for the contract.
Ok(Rule200Response),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns a list of security definitions for the given conids.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetInstrumentDefinitionRequest {
#[validate(nested)]
pub query: GetInstrumentDefinitionRequestQuery,
}
impl GetInstrumentDefinitionRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetInstrumentDefinitionResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<TrsrvSecDefResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetInstrumentDefinitionResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetInstrumentDefinitionResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetInstrumentDefinitionResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetInstrumentDefinitionResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetInstrumentDefinitionResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetInstrumentDefinitionResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetInstrumentDefinitionRequestQuery {
/// A comma separated series of contract IDs.
/// - Example: `"265598,8314".to_string()`
#[validate(length(min = 1u64))]
pub conids: String,
}
/// Response types for getInstrumentDefinition
#[derive(Debug, Clone)]
pub enum GetInstrumentDefinitionResponse {
///200: Successful response containing a contract's security definition.
Ok(TrsrvSecDefResponse),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Requests full contract details for the given conid.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetInstrumentInfoRequest {
#[validate(nested)]
pub path: GetInstrumentInfoRequestPath,
}
impl GetInstrumentInfoRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetInstrumentInfoResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<ContractInfo>::json_with_diagnostics(req).await?;
return Ok(GetInstrumentInfoResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetInstrumentInfoResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetInstrumentInfoResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetInstrumentInfoResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetInstrumentInfoResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetInstrumentInfoRequestPath {
/// Contract identifier for the requested contract of interest.
/// - Example: `"265598".to_string()`
#[validate(length(min = 1u64))]
pub conid: String,
}
/// Response types for getInstrumentInfo
#[derive(Debug, Clone)]
pub enum GetInstrumentInfoResponse {
///200: Returns detailed information for the passed contract.
Ok(ContractInfo),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Request the list of all accounts already invested in the provided model and a summary of their investment.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetInvestedAccountsInModelRequest {
pub body: PositionRequestBody,
}
impl GetInvestedAccountsInModelRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetInvestedAccountsInModelResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<GetInvestedAccountsSummary>::json_with_diagnostics(
req,
)
.await?;
return Ok(GetInvestedAccountsInModelResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetInvestedAccountsInModelResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetInvestedAccountsInModelResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetInvestedAccountsInModelResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetInvestedAccountsInModelResponse::Unknown);
}
}
/// Response types for getInvestedAccountsInModel
#[derive(Debug, Clone)]
pub enum GetInvestedAccountsInModelResponse {
///200: Successfully retrieve preset details
Ok(GetInvestedAccountsSummary),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct GetInvestedAccountsSummary {
/// Array of account details with net liquidation values and currency information
#[serde(rename = "accountList")]
pub account_list: Option<Vec<GetInvestedAccountsSummaryAccountList>>,
/// Base currency for the master account (ISO 4217 currency code)
#[serde(rename = "baseCcyMaster")]
pub base_ccy_master: Option<String>,
/// Precision for the master account base currency (decimal places)
#[serde(rename = "baseCcyMasterPrecision")]
pub base_ccy_master_precision: Option<String>,
/// Model portfolio identifier associated with this account list
pub model: Option<String>,
/// Unique request identifier for tracking API calls
#[serde(rename = "reqID")]
pub req_id: Option<i32>,
/// Market data subscription status (1 = active, 0 = inactive)
#[serde(rename = "subscriptionStatus")]
pub subscription_status: Option<AlertActivationRequestAlertActive>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct GetInvestedAccountsSummaryAccountList {
/// Account identifier (account number)
pub account: Option<String>,
/// Net liquidation value for positions in the current model portfolio
#[serde(rename = "accountModelNlv")]
pub account_model_nlv: Option<String>,
/// Net liquidation value for positions in other model portfolios
#[serde(rename = "accountOtherModelsNlv")]
pub account_other_models_nlv: Option<String>,
/// User-defined alias for the account (empty string if not set)
pub alias: Option<String>,
/// Base currency for this account (ISO 4217 currency code)
#[serde(rename = "baseCcyAccount")]
pub base_ccy_account: Option<String>,
/// Precision for the account base currency (decimal places)
#[serde(rename = "baseCcyAccountPrecision")]
pub base_ccy_account_precision: Option<String>,
/// Individual cash net liquidation value in base currency
#[serde(rename = "cashInIndependentNlv")]
pub cash_in_independent_nlv: Option<String>,
/// Exchange rate from account base currency to master base currency
#[serde(rename = "exchangeRate")]
pub exchange_rate: Option<f64>,
/// Total net liquidation value (cash + positions) in base currency
pub nlv: Option<String>,
/// Individual position net liquidation value in base currency
#[serde(rename = "positionsInIndependentNlv")]
pub positions_in_independent_nlv: Option<String>,
}
/// Used in tiered account structures (such as Financial Advisor and IBroker Accounts) to return a list of sub-accounts, paginated up to 20 accounts per page, for which the user can view position and account-related information. This endpoint must be called prior to calling other /portfolio endpoints for those sub-accounts. If you have less than 100 sub-accounts use /portfolio/subaccounts. To query a list of accounts the user can trade, see /iserver/accounts.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetManySubaccountsRequest {
pub query: GetManySubaccountsRequestQuery,
}
impl GetManySubaccountsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetManySubaccountsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Subaccounts2Response>::json_with_diagnostics(req)
.await?;
return Ok(GetManySubaccountsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetManySubaccountsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetManySubaccountsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetManySubaccountsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetManySubaccountsResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetManySubaccountsRequestQuery {
/// accountId
/// - Example: `Some("DU123456".to_string())`
#[serde(rename = "accountId")]
pub account_id: Option<String>,
/// Set if request should be made without caching.
#[default(Some(false))]
pub nocache: Option<bool>,
}
/// Response types for getManySubaccounts
#[derive(Debug, Clone)]
pub enum GetManySubaccountsResponse {
///200: response with subaccount definitions
Ok(Subaccounts2Response),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns a summary of an account's margin, in total and by account segment.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetMarginSummaryRequest {
#[validate(nested)]
pub path: GetMarginSummaryRequestPath,
}
impl GetMarginSummaryRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetMarginSummaryResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<
SummaryOfAccountMarginResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(GetMarginSummaryResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetMarginSummaryResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetMarginSummaryResponse::Unauthorized);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetMarginSummaryResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetMarginSummaryResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetMarginSummaryRequestPath {
/// Pass the account identifier to receive information for.
/// - Example: `"U1234567".to_string()`
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for getMarginSummary
#[derive(Debug, Clone)]
pub enum GetMarginSummaryResponse {
///200: Indicates a success request to receive margin balance values.
Ok(SummaryOfAccountMarginResponse),
///400: bad request; passed input cannot pass initial validation and detected right away
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Request historical data for an instrument in the form of OHLC bars.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetMdHistoryRequest {
#[validate(nested)]
pub query: GetMdHistoryRequestQuery,
}
impl GetMdHistoryRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetMdHistoryResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<History200Response>::json_with_diagnostics(req)
.await?;
return Ok(GetMdHistoryResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetMdHistoryResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetMdHistoryResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetMdHistoryResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetMdHistoryResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetMdHistoryResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetMdHistoryRequestQuery {
/// IB contract ID of the requested instrument.
/// - Example: `265_598i32`
pub conid: i32,
/// A time duration away from startTime into the future to be divided into bars of the specified width. Supported Period Sizes
/// * `min` - Minutes
/// * `h` - Hour(s)
/// * `d` - Day(s)
/// * `w` - Week(s)
/// * `m` - Month(s)
/// * `y` - Year(s)
/// - Example: `"6d".to_string()`
#[validate(length(min = 1u64))]
#[default("1d".to_string())]
pub period: String,
/// The width of the bars into which the interval determined by period and startTime will be divided. It is not required that bar evenly divide period; partial bars can be returned. Supported Bar Sizes
/// * `S` - Second(s)
/// * `min` - Minute(s)
/// * `h` - Hour(s)
/// * `d` - Day(s)
/// * `w` - Week(s)
/// * `m` - Month(s)
/// - Example: `"5min".to_string()`
#[validate(length(min = 1u64))]
#[default("1min".to_string())]
pub bar: String,
/// Exchange (or SMART) from which data is requested.
/// - Example: `Some("NASDAQ".to_string())`
pub exchange: Option<String>,
/// Indicates whether data outside of regular trading hours should be included in response.
#[serde(rename = "outsideRth")]
#[default(Some(false))]
pub outside_rth: Option<bool>,
/// A fixed UTC date-time reference point for the historical data request, from which the specified period extends. Format is YYYYMMDD-hh:mm:ss. If omitted, the current time is used, and direction must be omitted or 1.
/// - Example: `Some("20231018-16:00:00".to_string())`
#[serde(rename = "startTime")]
pub start_time: Option<String>,
/// Indicates whether data should begin or end at the start time.
/// * `-1` - Historical data will begin away from the start time, ending at the current time/startTime.
/// * `1` - Historical data begins at the start time, moving towards the current time. Only supported when startTime is included.
#[default(Some(Default::default()))]
pub direction: Option<GetMdHistoryRequestQueryDirection>,
/// The type of data to be returned in the historical bars. Supported Bar Sizes
/// * `Bid_Ask` - The OHLC bid/ask values.
/// * `Last` - The OHLC trade values.
/// * `Midpoint` - The OHLC of the Bid-Ask midpoint.
/// - Example: `Some("Midpoint".to_string())`
#[default(Some("Last".to_string()))]
pub source: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum GetMdHistoryRequestQueryDirection {
#[serde(rename = "-1")]
#[default]
Value_1,
#[serde(rename = "1")]
Value1,
}
impl core::fmt::Display for GetMdHistoryRequestQueryDirection {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Value_1 => write!(f, "-1"),
Self::Value1 => write!(f, "1"),
}
}
}
/// Response types for getMdHistory
#[derive(Debug, Clone)]
pub enum GetMdHistoryResponse {
///200: Historical data query successfully returned data.
Ok(History200Response),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Get Market Data for the given conid(s). A pre-flight request must be made prior to ever receiving data. For some fields, it may take more than a few moments to receive information. See response fields for a list of available fields that can be request via fields argument. The endpoint /iserver/accounts must be called prior to /iserver/marketdata/snapshot. For derivative contracts the endpoint /iserver/secdef/search must be called first.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetMdSnapshotRequest {
pub query: GetMdSnapshotRequestQuery,
}
impl GetMdSnapshotRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetMdSnapshotResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<IserverSnapshot>::json_with_diagnostics(req)
.await?;
return Ok(GetMdSnapshotResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetMdSnapshotResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetMdSnapshotResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetMdSnapshotResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetMdSnapshotResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetMdSnapshotResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetMdSnapshotRequestQuery {
/// Contract identifier for the contract of interest. May provide a comma-separated series of contract identifiers.
/// - Example: `265_598i32`
pub conids: i32,
/// Many FYI endpoints reference a "typecode" value. The table below lists the available codes and what they correspond to.
/// * `31` - Last Price. The last price at which the contract traded. May contain one of the following prefixes: C - Previous day's closing price. H - Trading has halted.
/// * `55` - Symbol.
/// * `58` - Text.
/// * `70` - High. Current day high price
/// * `71` - Low. Current day low price
/// * `73` - Market Value. The current market value of your position in the security. Market Value is calculated with real time market data (even when not subscribed to market data).
/// * `74` - Avg Price. The average price of the position.
/// * `75` - Unrealized PnL. Unrealized profit or loss. Unrealized PnL is calculated with real time market data (even when not subscribed to market data).
/// * `76` - Formatted position.
/// * `77` - Formatted Unrealized PnL.
/// * `78` - Daily PnL. Your profit or loss of the day since prior close. Daily PnL is calculated with real time market data (even when not subscribed to market data).
/// * `79` - Realized PnL. Realized profit or loss. Realized PnL is calculated with real time market data (even when not subscribed to market data).
/// * `80` - Unrealized PnL %. Unrealized profit or loss expressed in percentage.
/// * `82` - Change. The difference between the last price and the close on the previous trading day
/// * `83` - Change %. The difference between the last price and the close on the previous trading day in percentage.
/// * `84` - Bid Price. The highest-priced bid on the contract.
/// * `85` - Ask Size. The number of contracts or shares offered at the ask price. For US stocks
/// * `86` - Ask Price. The lowest-priced offer on the contract.
/// * `87` - Volume. Volume for the day
/// * `88` - Bid Size. The number of contracts or shares bid for at the bid price. For US stocks
/// * `201` - Right. Declares the Right of the Option, Call or Put.
/// * `6004` - Exchange.
/// * `6008` - Conid. Contract identifier from IBKR's database.
/// * `6070` - SecType. The asset class of the instrument.
/// * `6072` - Months.
/// * `6073` - Regular Expiry.
/// * `6119` - Marker for market data delivery method (similar to request id).
/// * `6457` - Underlying Conid. Use /trsrv/secdef to get more information about the security.
/// * `6508` - Service Params..
/// * `6509` - Market Data Availability. The field may contain three chars. First char defines: R = RealTime, D = Delayed, Z = Frozen, Y = Frozen Delayed, N = Not Subscribed, i - incomplete, v - VDR Exempt (Vendor Display Rule 603c). Second char defines: P = Snapshot, p = Consolidated. Third char defines: B = Book. RealTime Data is relayed back in real time without delay, market data subscription(s) are required. Delayed - Data is relayed back 15-20 min delayed. Frozen - Last recorded data at market close. relayed back in real time. Frozen Delayed - Last recorded data at market close, relayed back delayed. Not Subscribed - User does not have the required market data subscription(s) to relay back either real time or delayed data. Snapshot - Snapshot request is available for contract. Consolidated - Market data is aggregated across multiple exchanges or venues. Book - Top of the book data is available for contract.
/// * `7051` - Company name.
/// * `7057` - Ask Exch. Displays the exchange(s) offering the SMART price. A=AMEX, C=CBOE, I=ISE, X=PHLX, N=PSE, B=BOX, Q=NASDAQOM, Z=BATS, W=CBOE2, T=NASDAQBX, M=MIAX, H=GEMINI, E=EDGX, J=MERCURY
/// * `7058` - Last Exch. Displays the exchange(s) offering the SMART price. A=AMEX, C=CBOE, I=ISE, X=PHLX, N=PSE, B=BOX, Q=NASDAQOM, Z=BATS, W=CBOE2, T=NASDAQBX, M=MIAX, H=GEMINI, E=EDGX, J=MERCURY
/// * `7059` - Last Size. The number of unites traded at the last price
/// * `7068` - Bid Exch. Displays the exchange(s) offering the SMART price. A=AMEX, C=CBOE, I=ISE, X=PHLX, N=PSE, B=BOX, Q=NASDAQOM, Z=BATS, W=CBOE2, T=NASDAQBX, M=MIAX, H=GEMINI, E=EDGX, J=MERCURY
/// * `7084` - Implied Vol./Hist. Vol %. The ratio of the implied volatility over the historical volatility, expressed as a percentage.
/// * `7085` - Put/Call Interest. Put option open interest/call option open interest for the trading day.
/// * `7086` - Put/Call Volume. Put option volume/call option volume for the trading day.
/// * `7087` - Hist. Vol. %. 30-day real-time historical volatility.
/// * `7088` - Hist. Vol. Close %. Shows the historical volatility based on previous close price.
/// * `7089` - Opt. Volume. Option Volume
/// * `7094` - Conid + Exchange.
/// * `7184` - canBeTraded. If contract is a trade-able instrument. Returns 1(true) or 0(false).
/// * `7219` - Contract Description.
/// * `7220` - Contract Description.
/// * `7221` - Listing Exchange.
/// * `7280` - Industry. Displays the type of industry under which the underlying company can be categorized.
/// * `7281` - Category. Displays a more detailed level of description within the industry under which the underlying company can be categorized.
/// * `7282` - Average Volume. The average daily trading volume over 90 days.
/// * `7283` - Option Implied Vol. %. A prediction of how volatile an underlying will be in the future.At the market volatility estimated for a maturity thirty calendar days forward of the current trading day, and based on option prices from two consecutive expiration months. To query the Implied Vol. % of a specific strike refer to field 7633.
/// * `7284` - Historical volatility %. Deprecated
/// * `7285` - Put/Call Ratio.
/// * `7292` - Cost Basis. Your current position in this security multiplied by the average price and multiplier.
/// * `7293` - 52 Week High. The highest price for the past 52 weeks.
/// * `7294` - 52 Week Low. The lowest price for the past 52 weeks.
/// * `7295` - Open. Today's opening price.
/// * `7296` - Close. Today's closing price.
/// * `7308` - Delta. The ratio of the change in the price of the option to the corresponding change in the price of the underlying.
/// * `7309` - Gamma. The rate of change for the delta with respect to the underlying asset's price.
/// * `7310` - Theta. A measure of the rate of decline the value of an option due to the passage of time.
/// * `7311` - Vega. The amount that the price of an option changes compared to a 1% change in the volatility.
/// * `7607` - Opt. Volume Change %. Today's option volume as a percentage of the average option volume.
/// * `7633` - Implied Vol. %. The implied volatility for the specific strike of the option in percentage. To query the Option Implied Vol. % from the underlying refer to field 7283.
/// * `7635` - Mark. The mark price is
/// * `7636` - Shortable Shares. Number of shares available for shorting.
/// * `7637` - Fee Rate. Interest rate charged on borrowed shares.
/// * `7638` - Option Open Interest.
/// * `7639` - % of Mark Value. Displays the market value of the contract as a percentage of the total market value of the account. Mark Value is calculated with real time market data (even when not subscribed to market data).
/// * `7644` - Shortable. Describes the level of difficulty with which the security can be sold short.
/// * `7671` - Dividends. This value is the total of the expected dividend payments over the next twelve months per share.
/// * `7672` - Dividends TTM. This value is the total of the expected dividend payments over the last twelve months per share.
/// * `7674` - EMA(200). Exponential moving average (N=200).
/// * `7675` - EMA(100). Exponential moving average (N=100).
/// * `7676` - EMA(50). Exponential moving average (N=50).
/// * `7677` - EMA(20). Exponential moving average (N=20).
/// * `7678` - Price/EMA(200). Price to Exponential moving average (N=200) ratio -1
/// * `7679` - Price/EMA(100). Price to Exponential moving average (N=100) ratio -1
/// * `7724` - Price/EMA(50). Price to Exponential moving average (N=50) ratio -1
/// * `7681` - Price/EMA(20). Price to Exponential moving average (N=20) ratio -1
/// * `7682` - Change Since Open. The difference between the last price and the open price.
/// * `7683` - Upcoming Event. Shows the next major company event. Requires Wall Street Horizon subscription.
/// * `7684` - Upcoming Event Date. The date of the next major company event. Requires Wall Street Horizon subscription.
/// * `7685` - Upcoming Analyst Meeting. The date and time of the next scheduled analyst meeting. Requires Wall Street Horizon subscription.
/// * `7686` - Upcoming Earnings. The date and time of the next scheduled earnings/earnings call event. Requires Wall Street Horizon subscription.
/// * `7687` - Upcoming Misc Event. The date and time of the next shareholder meeting
/// * `7688` - Recent Analyst Meeting. The date and time of the most recent analyst meeting. Requires Wall Street Horizon subscription.
/// * `7689` - Recent Earnings. The date and time of the most recent earnings/earning call event. Requires Wall Street Horizon subscription.
/// * `7690` - Recent Misc Event. The date and time of the most recent shareholder meeting
/// * `7694` - Probability of Max Return. Customer implied probability of maximum potential gain.
/// * `7695` - Break Even. Break even points
/// * `7696` - SPX Delta. Beta Weighted Delta is calculated using the formula; Delta x dollar adjusted beta
/// * `7697` - Futures Open Interest. Total number of outstanding futures contracts
/// * `7698` - Last Yield. Implied yield of the bond if it is purchased at the current last price. Last yield is calculated using the Last price on all possible call dates. It is assumed that prepayment occurs if the bond has call or put provisions and the issuer can offer a lower coupon rate based on current market rates. The yield to worst will be the lowest of the yield to maturity or yield to call (if the bond has prepayment provisions). Yield to worse may be the same as yield to maturity but never higher.
/// * `7699` - Bid Yield. Implied yield of the bond if it is purchased at the current bid price. Bid yield is calculated using the Ask on all possible call dates. It is assumed that prepayment occurs if the bond has call or put provisions and the issuer can offer a lower coupon rate based on current market rates. The yield to worst will be the lowest of the yield to maturity or yield to call (if the bond has prepayment provisions). Yield to worse may be the same as yield to maturity but never higher.
/// * `7700` - Probability of Max Return. Customer implied probability of maximum potential gain.
/// * `7702` - Probability of Max Loss. Customer implied probability of maximum potential loss.
/// * `7703` - Profit Probability. Customer implied probability of any gain.
/// * `7704` - Organization Type.
/// * `7705` - Debt Class.
/// * `7706` - Ratings. Ratings issued for bond contract.
/// * `7707` - Bond State Code.
/// * `7708` - Bond Type.
/// * `7714` - Last Trading Date.
/// * `7715` - Issue Date.
/// * `7720` - Ask Yield. Implied yield of the bond if it is purchased at the current offer. Ask yield is calculated using the Bid on all possible call dates. It is assumed that prepayment occurs if the bond has call or put provisions and the issuer can offer a lower coupon rate based on current market rates. The yield to worst will be the lowest of the yield to maturity or yield to call (if the bond has prepayment provisions). Yield to worse may be the same as yield to maturity but never higher.
/// * `7741` - Prior Close. Yesterday's closing price
/// * `7762` - Volume Long. High precision volume for the day. For formatted volume refer to field 87.
/// * `7768` - hasTradingPermissions. if user has trading permissions for specified contract. Returns 1(true) or 0(false).
/// * `7899` - Stock Type. Determines the stock type. Includes: Common, CORP, ADR, ETF, ETN, EFN, REIT, CEF, ETMF.
/// * `7920` - Daily PnL Raw. Your profit or loss of the day since prior close. Daily PnL is calculated with real-time market data (even when not subscribed to market data).
/// * `7921` - Cost Basis Raw. Your current position in this security multiplied by the average price and and multiplier.
/// * `7943` - Rebate Rate. Fed funds or other currency-relevant Benchmark rate minus the interest rate charged on borrowed shares.
pub fields: Option<MdFields>,
}
/// Response types for getMdSnapshot
#[derive(Debug, Clone)]
pub enum GetMdSnapshotResponse {
///200: Successfully requested market data
Ok(IserverSnapshot),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Get the preset behavior for model rebalancing.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetModelPresetsRequest {
pub body: ReqIDRequestBody,
}
impl GetModelPresetsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetModelPresetsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<ModelPresetsResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetModelPresetsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetModelPresetsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetModelPresetsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetModelPresetsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetModelPresetsResponse::Unknown);
}
}
/// Response types for getModelPresets
#[derive(Debug, Clone)]
pub enum GetModelPresetsResponse {
///200: Successfully retrieve preset details
Ok(ModelPresetsResponse),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Request a summary for a single model.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetModelSummarySingleRequest {
pub body: SummaryRequestBody,
}
impl GetModelSummarySingleRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetModelSummarySingleResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<ModelSummaryResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetModelSummarySingleResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetModelSummarySingleResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetModelSummarySingleResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetModelSummarySingleResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetModelSummarySingleResponse::Unknown);
}
}
/// Response types for getModelSummarySingle
#[derive(Debug, Clone)]
pub enum GetModelSummarySingleResponse {
///200: Successfully retrieve model summary.
Ok(ModelSummaryResponse),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Retrieve information about your MTA alert. Each login user only has one mobile trading assistant (MTA) alert with it's own unique tool id that cannot be changed. MTA alerts can not be created or deleted, only modified. When modified a new order Id is generated.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetMtaDetailsRequest {}
impl GetMtaDetailsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetMtaDetailsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<AlertDetails>::json_with_diagnostics(req).await?;
return Ok(GetMtaDetailsResponse::Ok(data));
}
let _ = req.bytes().await?;
return Ok(GetMtaDetailsResponse::Unknown);
}
}
/// Response types for getMtaDetails
#[derive(Debug, Clone)]
pub enum GetMtaDetailsResponse {
///200: The alert description for the unique MTA alert on the account.
Ok(AlertDetails),
///default: Unknown response
Unknown,
}
/// Returns open orders and filled or cancelled orders submitted during the current brokerage session.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetOpenOrdersRequest {
pub query: GetOpenOrdersRequestQuery,
}
impl GetOpenOrdersRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetOpenOrdersResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<LiveOrdersResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetOpenOrdersResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetOpenOrdersResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetOpenOrdersResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetOpenOrdersResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetOpenOrdersResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetOpenOrdersRequestQuery {
/// Filter results using a comma-separated list of Order Status values. Also accepts a value to sort results by time.
/// - Example: `Some("filled")`
pub filters: Option<GetOpenOrdersRequestQueryFilters>,
/// Instructs IB to clear cache of orders and obtain updated view from brokerage backend. Response will be an empty array.
pub force: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum GetOpenOrdersRequestQueryFilters {
#[serde(rename = "inactive")]
#[default]
Inactive,
#[serde(rename = "pending_submit")]
PendingSubmit,
#[serde(rename = "pre_submitted")]
PreSubmitted,
#[serde(rename = "submitted")]
Submitted,
#[serde(rename = "filled")]
Filled,
#[serde(rename = "pending_cancel")]
PendingCancel,
#[serde(rename = "cancelled")]
Cancelled,
#[serde(rename = "warn_state")]
WarnState,
#[serde(rename = "sort_by_time")]
SortByTime,
}
impl core::fmt::Display for GetOpenOrdersRequestQueryFilters {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Inactive => write!(f, "inactive"),
Self::PendingSubmit => write!(f, "pending_submit"),
Self::PreSubmitted => write!(f, "pre_submitted"),
Self::Submitted => write!(f, "submitted"),
Self::Filled => write!(f, "filled"),
Self::PendingCancel => write!(f, "pending_cancel"),
Self::Cancelled => write!(f, "cancelled"),
Self::WarnState => write!(f, "warn_state"),
Self::SortByTime => write!(f, "sort_by_time"),
}
}
}
/// Response types for getOpenOrders
#[derive(Debug, Clone)]
pub enum GetOpenOrdersResponse {
///200: Orders for a specific account
Ok(LiveOrdersResponse),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Retrieve the status of a single order. Only displays orders from the current brokerage session. If orders executed on a previous day or session, queries will 503 error.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetOrderStatusRequest {
pub path: GetOrderStatusRequestPath,
}
impl GetOrderStatusRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetOrderStatusResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let _ = req.bytes().await?;
return Ok(GetOrderStatusResponse::Ok);
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetOrderStatusResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetOrderStatusResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetOrderStatusResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetOrderStatusResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetOrderStatusResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, oas3_gen_support::Default)]
pub struct GetOrderStatusRequestPath {
/// The IB-assigned order ID of the desired order ticket.
/// - Example: `1_799_796_559i32`
pub order_id: i32,
}
/// Response types for getOrderStatus
#[derive(Debug, Clone)]
pub enum GetOrderStatusResponse {
///200: order status
Ok,
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Get all positions in an account.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetPaginatedPositionsRequest {
#[validate(nested)]
pub path: GetPaginatedPositionsRequestPath,
pub query: GetPaginatedPositionsRequestQuery,
}
impl GetPaginatedPositionsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetPaginatedPositionsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Position200Response2>::json_with_diagnostics(req)
.await?;
return Ok(GetPaginatedPositionsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetPaginatedPositionsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetPaginatedPositionsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetPaginatedPositionsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetPaginatedPositionsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetPaginatedPositionsResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetPaginatedPositionsRequestPath {
/// Account ID whose positions are requested.
/// - Example: `"DU123456".to_string()`
#[validate(length(min = 1u64))]
pub account_id: String,
/// Paginates positions response. Indexed from 0. Max 100 positions returned per page. Defaulted to 0.
/// - Example: `1i32`
pub page_id: i32,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetPaginatedPositionsRequestQuery {
/// Name of model
pub model: Option<serde_json::Value>,
/// sorting of result positions by specified field. Defaulted to "name" field.
/// - Example: `Some("name")`
pub sort: Option<serde_json::Value>,
/// Sorting direction. Possible values "a" - ascending, "d" - descending. Defaulted to "a"
/// - Example: `Some("a")`
pub direction: Option<serde_json::Value>,
/// Forcing to wait for all security definition to be received. If false, position may not have secDef portion
#[serde(rename = "waitForSecDef")]
pub wait_for_sec_def: Option<bool>,
}
/// Response types for getPaginatedPositions
#[derive(Debug, Clone)]
pub enum GetPaginatedPositionsResponse {
///200: positions
Ok(Position200Response2),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct GetParticipatingListResponse {
#[serde(rename = "participatingBanks")]
pub participating_banks: Vec<GetParticipatingListResponseParticipatingBank>,
/// - Example: `"eDDA".to_string()`
#[serde(rename = "type")]
pub r#type: String,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct GetParticipatingListResponseParticipatingBank {
/// - Example: `"WEDIHKHHXXX".to_string()`
#[serde(rename = "BIC")]
pub bic: String,
/// - Example: `"390".to_string()`
#[serde(rename = "clearingCode")]
pub clearing_code: String,
/// - Example: `"WELAB BANK LIMITED".to_string()`
#[serde(rename = "institutionName")]
pub institution_name: String,
}
/// Returns the performance (MTM) for the given accounts, if more than one account is passed, the result is consolidated.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetPerformanceAllPeriodsRequest {
pub query: GetPerformanceAllPeriodsRequestQuery,
pub body: AcctIdRequestBody3,
}
impl GetPerformanceAllPeriodsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetPerformanceAllPeriodsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<
DetailedContractInformation,
>::json_with_diagnostics(req)
.await?;
return Ok(GetPerformanceAllPeriodsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetPerformanceAllPeriodsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetPerformanceAllPeriodsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetPerformanceAllPeriodsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetPerformanceAllPeriodsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetPerformanceAllPeriodsResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetPerformanceAllPeriodsRequestQuery {
/// only one account. If defined, accounts passed in request body ignored
pub param: Option<String>,
}
/// Response types for getPerformanceAllPeriods
#[derive(Debug, Clone)]
pub enum GetPerformanceAllPeriodsResponse {
///200: An array of objects detailing contract information.
Ok(DetailedContractInformation),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns updated profit and loss values for the selected account. Initial request will return an empty array in the upnl object.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetPnlRequest {}
impl GetPnlRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetPnlResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<PnlPartitionedResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetPnlResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetPnlResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetPnlResponse::Unauthorized);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetPnlResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetPnlResponse::Unknown);
}
}
/// Response types for getPnl
#[derive(Debug, Clone)]
pub enum GetPnlResponse {
///200: Refers to "updated PnL". Holds a json object of key-value paired pnl details.
Ok(PnlPartitionedResponse),
///400: bad request; passed input cannot pass initial validation and detected right away
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Get the given account's ledger data detailing its balances by currency.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetPortfolioLedgerRequest {
#[validate(nested)]
pub path: GetPortfolioLedgerRequestPath,
}
impl GetPortfolioLedgerRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetPortfolioLedgerResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<Ledger>::json_with_diagnostics(req).await?;
return Ok(GetPortfolioLedgerResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetPortfolioLedgerResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetPortfolioLedgerResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetPortfolioLedgerResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetPortfolioLedgerResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetPortfolioLedgerRequestPath {
/// Account ID whose ledger data is requested.
/// - Example: `"DU123456".to_string()`
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for getPortfolioLedger
#[derive(Debug, Clone)]
pub enum GetPortfolioLedgerResponse {
///200: ledger
Ok(Ledger),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Get a single account's attributes and capabilities.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetPortfolioMetadataRequest {
#[validate(nested)]
pub path: GetPortfolioMetadataRequestPath,
}
impl GetPortfolioMetadataRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetPortfolioMetadataResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<AccountAttributes>::json_with_diagnostics(req)
.await?;
return Ok(GetPortfolioMetadataResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetPortfolioMetadataResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetPortfolioMetadataResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetPortfolioMetadataResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetPortfolioMetadataResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetPortfolioMetadataRequestPath {
/// Account ID whose attributes are requested.
/// - Example: `"DU123456".to_string()`
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for getPortfolioMetadata
#[derive(Debug, Clone)]
pub enum GetPortfolioMetadataResponse {
///200: An account's attributes
Ok(AccountAttributes),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns detailed summary of account values, by segment where appropriate.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetPortfolioSummaryRequest {
#[validate(nested)]
pub path: GetPortfolioSummaryRequestPath,
}
impl GetPortfolioSummaryRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetPortfolioSummaryResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<PortfolioSummary>::json_with_diagnostics(req)
.await?;
return Ok(GetPortfolioSummaryResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetPortfolioSummaryResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetPortfolioSummaryResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetPortfolioSummaryResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetPortfolioSummaryResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetPortfolioSummaryRequestPath {
/// accountId
/// - Example: `"DU123456".to_string()`
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for getPortfolioSummary
#[derive(Debug, Clone)]
pub enum GetPortfolioSummaryResponse {
///200: response with summary definitions
Ok(PortfolioSummary),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Get position for a given instrument in a single account.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetPositionByConidRequest {
#[validate(nested)]
pub path: GetPositionByConidRequestPath,
}
impl GetPositionByConidRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetPositionByConidResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<IndividualPositionArray>::json_with_diagnostics(
req,
)
.await?;
return Ok(GetPositionByConidResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetPositionByConidResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetPositionByConidResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetPositionByConidResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetPositionByConidResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetPositionByConidResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetPositionByConidRequestPath {
/// Account ID whose position in the given instrument is requested.
/// - Example: `"DU123456".to_string()`
#[validate(length(min = 1u64))]
pub accountid: String,
/// Conid of the instrument whose position in the account is requested.
/// - Example: `265_598i32`
pub conid: i32,
}
/// Response types for getPositionByConid
#[derive(Debug, Clone)]
pub enum GetPositionByConidResponse {
///200: Position details by conid
Ok(IndividualPositionArray),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns an xml file containing all available parameters to be sent for the Iserver scanner request.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetScannerParametersRequest {}
impl GetScannerParametersRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetScannerParametersResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<IserverScannerParams>::json_with_diagnostics(req)
.await?;
return Ok(GetScannerParametersResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetScannerParametersResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetScannerParametersResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetScannerParametersResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetScannerParametersResponse::Unknown);
}
}
/// Response types for getScannerParameters
#[derive(Debug, Clone)]
pub enum GetScannerParametersResponse {
///200: An array of objects detailing contract information.
Ok(IserverScannerParams),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Searches for contracts according to the filters specified in /iserver/scanner/params endpoint.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetScannerResultsRequest {
pub body: IserverScannerRunRequest,
}
impl GetScannerResultsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetScannerResultsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<IserverScannerRunResponse>::json_with_diagnostics(
req,
)
.await?;
return Ok(GetScannerResultsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetScannerResultsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetScannerResultsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetScannerResultsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetScannerResultsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetScannerResultsResponse::Unknown);
}
}
/// Response types for getScannerResults
#[derive(Debug, Clone)]
pub enum GetScannerResultsResponse {
///200: An array of objects detailing contract information.
Ok(IserverScannerRunResponse),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// If the gateway has not received any requests for several minutes an open session will automatically timeout. The tickle endpoint pings the server to prevent the session from ending. It is expected to call this endpoint approximately every 60 seconds to maintain the connection to the brokerage session.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetSessionTokenRequest {}
impl GetSessionTokenRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetSessionTokenResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<TickleResponse>::json_with_diagnostics(req).await?;
return Ok(GetSessionTokenResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetSessionTokenResponse::Unauthorized);
}
let _ = req.bytes().await?;
return Ok(GetSessionTokenResponse::Unknown);
}
}
/// Response types for getSessionToken
#[derive(Debug, Clone)]
pub enum GetSessionTokenResponse {
///200: An array of objects detailing contract information.
Ok(TickleResponse),
///401: Invalid or expired access token
Unauthorized,
///default: Unknown response
Unknown,
}
/// Validates the current session for the SSO user.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetSessionValidationRequest {}
impl GetSessionValidationRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetSessionValidationResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<SsoValidateResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetSessionValidationResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetSessionValidationResponse::Unauthorized);
}
let _ = req.bytes().await?;
return Ok(GetSessionValidationResponse::Unknown);
}
}
/// Response types for getSessionValidation
#[derive(Debug, Clone)]
pub enum GetSessionValidationResponse {
///200: An array of objects detailing contract information.
Ok(SsoValidateResponse),
///401: Invalid or expired access token
Unauthorized,
///default: Unknown response
Unknown,
}
/// Retrieves the configuration of a single account group. This describes the name of the allocation group, the specific accounts contained in the group, and the allocation method in use along with any relevant quantities. This endpoint is only supported for Financial Advisors and IBroker Accounts.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetSingleAllocationGroupRequest {
#[validate(nested)]
pub body: NameRequestBody,
}
impl GetSingleAllocationGroupRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetSingleAllocationGroupResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<AllocationGroup>::json_with_diagnostics(req)
.await?;
return Ok(GetSingleAllocationGroupResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetSingleAllocationGroupResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetSingleAllocationGroupResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetSingleAllocationGroupResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetSingleAllocationGroupResponse::Unknown);
}
}
/// Response types for getSingleAllocationGroup
#[derive(Debug, Clone)]
pub enum GetSingleAllocationGroupResponse {
///200: Returns details of the allocation group.
Ok(AllocationGroup),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns the performance (MTM) for the given accounts, if more than one account is passed, the result is consolidated.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetSinglePerformancePeriodRequest {
pub body: PerformanceRequestBody,
}
impl GetSinglePerformancePeriodRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetSinglePerformancePeriodResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<PerformanceResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetSinglePerformancePeriodResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetSinglePerformancePeriodResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetSinglePerformancePeriodResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetSinglePerformancePeriodResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetSinglePerformancePeriodResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetSinglePerformancePeriodResponse::Unknown);
}
}
/// Response types for getSinglePerformancePeriod
#[derive(Debug, Clone)]
pub enum GetSinglePerformancePeriodResponse {
///200: An array of objects detailing contract information.
Ok(PerformanceResponse),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Retrieve details of a single watchlist stored in the username's settings.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetSpecificWatchlistRequest {
#[validate(nested)]
pub query: GetSpecificWatchlistRequestQuery,
}
impl GetSpecificWatchlistRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetSpecificWatchlistResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<SingleWatchlist>::json_with_diagnostics(req)
.await?;
return Ok(GetSpecificWatchlistResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetSpecificWatchlistResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetSpecificWatchlistResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetSpecificWatchlistResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetSpecificWatchlistResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetSpecificWatchlistResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetSpecificWatchlistRequestQuery {
/// Watchlist ID of the requested watchlist.
/// - Example: `"1234".to_string()`
#[validate(length(min = 1u64))]
pub id: String,
}
/// Response types for getSpecificWatchlist
#[derive(Debug, Clone)]
pub enum GetSpecificWatchlistResponse {
///200: Successful deletion of specified watchlist.
Ok(SingleWatchlist),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct GetStatementsResponse {
pub data: Option<ResponseData>,
}
/// Returns an object contains all stock contracts for given symbol(s)
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetStockBySymbolRequest {
#[validate(nested)]
pub query: GetStockBySymbolRequestQuery,
}
impl GetStockBySymbolRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetStockBySymbolResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<Stocks>::json_with_diagnostics(req).await?;
return Ok(GetStockBySymbolResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetStockBySymbolResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetStockBySymbolResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetStockBySymbolResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetStockBySymbolResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetStockBySymbolResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetStockBySymbolRequestQuery {
/// Comma-separated list of stock symbols. Symbols must contain only capitalized letters.
/// - Example: `"AAPL,IBKR".to_string()`
#[validate(length(min = 1u64))]
pub symbols: String,
}
/// Response types for getStockBySymbol
#[derive(Debug, Clone)]
pub enum GetStockBySymbolResponse {
///200: Successful response containing a contract's security definition.
Ok(Stocks),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Retrieve a list of trades, up to a maximum of 7 days prior.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetTradeHistoryRequest {
pub query: GetTradeHistoryRequestQuery,
}
impl GetTradeHistoryRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetTradeHistoryResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<TradesResponse>::json_with_diagnostics(req).await?;
return Ok(GetTradeHistoryResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetTradeHistoryResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetTradeHistoryResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetTradeHistoryResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetTradeHistoryResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetTradeHistoryRequestQuery {
/// The number of prior days prior to include in response, up to a maximum of 7. If omitted, only the current day's executions will be returned.
/// - Example: `Some(3i32)`
pub days: Option<i32>,
}
/// Response types for getTradeHistory
#[derive(Debug, Clone)]
pub enum GetTradeHistoryResponse {
///200: trades
Ok(TradesResponse),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns the trading schedule up to a month for the requested contract.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetTradingScheduleGetTrsrvSecdefScheduleRequest {
#[validate(nested)]
pub query: GetTradingScheduleGetTrsrvSecdefScheduleRequestQuery,
}
impl GetTradingScheduleGetTrsrvSecdefScheduleRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetTradingScheduleGetTrsrvSecdefScheduleResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<TradingSchedule>::json_with_diagnostics(req)
.await?;
return Ok(GetTradingScheduleGetTrsrvSecdefScheduleResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetTradingScheduleGetTrsrvSecdefScheduleResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetTradingScheduleGetTrsrvSecdefScheduleResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetTradingScheduleGetTrsrvSecdefScheduleResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetTradingScheduleGetTrsrvSecdefScheduleResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetTradingScheduleGetTrsrvSecdefScheduleResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetTradingScheduleGetTrsrvSecdefScheduleRequestQuery {
/// Specify the security type of the given contract. Valid asset classes are:
/// * `STK` - Stock
/// * `OPT` - Option
/// * `FUT` - Future
/// * `CFD` - Contract for Difference
/// * `WAR` - Warrant
/// * `SWP` - Forex
/// * `FND` - Mutual Fund
/// * `BND` - Bond
/// * `ICS` - Inter-Commodity Spread
#[serde(rename = "assetClass")]
pub asset_class: GetTradingScheduleGetTrsrvSecdefScheduleRequestQueryAssetClass,
/// Specify the symbol for your contract.
/// - Example: `"AAPL".to_string()`
#[validate(length(min = 1u64))]
pub symbol: String,
/// Specify the primary exchange of your contract.
/// - Example: `Some("NASDAQ".to_string())`
pub exchange: Option<String>,
/// Specify all exchanges you want to retrieve data from.
/// - Example: `Some("AMEX,NASDAQ,NYSE".to_string())`
#[serde(rename = "exchangeFilter")]
pub exchange_filter: Option<String>,
}
/// Specify the security type of the given contract. Valid asset classes are:
/// * `STK` - Stock
/// * `OPT` - Option
/// * `FUT` - Future
/// * `CFD` - Contract for Difference
/// * `WAR` - Warrant
/// * `SWP` - Forex
/// * `FND` - Mutual Fund
/// * `BND` - Bond
/// * `ICS` - Inter-Commodity Spread
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum GetTradingScheduleGetTrsrvSecdefScheduleRequestQueryAssetClass {
#[serde(rename = "STK")]
#[default]
Stk,
#[serde(rename = "OPT")]
Opt,
#[serde(rename = "FUT")]
Fut,
#[serde(rename = "CFD")]
Cfd,
#[serde(rename = "WAR")]
War,
#[serde(rename = "SWP")]
Swp,
#[serde(rename = "FND")]
Fnd,
#[serde(rename = "BND")]
Bnd,
#[serde(rename = "ICS")]
Ics,
}
impl core::fmt::Display for GetTradingScheduleGetTrsrvSecdefScheduleRequestQueryAssetClass {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Stk => write!(f, "STK"),
Self::Opt => write!(f, "OPT"),
Self::Fut => write!(f, "FUT"),
Self::Cfd => write!(f, "CFD"),
Self::War => write!(f, "WAR"),
Self::Swp => write!(f, "SWP"),
Self::Fnd => write!(f, "FND"),
Self::Bnd => write!(f, "BND"),
Self::Ics => write!(f, "ICS"),
}
}
}
/// Response types for getTradingSchedule_get_trsrv_secdef_schedule
#[derive(Debug, Clone)]
pub enum GetTradingScheduleGetTrsrvSecdefScheduleResponse {
///200: Returns the trading schedule up to a month for the requested contract.
Ok(TradingSchedule),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns the trading schedule for the 6 total days surrounding the current trading day. Non-Trading days, such as holidays, will not be returned.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetTradingScheduleRequest {
#[validate(nested)]
pub query: GetTradingScheduleRequestQuery,
}
impl GetTradingScheduleRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetTradingScheduleResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<ScheduleResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetTradingScheduleResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetTradingScheduleResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetTradingScheduleResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetTradingScheduleResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetTradingScheduleResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GetTradingScheduleRequestQuery {
/// Provide the contract identifier to retrieve the trading schedule for.
#[validate(length(min = 1u64))]
pub conid: String,
/// Accepts the exchange to retrieve data from. Primary exchange is assumed by default.
pub exchange: Option<String>,
}
/// Response types for getTradingSchedule
#[derive(Debug, Clone)]
pub enum GetTradingScheduleResponse {
///200: Returns the liquid and extended trading hours of the coming and prior trading days.
Ok(ScheduleResponse),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Transaction history for a given number of conids and accounts. Types of transactions include dividend payments, buy and sell transactions, transfers.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetTransactionsRequest {
pub body: TransactionRequestBody,
}
impl GetTransactionsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetTransactionsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<TransactionsResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetTransactionsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetTransactionsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetTransactionsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetTransactionsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetTransactionsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetTransactionsResponse::Unknown);
}
}
/// Response types for getTransactions
#[derive(Debug, Clone)]
pub enum GetTransactionsResponse {
///200: An array of objects detailing contract information.
Ok(TransactionsResponse),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns a list of positions for the given account. /portfolio/accounts or /portfolio/subaccounts must be called prior to this endpoint. This endpoint provides near-real time updates and removes caching otherwise found in the /portfolio/{accountId}/positions/{pageId} endpoint.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetUncachedPositionsRequest {
#[validate(nested)]
pub path: GetUncachedPositionsRequestPath,
pub query: GetUncachedPositionsRequestQuery,
}
impl GetUncachedPositionsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetUncachedPositionsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Portfolio2Positions>::json_with_diagnostics(req)
.await?;
return Ok(GetUncachedPositionsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetUncachedPositionsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetUncachedPositionsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetUncachedPositionsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetUncachedPositionsResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct GetUncachedPositionsRequestPath {
/// accountId
/// - Example: `"DU123456".to_string()`
#[validate(length(min = 1u64))]
pub account_id: String,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct GetUncachedPositionsRequestQuery {
/// Model code to track the account within.
/// - Example: `Some("Primary_Model_Groups".to_string())`
pub model: Option<String>,
/// The chronologic order of orders to sort by.
/// * `a` - Display in ascending order.
/// * `d` - Display in descending order.
#[default(Some(Default::default()))]
pub direction: Option<GetUncachedPositionsRequestQueryDirection>,
}
/// The chronologic order of orders to sort by.
/// * `a` - Display in ascending order.
/// * `d` - Display in descending order.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum GetUncachedPositionsRequestQueryDirection {
#[serde(rename = "a")]
#[default]
A,
#[serde(rename = "d")]
D,
}
impl core::fmt::Display for GetUncachedPositionsRequestQueryDirection {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::A => write!(f, "a"),
Self::D => write!(f, "d"),
}
}
}
/// Response types for getUncachedPositions
#[derive(Debug, Clone)]
pub enum GetUncachedPositionsResponse {
///200: response with position details
Ok(Portfolio2Positions),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Returns the total number of unread notifications
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct GetUnreadFyisRequest {}
impl GetUnreadFyisRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetUnreadFyisResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<BNResponse>::json_with_diagnostics(req).await?;
return Ok(GetUnreadFyisResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetUnreadFyisResponse::Unauthorized);
}
if status == http::StatusCode::LOCKED {
let _ = req.bytes().await?;
return Ok(GetUnreadFyisResponse::Locked);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetUnreadFyisResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(GetUnreadFyisResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(GetUnreadFyisResponse::Unknown);
}
}
/// Response types for getUnreadFyis
#[derive(Debug, Clone)]
pub enum GetUnreadFyisResponse {
///200: Indicates data is being returned successfully.
Ok(BNResponse),
///401: Invalid or expired access token
Unauthorized,
///423: Return if called too frequently. Should not be called more than 1 time in 5 minutes
Locked,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
#[serde(default)]
pub struct GroupRequestBody {
/// An array of accounts that should be held in the allocation group and, if using a User-specified allocaiton method, the value correlated to the allocation.
#[validate(nested)]
pub accounts: Vec<GroupRequestBodyAccount>,
/// Interactive Brokers supports two forms of allocation methods. Allocation methods that have calculations completed by Interactive Brokers, and a set of allocation methods calculated by the user and then specified. IB-computed allocation methods:
/// * `A` - Available Equity
/// * `E` - Equal
/// * `N` - Net Liquidation Value
///
/// User-specified allocation methods:
/// * `C` - Cash Quantity
/// * `P` - Percentage
/// * `R` - Ratios
/// * `S` - Shares
#[default(Some(Default::default()))]
pub default_method: Option<AllocationMethod>,
/// Name used to refer to your allocation group. If prev_name is specified, this will become the new name of the group.
/// - Example: `"Group_1_NetLiq".to_string()`
#[validate(length(min = 1u64))]
pub name: String,
/// Can be used to rename a group. Using this field will recognize the previous name, while the "name" filed will mark the updated name.
/// - Example: `Some("Group_0_NetLiq".to_string())`
pub prev_name: Option<String>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
#[serde(default)]
pub struct GroupRequestBody2 {
/// An array of accounts that should be held in the allocation group and, if using a User-specified allocaiton method, the value correlated to the allocation.
#[validate(nested)]
pub accounts: Vec<GroupRequestBodyAccount>,
/// Interactive Brokers supports two forms of allocation methods. Allocation methods that have calculations completed by Interactive Brokers, and a set of allocation methods calculated by the user and then specified. IB-computed allocation methods:
/// * `A` - Available Equity
/// * `E` - Equal
/// * `N` - Net Liquidation Value
///
/// User-specified allocation methods:
/// * `C` - Cash Quantity
/// * `P` - Percentage
/// * `R` - Ratios
/// * `S` - Shares
#[default(Some(Default::default()))]
pub default_method: Option<AllocationMethod>,
/// Name used to refer to your allocation group. If prev_name is specified, this will become the new name of the group.
/// - Example: `"Group_1_NetLiq".to_string()`
#[validate(length(min = 1u64))]
pub name: String,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct GroupRequestBodyAccount {
/// The total distribution value for each sub-account for user-defined allocation methods.
/// - Example: `Some(10i32)`
pub amount: Option<i32>,
/// The accountId of a given sub-account.
/// - Example: `"U1234567".to_string()`
#[validate(length(min = 1u64))]
pub name: String,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum History200Response {
/// Object containing the requested historical data and related metadata.
#[default]
BidAsk(IserverHistoryBidAskResponse),
/// Object containing the requested historical data and related metadata.
Last(IserverHistoryLastResponse),
/// Object containing the requested historical data and related metadata.
Midpoint(IserverHistoryMidpointResponse),
}
impl History200Response {
/// Object containing the requested historical data and related metadata.
pub fn bid_ask() -> Self {
Self::BidAsk(IserverHistoryBidAskResponse::default())
}
/// Object containing the requested historical data and related metadata.
pub fn last() -> Self {
Self::Last(IserverHistoryLastResponse::default())
}
/// Object containing the requested historical data and related metadata.
pub fn midpoint() -> Self {
Self::Midpoint(IserverHistoryMidpointResponse::default())
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct IndividualComboPosition {
/// IB accountId of an account with a position in the requested conid.
#[serde(rename = "acctId")]
pub acct_id: Option<String>,
/// Asset class of the requested instrument.
#[serde(rename = "assetClass")]
pub asset_class: Option<String>,
/// The account's average cost for its position.
#[serde(rename = "avgCost")]
pub avg_cost: Option<f64>,
/// The account's average price for its position.
#[serde(rename = "avgPrice")]
pub avg_price: Option<f64>,
#[serde(rename = "conExchMap")]
pub con_exch_map: Option<Vec<serde_json::Value>>,
/// IB contract ID for the instrument.
pub conid: Option<i32>,
/// Human-readable description of the instrument.
#[serde(rename = "contractDesc")]
pub contract_desc: Option<String>,
/// Currency in which the instrument trades.
pub currency: Option<String>,
pub exchs: Option<serde_json::Value>,
/// Style of exercise for options.
#[serde(rename = "exerciseStyle")]
pub exercise_style: Option<String>,
/// Expiration of instrument, if applicable.
pub expiry: Option<String>,
/// Current market price of the instrument, in the instrument's currency.
#[serde(rename = "mktPrice")]
pub mkt_price: Option<f64>,
/// Current market value of the account's position in the instrument, in the instrument's currency.
#[serde(rename = "mktValue")]
pub mkt_value: Option<f64>,
/// Instrument's multiplier, if applicable.
pub multiplier: Option<f64>,
/// Size of position in units of instrument.
pub position: Option<f64>,
/// The right of an options contract, if applicable.
#[serde(rename = "putOrCall")]
pub put_or_call: Option<IndividualComboPositionPutOrCall>,
/// Realized PnL for the instrument in the instrument's currency.
#[serde(rename = "realizedPnl")]
pub realized_pnl: Option<f64>,
/// Strike price, if applicable. Returned as string.
pub strike: Option<String>,
/// Contract ID of underlying instrument, if applicable.
#[serde(rename = "undConid")]
pub und_conid: Option<i32>,
/// Unrealized PnL for the instrument in the account.
#[serde(rename = "unrealizedPnl")]
pub unrealized_pnl: Option<f64>,
}
/// The right of an options contract, if applicable.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
pub enum IndividualComboPositionPutOrCall {
#[default]
P,
C,
None,
}
impl core::fmt::Display for IndividualComboPositionPutOrCall {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::P => write!(f, "P"),
Self::C => write!(f, "C"),
Self::None => write!(f, "None"),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct IndividualIRABene {
#[serde(rename = "dateOfBirth")]
pub date_of_birth: Option<String>,
#[serde(rename = "firstName")]
pub first_name: Option<String>,
pub identification: Option<std::collections::HashMap<String, String>>,
#[serde(rename = "lastName")]
pub last_name: Option<String>,
pub location: Option<std::collections::HashMap<String, String>>,
pub ownership: Option<i32>,
#[serde(rename = "perStripes")]
pub per_stripes: Option<String>,
pub relationship: Option<String>,
#[serde(rename = "type")]
pub r#type: Option<String>,
}
/// A specific account's position in the requested conid.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct IndividualPosition {
/// IB accountId of an account with a position in the requested conid.
#[serde(rename = "acctId")]
pub acct_id: Option<String>,
/// Comma separated all exchanges on which the instrument trades.
#[serde(rename = "allExchanges")]
pub all_exchanges: Option<String>,
/// Asset class of the requested instrument.
#[serde(rename = "assetClass")]
pub asset_class: Option<String>,
/// The account's average cost for its position.
#[serde(rename = "avgCost")]
pub avg_cost: Option<f64>,
/// The account's average price for its position.
#[serde(rename = "avgPrice")]
pub avg_price: Option<f64>,
/// Average cost in the account's base currency.
#[serde(rename = "baseAvgCost")]
pub base_avg_cost: Option<f64>,
/// Average price in the account's base currency.
#[serde(rename = "baseAvgPrice")]
pub base_avg_price: Option<f64>,
/// Market price of instrument in the account's base currency.
#[serde(rename = "baseMktPrice")]
pub base_mkt_price: Option<f64>,
/// Market value of the position in the account's base currency.
#[serde(rename = "baseMktValue")]
pub base_mkt_value: Option<f64>,
/// Realized PnL for the instrument in the account's base currency.
#[serde(rename = "baseRealizedPnl")]
pub base_realized_pnl: Option<f64>,
/// Unrealized PnL for the instrument in the account's base currency.
#[serde(rename = "baseUnrealizedPnl")]
pub base_unrealized_pnl: Option<f64>,
/// Chinese name of the instrument.
#[serde(rename = "chineseName")]
pub chinese_name: Option<String>,
#[serde(rename = "conExchMap")]
pub con_exch_map: Option<Vec<serde_json::Value>>,
/// IB contract ID for the instrument.
pub conid: Option<i32>,
/// Human-readable description of the instrument.
#[serde(rename = "contractDesc")]
pub contract_desc: Option<String>,
/// Country in which the instrument is issued.
#[serde(rename = "countryCode")]
pub country_code: Option<String>,
/// Currency in which the instrument trades.
pub currency: Option<String>,
/// Object defining minimum increments used in displaying market data for the instrument.
#[serde(rename = "displayRule")]
pub display_rule: Option<IndividualPositionDisplayRule>,
pub exchs: Option<serde_json::Value>,
/// Style of exercise for options.
#[serde(rename = "exerciseStyle")]
pub exercise_style: Option<String>,
/// Expiration of instrument, if applicable.
pub expiry: Option<String>,
/// Full display name of the instrument.
#[serde(rename = "fullName")]
pub full_name: Option<String>,
/// Industry sub-categorization of the instrument.
pub group: Option<String>,
/// Indicates whether instrument has options contracts available for trading at IB.
#[serde(rename = "hasOptions")]
pub has_options: Option<bool>,
/// Array containing increment rules used when pricing orders for the instrument.
#[serde(rename = "incrementRules")]
pub increment_rules: Option<Vec<IndividualPositionIncrementRule>>,
/// Indicates whether the instrument is an Event Contract.
#[serde(rename = "isEventContract")]
pub is_event_contract: Option<bool>,
/// Indicates whether the instrument is issued in the US.
#[serde(rename = "isUS")]
pub is_us: Option<bool>,
/// Last day of trading in the instrument, if applicable. Formatted `YYYYMMDD`.
#[serde(rename = "lastTradingDay")]
pub last_trading_day: Option<String>,
/// The exchange on which the instrument is listed, or the primary exchange recognized by IB for the instrument.
#[serde(rename = "listingExchange")]
pub listing_exchange: Option<String>,
/// Current market price of the instrument, in the instrument's currency.
#[serde(rename = "mktPrice")]
pub mkt_price: Option<f64>,
/// Current market value of the account's position in the instrument, in the instrument's currency.
#[serde(rename = "mktValue")]
pub mkt_value: Option<f64>,
/// Name of the model portfolio in which the account is invested that contributes this position.
pub model: Option<String>,
/// Instrument's multiplier, if applicable.
pub multiplier: Option<f64>,
/// Formal name of the entity or asset to which the instrument relates.
pub name: Option<String>,
/// Maximum number of accounts that can be returned in a single request.
#[serde(rename = "pageSize")]
pub page_size: Option<i32>,
/// Size of position in units of instrument.
pub position: Option<f64>,
/// The right of an options contract, if applicable.
#[serde(rename = "putOrCall")]
pub put_or_call: Option<IndividualPositionPutOrCall>,
/// Realized PnL for the instrument in the instrument's currency.
#[serde(rename = "realizedPnl")]
pub realized_pnl: Option<f64>,
/// Industry sector categorization of the instrument.
pub sector: Option<String>,
/// Industry sub-categorization of the instrument.
#[serde(rename = "sectorGroup")]
pub sector_group: Option<String>,
/// Strike price, if applicable. Returned as string.
pub strike: Option<String>,
/// Symbol associated with the instrument.
pub ticker: Option<String>,
/// Time taken to retrieve position data in milliseconds.
pub time: Option<i32>,
/// Description of instrument, used to differentiate classes, if applicable.
#[serde(rename = "type")]
pub r#type: Option<String>,
/// Contract ID of underlying instrument, if applicable.
#[serde(rename = "undConid")]
pub und_conid: Option<i32>,
/// Unrealized PnL for the instrument in the account.
#[serde(rename = "unrealizedPnl")]
pub unrealized_pnl: Option<f64>,
}
pub type IndividualPositionArray = Vec<IndividualPosition>;
/// Object defining minimum increments used in displaying market data for the instrument.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct IndividualPositionDisplayRule {
/// Array containing objects corresponding to display rule increments.
#[serde(rename = "displayRuleStep")]
pub display_rule_step: Option<Vec<IndividualPositionDisplayRuleDisplayRuleStep>>,
/// Magnifier applied to pricing, if applicable.
pub magnification: Option<i32>,
}
/// A single display rule increment.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct IndividualPositionDisplayRuleDisplayRuleStep {
/// Number of decimal digits to display.
#[serde(rename = "decimalDigits")]
pub decimal_digits: Option<i32>,
/// Lower edge from which the display rule is effective.
#[serde(rename = "lowerEdge")]
pub lower_edge: Option<f64>,
/// Number of integer digits to display.
#[serde(rename = "wholeDigits")]
pub whole_digits: Option<i32>,
}
/// Objects describing a single increment rule.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct IndividualPositionIncrementRule {
/// The pricing increment.
pub increment: Option<f64>,
/// Lower edge from which the price increment rule is effective.
#[serde(rename = "lowerEdge")]
pub lower_edge: Option<f64>,
}
/// The right of an options contract, if applicable.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
pub enum IndividualPositionPutOrCall {
#[default]
P,
C,
}
impl core::fmt::Display for IndividualPositionPutOrCall {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::P => write!(f, "P"),
Self::C => write!(f, "C"),
}
}
}
/// After retrieving the access token and subsequent Live Session Token, customers can initialize their brokerage session with the ssodh/init endpoint.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct InitializeSessionRequest {
pub body: BrokerageSessionInitRequest,
}
impl InitializeSessionRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<InitializeSessionResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<BrokerageSessionStatus>::json_with_diagnostics(req)
.await?;
return Ok(InitializeSessionResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(InitializeSessionResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(InitializeSessionResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(InitializeSessionResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(InitializeSessionResponse::Unknown);
}
}
/// Response types for initializeSession
#[derive(Debug, Clone)]
pub enum InitializeSessionResponse {
///200: An array of objects detailing contract information.
Ok(BrokerageSessionStatus),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum Instruction200Response {
#[default]
InstructionPolling(InstructionPollingResponse),
Instruction(InstructionResponse),
QueryRecentInstruction(QueryRecentInstructionResponse),
DepositFundsPolling(DepositFundsPollingResponse),
QueryIRAContributions(QueryIRAContributionsResponse),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum InstructionDirection {
#[serde(rename = "IN")]
#[default]
In,
#[serde(rename = "OUT")]
Out,
}
impl core::fmt::Display for InstructionDirection {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::In => write!(f, "IN"),
Self::Out => write!(f, "OUT"),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct InstructionPollingResponse {
#[serde(rename = "instructionResult")]
pub instruction_result: Option<PollingInstructionResult>,
/// - Example: `-1988905739.0`
#[serde(rename = "instructionSetId")]
pub instruction_set_id: f64,
/// - Example: `202.0`
pub status: f64,
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct InstructionRequestBody {
pub instruction: InstructionRequestBodyInstruction,
#[serde(rename = "instructionType")]
pub instruction_type: InstructionRequestBodyInstructionType,
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum InstructionRequestBodyInstruction {
#[default]
TraditionalBankInstructionVerification(TraditionalBankInstructionVerification),
AchInstruction(AchInstruction),
DeleteBankInstruction(DeleteBankInstruction),
PredefinedDestinationInstruction(PredefinedDestinationInstruction),
EddaInstruction(EddaInstruction),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum InstructionRequestBodyInstructionType {
#[serde(rename = "ACH_INSTRUCTION")]
#[default]
AchInstruction,
#[serde(rename = "TRADITIONAL_BANK_INSTRUCTION_VERIFICATION")]
TraditionalBankInstructionVerification,
#[serde(rename = "DELETE_BANK_INSTRUCTION")]
DeleteBankInstruction,
#[serde(rename = "PREDEFINED_DESTINATION_INSTRUCTION")]
PredefinedDestinationInstruction,
#[serde(rename = "EDDA_INSTRUCTION")]
EddaInstruction,
}
impl core::fmt::Display for InstructionRequestBodyInstructionType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::AchInstruction => write!(f, "ACH_INSTRUCTION"),
Self::TraditionalBankInstructionVerification => {
write!(f, "TRADITIONAL_BANK_INSTRUCTION_VERIFICATION")
}
Self::DeleteBankInstruction => write!(f, "DELETE_BANK_INSTRUCTION"),
Self::PredefinedDestinationInstruction => {
write!(f, "PREDEFINED_DESTINATION_INSTRUCTION")
}
Self::EddaInstruction => write!(f, "EDDA_INSTRUCTION"),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct InstructionResponse {
#[serde(rename = "instructionResult")]
pub instruction_result: Option<InstructionResult>,
/// - Example: `-1988905739.0`
#[serde(rename = "instructionSetId")]
pub instruction_set_id: f64,
/// - Example: `202.0`
pub status: f64,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct InstructionResult {
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `Some("Please poll for status after 10 minutes".to_string())`
pub description: Option<String>,
/// - Example: `Some(23456745.0)`
#[serde(rename = "ibReferenceId")]
pub ib_reference_id: Option<f64>,
/// - Example: `45123654.0`
#[serde(rename = "instructionId")]
pub instruction_id: f64,
/// - Example: `"PENDING"`
#[serde(rename = "instructionStatus")]
pub instruction_status: InstructionResultInstructionStatus,
/// - Example: `"INTERNAL_CASH_TRANSFER"`
#[serde(rename = "instructionType")]
pub instruction_type: InstructionResultInstructionType,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
pub enum InstructionResultInstructionStatus {
#[serde(rename = "PENDING")]
#[default]
Pending,
#[serde(rename = "PROCESSED")]
Processed,
#[serde(rename = "REJECTED")]
Rejected,
#[serde(rename = "PENDING_VERIFICATION")]
PendingVerification,
}
impl core::fmt::Display for InstructionResultInstructionStatus {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Pending => write!(f, "PENDING"),
Self::Processed => write!(f, "PROCESSED"),
Self::Rejected => write!(f, "REJECTED"),
Self::PendingVerification => write!(f, "PENDING_VERIFICATION"),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
pub enum InstructionResultInstructionType {
#[serde(rename = "ACH_INSTRUCTION")]
#[default]
AchInstruction,
#[serde(rename = "CANCEL_INSTRUCTION")]
CancelInstruction,
#[serde(rename = "COMPLEX_ASSET_TRANSFER")]
ComplexAssetTransfer,
#[serde(rename = "DELETE_BANK_INSTRUCTION")]
DeleteBankInstruction,
#[serde(rename = "DEPOSIT")]
Deposit,
#[serde(rename = "DWAC")]
Dwac,
#[serde(rename = "EXTERNAL_POSITION_TRANSFER")]
ExternalPositionTransfer,
#[serde(rename = "FOP")]
Fop,
#[serde(rename = "QUERY_RECENT_INSTRUCTIONS")]
QueryRecentInstructions,
#[serde(rename = "QUERY_WITHDRAWABLE_FUNDS")]
QueryWithdrawableFunds,
#[serde(rename = "INTERNAL_POSITION_TRANSFER")]
InternalPositionTransfer,
#[serde(rename = "INTERNAL_CASH_TRANSFER")]
InternalCashTransfer,
#[serde(rename = "MICRO_AMOUNT")]
MicroAmount,
#[serde(rename = "PREDEFINED_DESTINATION_INSTRUCTION")]
PredefinedDestinationInstruction,
#[serde(rename = "TRADITIONAL_BANK_INSTRUCTION_VERIFICATION")]
TraditionalBankInstructionVerification,
#[serde(rename = "WITHDRAWAL")]
Withdrawal,
#[serde(rename = "QUERY_IRA_CONTRIBUTIONS")]
QueryIraContributions,
#[serde(rename = "EDDA_INSTRUCTION")]
EddaInstruction,
#[serde(rename = "QUERY_RECENT_RECURRING_EVENTS")]
QueryRecentRecurringEvents,
#[serde(rename = "QUERY_RECURRING_INSTRUCTIONS")]
QueryRecurringInstructions,
#[serde(rename = "QUERY_ACCOUNT_BALANCES")]
QueryAccountBalances,
#[serde(rename = "QUERY_BANK_INSTRUCTION")]
QueryBankInstruction,
#[serde(rename = "QUERY_WITHDRAWABLE_CASH_EQUITY")]
QueryWithdrawableCashEquity,
}
impl core::fmt::Display for InstructionResultInstructionType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::AchInstruction => write!(f, "ACH_INSTRUCTION"),
Self::CancelInstruction => write!(f, "CANCEL_INSTRUCTION"),
Self::ComplexAssetTransfer => write!(f, "COMPLEX_ASSET_TRANSFER"),
Self::DeleteBankInstruction => write!(f, "DELETE_BANK_INSTRUCTION"),
Self::Deposit => write!(f, "DEPOSIT"),
Self::Dwac => write!(f, "DWAC"),
Self::ExternalPositionTransfer => write!(f, "EXTERNAL_POSITION_TRANSFER"),
Self::Fop => write!(f, "FOP"),
Self::QueryRecentInstructions => write!(f, "QUERY_RECENT_INSTRUCTIONS"),
Self::QueryWithdrawableFunds => write!(f, "QUERY_WITHDRAWABLE_FUNDS"),
Self::InternalPositionTransfer => write!(f, "INTERNAL_POSITION_TRANSFER"),
Self::InternalCashTransfer => write!(f, "INTERNAL_CASH_TRANSFER"),
Self::MicroAmount => write!(f, "MICRO_AMOUNT"),
Self::PredefinedDestinationInstruction => {
write!(f, "PREDEFINED_DESTINATION_INSTRUCTION")
}
Self::TraditionalBankInstructionVerification => {
write!(f, "TRADITIONAL_BANK_INSTRUCTION_VERIFICATION")
}
Self::Withdrawal => write!(f, "WITHDRAWAL"),
Self::QueryIraContributions => write!(f, "QUERY_IRA_CONTRIBUTIONS"),
Self::EddaInstruction => write!(f, "EDDA_INSTRUCTION"),
Self::QueryRecentRecurringEvents => {
write!(f, "QUERY_RECENT_RECURRING_EVENTS")
}
Self::QueryRecurringInstructions => write!(f, "QUERY_RECURRING_INSTRUCTIONS"),
Self::QueryAccountBalances => write!(f, "QUERY_ACCOUNT_BALANCES"),
Self::QueryBankInstruction => write!(f, "QUERY_BANK_INSTRUCTION"),
Self::QueryWithdrawableCashEquity => {
write!(f, "QUERY_WITHDRAWABLE_CASH_EQUITY")
}
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
#[serde(default)]
pub struct InternalAssetTransfersBulkRequestBody {
#[serde(rename = "instructionType")]
#[default("INTERNAL_POSITION_TRANSFER".to_string())]
pub instruction_type: String,
pub instructions: Vec<serde_json::Value>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct InternalCashTransferInstruction {
/// - Example: `123.0`
pub amount: f64,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `Some("Note".to_string())`
#[serde(rename = "clientNote")]
#[validate(length(min = 1u64, max = 64u64))]
pub client_note: Option<String>,
/// - Example: `"GBP".to_string()`
#[validate(length(min = 1u64, max = 3u64))]
pub currency: String,
#[serde(rename = "dateTimeToOccur")]
pub date_time_to_occur: Option<chrono::DateTime<chrono::Utc>>,
/// - Example: `"U46377".to_string()`
#[serde(rename = "sourceAccountId")]
#[validate(length(min = 1u64, max = 32u64))]
pub source_account_id: String,
/// - Example: `"U15667".to_string()`
#[serde(rename = "targetAccountId")]
#[validate(length(min = 1u64, max = 32u64))]
pub target_account_id: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
#[serde(default)]
pub struct InternalCashTransfersBulkRequestBody {
#[serde(rename = "instructionType")]
#[default("INTERNAL_CASH_TRANSFER".to_string())]
pub instruction_type: String,
pub instructions: Vec<serde_json::Value>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct InternalPositionTransferInstruction {
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// If settleDate is provided then tradeDate is also required
/// - Example: `Some("2025-02-25".to_string())`
#[serde(rename = "settleDate")]
pub settle_date: Option<String>,
/// - Example: `"U46377".to_string()`
#[serde(rename = "sourceAccountId")]
#[validate(length(min = 1u64))]
pub source_account_id: String,
/// - Example: `"U463756".to_string()`
#[serde(rename = "targetAccountId")]
#[validate(length(min = 1u64))]
pub target_account_id: String,
/// If tradeDate is provided then settleDate is also required
/// - Example: `Some("2025-02-17".to_string())`
#[serde(rename = "tradeDate")]
pub trade_date: Option<String>,
#[serde(rename = "tradingInstrument")]
pub trading_instrument: TradingInstrument,
/// If transferPrice is provided then tradeDate and settleDate are also required
/// - Example: `Some(123.0)`
/// Validation: Must be a multiple of 1e-9
#[serde(rename = "transferPrice")]
pub transfer_price: Option<f64>,
/// - Example: `100.0`
#[serde(rename = "transferQuantity")]
pub transfer_quantity: f64,
}
/// Instructs IB to discard cached portfolio positions for a given account, so that the next request for positions delivers freshly obtained data.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct InvalidatePositionCacheRequest {
#[validate(nested)]
pub path: InvalidatePositionCacheRequestPath,
}
impl InvalidatePositionCacheRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<InvalidatePositionCacheResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<MessageResponse>::json_with_diagnostics(req)
.await?;
return Ok(InvalidatePositionCacheResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(InvalidatePositionCacheResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(InvalidatePositionCacheResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(InvalidatePositionCacheResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(InvalidatePositionCacheResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(InvalidatePositionCacheResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct InvalidatePositionCacheRequestPath {
/// Account ID whose cached portfolio positions will be discarded.
/// - Example: `"DU123456".to_string()`
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for invalidatePositionCache
#[derive(Debug, Clone)]
pub enum InvalidatePositionCacheResponse {
///200: status of invalidation
Ok(MessageResponse),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct InvestDivest200Response {
/// Request identifier to uniquely track a request.
/// - Example: `Some("540607".to_string())`
#[serde(rename = "reqID")]
pub req_id: Option<String>,
/// Describes if the model is in polling mode.
#[serde(rename = "subscriptionStatus")]
pub subscription_status: Option<i32>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct InvestDivestRequestBody {
/// Collection of accounts to invest in a model.
#[serde(rename = "accountList")]
pub account_list: Option<Vec<InvestDivestRequestBodyAccountList>>,
/// Define the model to invest accounts into.
pub model: Option<String>,
/// Request identifier to uniquely track a request.
#[serde(rename = "reqID")]
pub req_id: Option<i32>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct InvestDivestRequestBodyAccountList {
/// Account identifier to invest.
pub account: Option<String>,
/// Amount of cash to invest in the model from the account.
#[serde(rename = "amtToInvest")]
pub amt_to_invest: Option<f64>,
}
/// Object containing the requested historical data and related metadata.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(default)]
pub struct IserverHistoryBidAskResponse {
/// The client-specified bar width, represented in seconds.
#[serde(rename = "barLength")]
pub bar_length: Option<i32>,
/// Internal use. UTC datetime string used to center Client Portal charts. Format YYYYMMDD-hh:mm:ss.
#[serde(rename = "chartPanStartTime")]
pub chart_pan_start_time: Option<String>,
/// Array containing OHLC bars for the requested period.
pub data: Option<Vec<SingleHistoricalBarBidAsk>>,
/// Indicates how the period is applied in relation to the startTime. Value will always be -1, indicating that the period extends from the startTime forward into the future.
#[default(Some(-1i32))]
pub direction: Option<i32>,
/// Internal use. Delivers highest price value in total interval. Used for chart scaling. A string constructed as 'highestPrice*priceFactor/totalVolume*volumeFactor/minutesFromStartTime'.
pub high: Option<String>,
/// Internal use. Delivers lowest price value in total interval. Used for chart scaling. A string constructed as 'lowestPrice*priceFactor/totalVolume*volumeFactor/minutesFromStartTime'.
pub low: Option<String>,
/// A three-character string reflecting the nature of available data. R = Realtime, D = Delayed, Z = Frozen, Y = Frozen Delayed, N = Not Subscribed. P = Snapshot, p = Consolidated. B = Top of book.
#[serde(rename = "mdAvailability")]
pub md_availability: Option<String>,
/// Internal use. Reflects the version of the response schema used.
#[serde(rename = "messageVersion")]
pub message_version: Option<i32>,
/// Number of milliseconds taken to satisfy this historical data request.
#[serde(rename = "mktDataDelay")]
pub mkt_data_delay: Option<i32>,
/// Indicates whether instrument is capable of negative pricing.
#[serde(rename = "negativeCapable")]
pub negative_capable: Option<bool>,
/// Indicates whether data from outside regular trading hours is included in the response.
#[serde(rename = "outsideRth")]
pub outside_rth: Option<bool>,
/// Count of the number of bars returned in the data array.
pub points: Option<i32>,
/// Internal use. Governs application of pricing display rule.
#[serde(rename = "priceDisplayRule")]
pub price_display_rule: Option<i32>,
/// Internal use. Governs rendering of displayed pricing.
#[serde(rename = "priceDisplayValue")]
pub price_display_value: Option<String>,
/// Internal use. Used to scale Client Portal chart Y-axis.
#[serde(rename = "priceFactor")]
pub price_factor: Option<i32>,
/// Internal use. Identifier of the request.
#[serde(rename = "serverId")]
pub server_id: Option<String>,
/// UTC date and time of the start (chronologically earlier) of the complete period in format YYYYMMDD-hh:mm:ss.
#[serde(rename = "startTime")]
pub start_time: Option<String>,
/// Symbol of the request instrument.
pub symbol: Option<String>,
/// Description or company name of the instrument.
pub text: Option<String>,
/// The client-specified period value.
#[serde(rename = "timePeriod")]
pub time_period: Option<String>,
/// Length of instrument's trading day in seconds.
#[serde(rename = "tradingDayDuration")]
pub trading_day_duration: Option<i32>,
/// Internal time in flight to serve the request.
#[serde(rename = "travelTime")]
pub travel_time: Option<i32>,
/// Internal use. Used to scale volume histograms.
#[serde(rename = "volumeFactor")]
pub volume_factor: Option<i32>,
}
/// Object containing the requested historical data and related metadata.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(default)]
pub struct IserverHistoryLastResponse {
/// The client-specified bar width, represented in seconds.
#[serde(rename = "barLength")]
pub bar_length: Option<i32>,
/// Internal use. UTC datetime string used to center Client Portal charts. Format YYYYMMDD-hh:mm:ss.
#[serde(rename = "chartPanStartTime")]
pub chart_pan_start_time: Option<String>,
/// Array containing OHLC bars for the requested period.
pub data: Option<Vec<SingleHistoricalBarLast>>,
/// Indicates how the period is applied in relation to the startTime. Value will always be -1, indicating that the period extends from the startTime forward into the future.
#[default(Some(-1i32))]
pub direction: Option<i32>,
/// Internal use. Delivers highest price value in total interval. Used for chart scaling. A string constructed as 'highestPrice*priceFactor/totalVolume*volumeFactor/minutesFromStartTime'.
pub high: Option<String>,
/// Internal use. Delivers lowest price value in total interval. Used for chart scaling. A string constructed as 'lowestPrice*priceFactor/totalVolume*volumeFactor/minutesFromStartTime'.
pub low: Option<String>,
/// A three-character string reflecting the nature of available data. R = Realtime, D = Delayed, Z = Frozen, Y = Frozen Delayed, N = Not Subscribed. P = Snapshot, p = Consolidated. B = Top of book.
#[serde(rename = "mdAvailability")]
pub md_availability: Option<String>,
/// Internal use. Reflects the version of the response schema used.
#[serde(rename = "messageVersion")]
pub message_version: Option<i32>,
/// Number of milliseconds taken to satisfy this historical data request.
#[serde(rename = "mktDataDelay")]
pub mkt_data_delay: Option<i32>,
/// Indicates whether instrument is capable of negative pricing.
#[serde(rename = "negativeCapable")]
pub negative_capable: Option<bool>,
/// Indicates whether data from outside regular trading hours is included in the response.
#[serde(rename = "outsideRth")]
pub outside_rth: Option<bool>,
/// Count of the number of bars returned in the data array.
pub points: Option<i32>,
/// Internal use. Governs application of pricing display rule.
#[serde(rename = "priceDisplayRule")]
pub price_display_rule: Option<i32>,
/// Internal use. Governs rendering of displayed pricing.
#[serde(rename = "priceDisplayValue")]
pub price_display_value: Option<String>,
/// Internal use. Used to scale Client Portal chart Y-axis.
#[serde(rename = "priceFactor")]
pub price_factor: Option<i32>,
/// Internal use. Identifier of the request.
#[serde(rename = "serverId")]
pub server_id: Option<String>,
/// UTC date and time of the start (chronologically earlier) of the complete period in format YYYYMMDD-hh:mm:ss.
#[serde(rename = "startTime")]
pub start_time: Option<String>,
/// Symbol of the request instrument.
pub symbol: Option<String>,
/// Description or company name of the instrument.
pub text: Option<String>,
/// The client-specified period value.
#[serde(rename = "timePeriod")]
pub time_period: Option<String>,
/// Length of instrument's trading day in seconds.
#[serde(rename = "tradingDayDuration")]
pub trading_day_duration: Option<i32>,
/// Internal time in flight to serve the request.
#[serde(rename = "travelTime")]
pub travel_time: Option<i32>,
/// Internal use. Used to scale volume histograms.
#[serde(rename = "volumeFactor")]
pub volume_factor: Option<i32>,
}
/// Object containing the requested historical data and related metadata.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(default)]
pub struct IserverHistoryMidpointResponse {
/// The client-specified bar width, represented in seconds.
#[serde(rename = "barLength")]
pub bar_length: Option<i32>,
/// Internal use. UTC datetime string used to center Client Portal charts. Format YYYYMMDD-hh:mm:ss.
#[serde(rename = "chartPanStartTime")]
pub chart_pan_start_time: Option<String>,
/// Array containing OHLC bars for the requested period.
pub data: Option<Vec<SingleHistoricalBarMidpoint>>,
/// Indicates how the period is applied in relation to the startTime. Value will always be -1, indicating that the period extends from the startTime forward into the future.
#[default(Some(-1i32))]
pub direction: Option<i32>,
/// Internal use. Delivers highest price value in total interval. Used for chart scaling. A string constructed as 'highestPrice*priceFactor/totalVolume*volumeFactor/minutesFromStartTime'.
pub high: Option<String>,
/// Internal use. Delivers lowest price value in total interval. Used for chart scaling. A string constructed as 'lowestPrice*priceFactor/totalVolume*volumeFactor/minutesFromStartTime'.
pub low: Option<String>,
/// A three-character string reflecting the nature of available data. R = Realtime, D = Delayed, Z = Frozen, Y = Frozen Delayed, N = Not Subscribed. P = Snapshot, p = Consolidated. B = Top of book.
#[serde(rename = "mdAvailability")]
pub md_availability: Option<String>,
/// Internal use. Reflects the version of the response schema used.
#[serde(rename = "messageVersion")]
pub message_version: Option<i32>,
/// Number of milliseconds taken to satisfy this historical data request.
#[serde(rename = "mktDataDelay")]
pub mkt_data_delay: Option<i32>,
/// Indicates whether instrument is capable of negative pricing.
#[serde(rename = "negativeCapable")]
pub negative_capable: Option<bool>,
/// Indicates whether data from outside regular trading hours is included in the response.
#[serde(rename = "outsideRth")]
pub outside_rth: Option<bool>,
/// Count of the number of bars returned in the data array.
pub points: Option<i32>,
/// Internal use. Governs application of pricing display rule.
#[serde(rename = "priceDisplayRule")]
pub price_display_rule: Option<i32>,
/// Internal use. Governs rendering of displayed pricing.
#[serde(rename = "priceDisplayValue")]
pub price_display_value: Option<String>,
/// Internal use. Used to scale Client Portal chart Y-axis.
#[serde(rename = "priceFactor")]
pub price_factor: Option<i32>,
/// Internal use. Identifier of the request.
#[serde(rename = "serverId")]
pub server_id: Option<String>,
/// UTC date and time of the start (chronologically earlier) of the complete period in format YYYYMMDD-hh:mm:ss.
#[serde(rename = "startTime")]
pub start_time: Option<String>,
/// Symbol of the request instrument.
pub symbol: Option<String>,
/// Description or company name of the instrument.
pub text: Option<String>,
/// The client-specified period value.
#[serde(rename = "timePeriod")]
pub time_period: Option<String>,
/// Length of instrument's trading day in seconds.
#[serde(rename = "tradingDayDuration")]
pub trading_day_duration: Option<i32>,
/// Internal time in flight to serve the request.
#[serde(rename = "travelTime")]
pub travel_time: Option<i32>,
/// Internal use. Used to scale volume histograms.
#[serde(rename = "volumeFactor")]
pub volume_factor: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct IserverScannerParams {
pub filter_list: Option<Vec<IserverScannerParamsFilterList>>,
/// Contains all values relevant to the scanner "instrument" request field.
pub instrument_list: Option<Vec<IserverScannerParamsInstrumentList>>,
/// Contains all values relevant to the location field of the market scanner request.
pub location_tree: Option<Vec<IserverScannerParamsLocationTree>>,
/// Contains all values used as the scanner "type" in the request.
pub scan_type_list: Option<Vec<IserverScannerParamsScanTypeList>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct IserverScannerParamsFilterList {
/// Value used for the market scanner request.
pub code: Option<String>,
/// combo values when type equals to combo
pub combo_values: Option<Vec<IserverScannerParamsFilterListComboValue>>,
/// Returns the human-readable identifier for the filter.
pub display_name: Option<String>,
/// Returns the group of filters the request is affiliated with.
pub group: Option<String>,
/// Returns the type of value to be used in the request. This can indicate a range based value, or if it should be a single value.
#[serde(rename = "type")]
pub r#type: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct IserverScannerParamsFilterListComboValue {
pub default: Option<bool>,
pub vendor: Option<serde_json::Value>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct IserverScannerParamsInstrumentList {
/// Human readable representation of the instrument type.
pub display_name: Option<String>,
/// Returns an array of all filters uniquely avaliable to that instrument type.
pub filters: Option<Vec<serde_json::Value>>,
/// Value used for the market scanner request.
#[serde(rename = "type")]
pub r#type: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct IserverScannerParamsLocationTree {
/// Returns the overarching instrument type to designate the location.
pub display_name: Option<String>,
pub locations: Option<Vec<IserverScannerParamsLocationTreeLocation>>,
/// Returns the code value of the market scanner instrument type value.
#[serde(rename = "type")]
pub r#type: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct IserverScannerParamsLocationTreeLocation {
/// Returns the human-readable value of the market scanner's location value.
pub display_name: Option<String>,
pub locations: Option<Vec<IserverScannerParamsLocationTreeLocationLocation>>,
/// Returns the code value of the market scanner location value.
#[serde(rename = "type")]
pub r#type: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct IserverScannerParamsLocationTreeLocationLocation {
pub display_name: Option<String>,
#[serde(rename = "type")]
pub r#type: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct IserverScannerParamsScanTypeList {
/// Value used for the market scanner request.
pub code: Option<String>,
/// Human readable name for the scanner "type"
pub display_name: Option<String>,
/// Returns all instruments the scanner type can be used with.
pub instruments: Option<Vec<serde_json::Value>>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct IserverScannerRunRequest {
/// Contains any additional filters that should apply to response.
pub filter: Option<Vec<IserverScannerRunRequestFilter>>,
/// Instrument type as the target of the market scanner request. Found in the "instrument_list" section of the /iserver/scanner/params response.
pub instrument: Option<String>,
/// Location value the market scanner is searching through. Based on the "location_tree" section of the /iserver/scanner/params response.
pub location: Option<String>,
/// Scanner value the market scanner is sorted by. Based on the "scan_type_list" section of the /iserver/scanner/params response.
#[serde(rename = "type")]
pub r#type: Option<String>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct IserverScannerRunRequestFilter {
/// Code value of the filter. Based on the "code" value within the "filter_list" section of the /iserver/scanner/params response.
pub code: Option<String>,
/// Value corresponding to the input for "code".
pub value: Option<IserverScannerRunRequestFilterValue>,
}
/// Value corresponding to the input for "code".
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum IserverScannerRunRequestFilterValue {
#[default]
String(String),
Integer(i32),
Boolean(bool),
Number(f64),
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct IserverScannerRunResponse {
/// Contains contracts related to the market scanner request.
pub contracts: Option<Vec<IserverScannerRunResponseContract>>,
/// Internal Use Only
pub scan_data_column_name: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct IserverScannerRunResponseContract {
/// Internal Use Only
pub available_chart_periods: Option<String>,
/// Always returned for the first contract.
pub column_name: Option<String>,
/// Returns the company long name.
pub company_name: Option<String>,
/// Returns the contract ID of the contract.
pub con_id: Option<i32>,
/// Returns the contract ID of the contract.
pub conidex: Option<String>,
/// For derivatives like Futures, the local symbol of the contract will be returned.
pub contract_description_1: Option<String>,
/// Returns the primary listing exchange of the contract.
pub listing_exchange: Option<String>,
/// Returns the security type of the contract.
pub sec_type: Option<String>,
/// Contract's index in relation to the market scanner type's sorting priority.
pub server_id: Option<String>,
/// Returns the contract's ticker symbol.
pub symbol: Option<String>,
}
/// Returns an object for each conId requested.
pub type IserverSnapshot = Vec<IserverSnapshotKind>;
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum IserverSnapshotKind {
#[default]
Variant0(serde_json::Value),
}
/// Contains objects reflecting all currencies in which the account's positions trade.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct Ledger {
/// Additional properties not defined in the schema.
#[serde(flatten)]
pub additional_properties: std::collections::HashMap<String, serde_json::Value>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct LiveOrdersResponse {
/// Array of orders that are currently working, or were filled/cancelled in the current brokerage session.
pub orders: Option<Vec<LiveOrdersResponseOrder>>,
/// Whether the response is a snapshot.
pub snapshot: Option<bool>,
}
/// Object representing one order.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct LiveOrdersResponseOrder {
/// IB account ID to which the order was placed.
pub account: Option<String>,
/// IB account ID to which the order was placed.
pub acct: Option<String>,
/// Average price of fills against the order, if any.
#[serde(rename = "avgPrice")]
pub avg_price: Option<String>,
/// Internal use. IB's UI background color in hex.
#[serde(rename = "bgColor")]
pub bg_color: Option<String>,
/// Currency of the order ticket's Cash Quantity, if applicable.
#[serde(rename = "cashCcy")]
pub cash_ccy: Option<String>,
/// Name of business associated with instrument, or otherwise description of instrument.
#[serde(rename = "companyName")]
pub company_name: Option<String>,
/// Contract ID of the order's instrument.
pub conid: Option<String>,
/// Contract ID and routing destination in format 123456@EXCHANGE.
pub conidex: Option<String>,
/// Descriptive text, or additional details that specific the instrument.
pub description1: Option<String>,
/// Only present for derivatives. Shows Expiry, Strike, Right, And Exchange information.
pub description2: Option<String>,
/// Routing destination of the order ticket.
pub exchange: Option<String>,
/// Internal use. IB's UI foreground color in hex.
#[serde(rename = "fgColor")]
pub fg_color: Option<String>,
/// Quantity filled in units of the instrument.
#[serde(rename = "filledQuantity")]
pub filled_quantity: Option<String>,
/// Indicates whether the order ticket is an Event Trading order.
#[serde(rename = "isEventTrading")]
pub is_event_trading: Option<AlertActivationRequestAlertActive>,
/// Time of last execution against the order in format YYMMDDhhmmss.
#[serde(rename = "lastExecutionTime")]
pub last_execution_time: Option<String>,
/// Unix timestamp of the last execution against the order.
#[serde(rename = "lastExecutionTime_r")]
pub last_execution_time_r: Option<String>,
/// Exchange on which the instrument is listed.
#[serde(rename = "listingExchange")]
pub listing_exchange: Option<String>,
/// Human-readable shorthand rendering of the order ticket.
#[serde(rename = "orderDesc")]
pub order_desc: Option<String>,
/// IB-assigned order identifier.
#[serde(rename = "orderId")]
pub order_id: Option<i32>,
/// Order type of a working order ticket.
#[serde(rename = "orderType")]
pub order_type: Option<String>,
/// Only present for Cancelled orders. Provides the reason for order to have been cancelled or rejected by the system.
pub order_cancellation_by_system_reason: Option<String>,
/// IB internal order status.
pub order_ccp_status: Option<String>,
/// Order type of a filled order.
#[serde(rename = "origOrderType")]
pub orig_order_type: Option<String>,
/// Price of the order, if applicable to the order type.
pub price: Option<String>,
/// Quantity remaining to be filled in units of the instrument.
#[serde(rename = "remainingQuantity")]
pub remaining_quantity: Option<String>,
/// Asset class of the instrument.
#[serde(rename = "secType")]
pub sec_type: Option<String>,
/// Side of the order.
pub side: Option<String>,
/// Human-readable shorthand rendering of the filled and total quantities of the order.
#[serde(rename = "sizeAndFills")]
pub size_and_fills: Option<String>,
/// Status of the order ticket.
pub status: Option<OrderStatusOrderStatus>,
/// Indicates whether the order is supported by IB's Tax Optimization tool.
#[serde(rename = "supportsTaxOpt")]
pub supports_tax_opt: Option<AlertActivationRequestAlertActive>,
/// Tax Optimizer id, identifies set of tax lots selected, for gains and losses management.
#[serde(rename = "taxOptimizerId")]
pub tax_optimizer_id: Option<String>,
/// Symbol or base product code of the instrument.
pub ticker: Option<String>,
/// Time of force of the order.
#[serde(rename = "timeInForce")]
pub time_in_force: Option<String>,
/// Total size of a cash quantity order.
#[serde(rename = "totalCashSize")]
pub total_cash_size: Option<String>,
/// Total size of an order in the instrument's units.
#[serde(rename = "totalSize")]
pub total_size: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct LiveSessionToken200Response {
/// Diffie-Hellman challenge value used to compute live session token locally by client.
pub diffie_hellman_challenge: Option<String>,
/// Unix timestamp in milliseconds of time of live session token computation by IB. Live session tokens are valid for 24 hours from this time.
pub live_session_token_expiration: Option<i32>,
/// Signature value used to validate successful client-side computation of live session token.
pub live_session_token_signature: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct LoginMessage {
#[serde(rename = "contentId")]
pub content_id: Option<i32>,
pub description: Option<String>,
pub id: Option<i32>,
#[serde(rename = "messageType")]
pub message_type: Option<String>,
#[serde(rename = "recordDate")]
pub record_date: Option<chrono::DateTime<chrono::Utc>>,
pub state: Option<String>,
pub tasks: Option<Vec<i32>>,
pub username: Option<String>,
}
#[serde_with::skip_serializing_none]
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
)]
pub struct LoginMessageRequest {
#[serde(rename = "endDate")]
pub end_date: chrono::NaiveDate,
#[validate(range(min = 1i32, max = 1_000i32))]
pub limit: Option<i32>,
#[validate(range(min = 0i32))]
pub offset: Option<i32>,
#[serde(rename = "startDate")]
pub start_date: chrono::NaiveDate,
pub status: Option<RequestStatus>,
#[serde(rename = "type")]
pub r#type: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct LoginMessageResponse {
#[serde(rename = "accountId")]
pub account_id: Option<String>,
#[serde(rename = "clearingStatus")]
pub clearing_status: Option<String>,
#[serde(rename = "clearingStatusDescription")]
pub clearing_status_description: Option<String>,
#[serde(rename = "loginMessagePresent")]
pub login_message_present: Option<bool>,
#[serde(rename = "loginMessages")]
pub login_messages: Option<Vec<LoginMessage>>,
}
/// Logs the user out of the gateway session. Any further activity requires re-authentication. Discard client-side cookies upon logout.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct LogoutRequest {}
impl LogoutRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<LogoutResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<StatusResponse4>::json_with_diagnostics(req)
.await?;
return Ok(LogoutResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(LogoutResponse::Unauthorized);
}
let _ = req.bytes().await?;
return Ok(LogoutResponse::Unknown);
}
}
/// Response types for logout
#[derive(Debug, Clone)]
pub enum LogoutResponse {
///200: An array of objects detailing contract information.
Ok(StatusResponse4),
///401: Invalid or expired access token
Unauthorized,
///default: Unknown response
Unknown,
}
/// Many FYI endpoints reference a "typecode" value. The table below lists the available codes and what they correspond to.
/// * `31` - Last Price. The last price at which the contract traded. May contain one of the following prefixes: C - Previous day's closing price. H - Trading has halted.
/// * `55` - Symbol.
/// * `58` - Text.
/// * `70` - High. Current day high price
/// * `71` - Low. Current day low price
/// * `73` - Market Value. The current market value of your position in the security. Market Value is calculated with real time market data (even when not subscribed to market data).
/// * `74` - Avg Price. The average price of the position.
/// * `75` - Unrealized PnL. Unrealized profit or loss. Unrealized PnL is calculated with real time market data (even when not subscribed to market data).
/// * `76` - Formatted position.
/// * `77` - Formatted Unrealized PnL.
/// * `78` - Daily PnL. Your profit or loss of the day since prior close. Daily PnL is calculated with real time market data (even when not subscribed to market data).
/// * `79` - Realized PnL. Realized profit or loss. Realized PnL is calculated with real time market data (even when not subscribed to market data).
/// * `80` - Unrealized PnL %. Unrealized profit or loss expressed in percentage.
/// * `82` - Change. The difference between the last price and the close on the previous trading day
/// * `83` - Change %. The difference between the last price and the close on the previous trading day in percentage.
/// * `84` - Bid Price. The highest-priced bid on the contract.
/// * `85` - Ask Size. The number of contracts or shares offered at the ask price. For US stocks
/// * `86` - Ask Price. The lowest-priced offer on the contract.
/// * `87` - Volume. Volume for the day
/// * `88` - Bid Size. The number of contracts or shares bid for at the bid price. For US stocks
/// * `201` - Right. Declares the Right of the Option, Call or Put.
/// * `6004` - Exchange.
/// * `6008` - Conid. Contract identifier from IBKR's database.
/// * `6070` - SecType. The asset class of the instrument.
/// * `6072` - Months.
/// * `6073` - Regular Expiry.
/// * `6119` - Marker for market data delivery method (similar to request id).
/// * `6457` - Underlying Conid. Use /trsrv/secdef to get more information about the security.
/// * `6508` - Service Params..
/// * `6509` - Market Data Availability. The field may contain three chars. First char defines: R = RealTime, D = Delayed, Z = Frozen, Y = Frozen Delayed, N = Not Subscribed, i - incomplete, v - VDR Exempt (Vendor Display Rule 603c). Second char defines: P = Snapshot, p = Consolidated. Third char defines: B = Book. RealTime Data is relayed back in real time without delay, market data subscription(s) are required. Delayed - Data is relayed back 15-20 min delayed. Frozen - Last recorded data at market close. relayed back in real time. Frozen Delayed - Last recorded data at market close, relayed back delayed. Not Subscribed - User does not have the required market data subscription(s) to relay back either real time or delayed data. Snapshot - Snapshot request is available for contract. Consolidated - Market data is aggregated across multiple exchanges or venues. Book - Top of the book data is available for contract.
/// * `7051` - Company name.
/// * `7057` - Ask Exch. Displays the exchange(s) offering the SMART price. A=AMEX, C=CBOE, I=ISE, X=PHLX, N=PSE, B=BOX, Q=NASDAQOM, Z=BATS, W=CBOE2, T=NASDAQBX, M=MIAX, H=GEMINI, E=EDGX, J=MERCURY
/// * `7058` - Last Exch. Displays the exchange(s) offering the SMART price. A=AMEX, C=CBOE, I=ISE, X=PHLX, N=PSE, B=BOX, Q=NASDAQOM, Z=BATS, W=CBOE2, T=NASDAQBX, M=MIAX, H=GEMINI, E=EDGX, J=MERCURY
/// * `7059` - Last Size. The number of unites traded at the last price
/// * `7068` - Bid Exch. Displays the exchange(s) offering the SMART price. A=AMEX, C=CBOE, I=ISE, X=PHLX, N=PSE, B=BOX, Q=NASDAQOM, Z=BATS, W=CBOE2, T=NASDAQBX, M=MIAX, H=GEMINI, E=EDGX, J=MERCURY
/// * `7084` - Implied Vol./Hist. Vol %. The ratio of the implied volatility over the historical volatility, expressed as a percentage.
/// * `7085` - Put/Call Interest. Put option open interest/call option open interest for the trading day.
/// * `7086` - Put/Call Volume. Put option volume/call option volume for the trading day.
/// * `7087` - Hist. Vol. %. 30-day real-time historical volatility.
/// * `7088` - Hist. Vol. Close %. Shows the historical volatility based on previous close price.
/// * `7089` - Opt. Volume. Option Volume
/// * `7094` - Conid + Exchange.
/// * `7184` - canBeTraded. If contract is a trade-able instrument. Returns 1(true) or 0(false).
/// * `7219` - Contract Description.
/// * `7220` - Contract Description.
/// * `7221` - Listing Exchange.
/// * `7280` - Industry. Displays the type of industry under which the underlying company can be categorized.
/// * `7281` - Category. Displays a more detailed level of description within the industry under which the underlying company can be categorized.
/// * `7282` - Average Volume. The average daily trading volume over 90 days.
/// * `7283` - Option Implied Vol. %. A prediction of how volatile an underlying will be in the future.At the market volatility estimated for a maturity thirty calendar days forward of the current trading day, and based on option prices from two consecutive expiration months. To query the Implied Vol. % of a specific strike refer to field 7633.
/// * `7284` - Historical volatility %. Deprecated
/// * `7285` - Put/Call Ratio.
/// * `7292` - Cost Basis. Your current position in this security multiplied by the average price and multiplier.
/// * `7293` - 52 Week High. The highest price for the past 52 weeks.
/// * `7294` - 52 Week Low. The lowest price for the past 52 weeks.
/// * `7295` - Open. Today's opening price.
/// * `7296` - Close. Today's closing price.
/// * `7308` - Delta. The ratio of the change in the price of the option to the corresponding change in the price of the underlying.
/// * `7309` - Gamma. The rate of change for the delta with respect to the underlying asset's price.
/// * `7310` - Theta. A measure of the rate of decline the value of an option due to the passage of time.
/// * `7311` - Vega. The amount that the price of an option changes compared to a 1% change in the volatility.
/// * `7607` - Opt. Volume Change %. Today's option volume as a percentage of the average option volume.
/// * `7633` - Implied Vol. %. The implied volatility for the specific strike of the option in percentage. To query the Option Implied Vol. % from the underlying refer to field 7283.
/// * `7635` - Mark. The mark price is
/// * `7636` - Shortable Shares. Number of shares available for shorting.
/// * `7637` - Fee Rate. Interest rate charged on borrowed shares.
/// * `7638` - Option Open Interest.
/// * `7639` - % of Mark Value. Displays the market value of the contract as a percentage of the total market value of the account. Mark Value is calculated with real time market data (even when not subscribed to market data).
/// * `7644` - Shortable. Describes the level of difficulty with which the security can be sold short.
/// * `7671` - Dividends. This value is the total of the expected dividend payments over the next twelve months per share.
/// * `7672` - Dividends TTM. This value is the total of the expected dividend payments over the last twelve months per share.
/// * `7674` - EMA(200). Exponential moving average (N=200).
/// * `7675` - EMA(100). Exponential moving average (N=100).
/// * `7676` - EMA(50). Exponential moving average (N=50).
/// * `7677` - EMA(20). Exponential moving average (N=20).
/// * `7678` - Price/EMA(200). Price to Exponential moving average (N=200) ratio -1
/// * `7679` - Price/EMA(100). Price to Exponential moving average (N=100) ratio -1
/// * `7724` - Price/EMA(50). Price to Exponential moving average (N=50) ratio -1
/// * `7681` - Price/EMA(20). Price to Exponential moving average (N=20) ratio -1
/// * `7682` - Change Since Open. The difference between the last price and the open price.
/// * `7683` - Upcoming Event. Shows the next major company event. Requires Wall Street Horizon subscription.
/// * `7684` - Upcoming Event Date. The date of the next major company event. Requires Wall Street Horizon subscription.
/// * `7685` - Upcoming Analyst Meeting. The date and time of the next scheduled analyst meeting. Requires Wall Street Horizon subscription.
/// * `7686` - Upcoming Earnings. The date and time of the next scheduled earnings/earnings call event. Requires Wall Street Horizon subscription.
/// * `7687` - Upcoming Misc Event. The date and time of the next shareholder meeting
/// * `7688` - Recent Analyst Meeting. The date and time of the most recent analyst meeting. Requires Wall Street Horizon subscription.
/// * `7689` - Recent Earnings. The date and time of the most recent earnings/earning call event. Requires Wall Street Horizon subscription.
/// * `7690` - Recent Misc Event. The date and time of the most recent shareholder meeting
/// * `7694` - Probability of Max Return. Customer implied probability of maximum potential gain.
/// * `7695` - Break Even. Break even points
/// * `7696` - SPX Delta. Beta Weighted Delta is calculated using the formula; Delta x dollar adjusted beta
/// * `7697` - Futures Open Interest. Total number of outstanding futures contracts
/// * `7698` - Last Yield. Implied yield of the bond if it is purchased at the current last price. Last yield is calculated using the Last price on all possible call dates. It is assumed that prepayment occurs if the bond has call or put provisions and the issuer can offer a lower coupon rate based on current market rates. The yield to worst will be the lowest of the yield to maturity or yield to call (if the bond has prepayment provisions). Yield to worse may be the same as yield to maturity but never higher.
/// * `7699` - Bid Yield. Implied yield of the bond if it is purchased at the current bid price. Bid yield is calculated using the Ask on all possible call dates. It is assumed that prepayment occurs if the bond has call or put provisions and the issuer can offer a lower coupon rate based on current market rates. The yield to worst will be the lowest of the yield to maturity or yield to call (if the bond has prepayment provisions). Yield to worse may be the same as yield to maturity but never higher.
/// * `7700` - Probability of Max Return. Customer implied probability of maximum potential gain.
/// * `7702` - Probability of Max Loss. Customer implied probability of maximum potential loss.
/// * `7703` - Profit Probability. Customer implied probability of any gain.
/// * `7704` - Organization Type.
/// * `7705` - Debt Class.
/// * `7706` - Ratings. Ratings issued for bond contract.
/// * `7707` - Bond State Code.
/// * `7708` - Bond Type.
/// * `7714` - Last Trading Date.
/// * `7715` - Issue Date.
/// * `7720` - Ask Yield. Implied yield of the bond if it is purchased at the current offer. Ask yield is calculated using the Bid on all possible call dates. It is assumed that prepayment occurs if the bond has call or put provisions and the issuer can offer a lower coupon rate based on current market rates. The yield to worst will be the lowest of the yield to maturity or yield to call (if the bond has prepayment provisions). Yield to worse may be the same as yield to maturity but never higher.
/// * `7741` - Prior Close. Yesterday's closing price
/// * `7762` - Volume Long. High precision volume for the day. For formatted volume refer to field 87.
/// * `7768` - hasTradingPermissions. if user has trading permissions for specified contract. Returns 1(true) or 0(false).
/// * `7899` - Stock Type. Determines the stock type. Includes: Common, CORP, ADR, ETF, ETN, EFN, REIT, CEF, ETMF.
/// * `7920` - Daily PnL Raw. Your profit or loss of the day since prior close. Daily PnL is calculated with real-time market data (even when not subscribed to market data).
/// * `7921` - Cost Basis Raw. Your current position in this security multiplied by the average price and and multiplier.
/// * `7943` - Rebate Rate. Fed funds or other currency-relevant Benchmark rate minus the interest rate charged on borrowed shares.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum MdFields {
#[serde(rename = "31")]
#[default]
T31,
#[serde(rename = "55")]
T55,
#[serde(rename = "58")]
T58,
#[serde(rename = "70")]
T70,
#[serde(rename = "71")]
T71,
#[serde(rename = "73")]
T73,
#[serde(rename = "74")]
T74,
#[serde(rename = "75")]
T75,
#[serde(rename = "76")]
T76,
#[serde(rename = "77")]
T77,
#[serde(rename = "78")]
T78,
#[serde(rename = "79")]
T79,
#[serde(rename = "80")]
T80,
#[serde(rename = "82")]
T82,
#[serde(rename = "83")]
T83,
#[serde(rename = "84")]
T84,
#[serde(rename = "85")]
T85,
#[serde(rename = "86")]
T86,
#[serde(rename = "87")]
T87,
#[serde(rename = "88")]
T88,
#[serde(rename = "6004")]
T6004,
#[serde(rename = "6008")]
T6008,
#[serde(rename = "6070")]
T6070,
#[serde(rename = "6072")]
T6072,
#[serde(rename = "6073")]
T6073,
#[serde(rename = "6119")]
T6119,
#[serde(rename = "6457")]
T6457,
#[serde(rename = "6508")]
T6508,
#[serde(rename = "6509")]
T6509,
#[serde(rename = "7051")]
T7051,
#[serde(rename = "7057")]
T7057,
#[serde(rename = "7058")]
T7058,
#[serde(rename = "7059")]
T7059,
#[serde(rename = "7068")]
T7068,
#[serde(rename = "7084")]
T7084,
#[serde(rename = "7085")]
T7085,
#[serde(rename = "7086")]
T7086,
#[serde(rename = "7087")]
T7087,
#[serde(rename = "7088")]
T7088,
#[serde(rename = "7089")]
T7089,
#[serde(rename = "7094")]
T7094,
#[serde(rename = "7184")]
T7184,
#[serde(rename = "7219")]
T7219,
#[serde(rename = "7220")]
T7220,
#[serde(rename = "7221")]
T7221,
#[serde(rename = "7280")]
T7280,
#[serde(rename = "7281")]
T7281,
#[serde(rename = "7282")]
T7282,
#[serde(rename = "7283")]
T7283,
#[serde(rename = "7284")]
T7284,
#[serde(rename = "7285")]
T7285,
#[serde(rename = "7292")]
T7292,
#[serde(rename = "7293")]
T7293,
#[serde(rename = "7294")]
T7294,
#[serde(rename = "7295")]
T7295,
#[serde(rename = "7296")]
T7296,
#[serde(rename = "7308")]
T7308,
#[serde(rename = "7309")]
T7309,
#[serde(rename = "7310")]
T7310,
#[serde(rename = "7311")]
T7311,
#[serde(rename = "7607")]
T7607,
#[serde(rename = "7633")]
T7633,
#[serde(rename = "7635")]
T7635,
#[serde(rename = "7636")]
T7636,
#[serde(rename = "7637")]
T7637,
#[serde(rename = "7638")]
T7638,
#[serde(rename = "7639")]
T7639,
#[serde(rename = "7644")]
T7644,
#[serde(rename = "7671")]
T7671,
#[serde(rename = "7672")]
T7672,
#[serde(rename = "7674")]
T7674,
#[serde(rename = "7675")]
T7675,
#[serde(rename = "7676")]
T7676,
#[serde(rename = "7677")]
T7677,
#[serde(rename = "7678")]
T7678,
#[serde(rename = "7679")]
T7679,
#[serde(rename = "7724")]
T7724,
#[serde(rename = "7681")]
T7681,
#[serde(rename = "7682")]
T7682,
#[serde(rename = "7683")]
T7683,
#[serde(rename = "7684")]
T7684,
#[serde(rename = "7685")]
T7685,
#[serde(rename = "7686")]
T7686,
#[serde(rename = "7687")]
T7687,
#[serde(rename = "7688")]
T7688,
#[serde(rename = "7689")]
T7689,
#[serde(rename = "7690")]
T7690,
#[serde(rename = "7694")]
T7694,
#[serde(rename = "7695")]
T7695,
#[serde(rename = "7696")]
T7696,
#[serde(rename = "7697")]
T7697,
#[serde(rename = "7698")]
T7698,
#[serde(rename = "7699")]
T7699,
#[serde(rename = "7700")]
T7700,
#[serde(rename = "7702")]
T7702,
#[serde(rename = "7703")]
T7703,
#[serde(rename = "7704")]
T7704,
#[serde(rename = "7705")]
T7705,
#[serde(rename = "7706")]
T7706,
#[serde(rename = "7707")]
T7707,
#[serde(rename = "7708")]
T7708,
#[serde(rename = "7714")]
T7714,
#[serde(rename = "7715")]
T7715,
#[serde(rename = "7720")]
T7720,
#[serde(rename = "7741")]
T7741,
#[serde(rename = "7762")]
T7762,
#[serde(rename = "7768")]
T7768,
#[serde(rename = "7920")]
T7920,
#[serde(rename = "7921")]
T7921,
#[serde(rename = "7943")]
T7943,
}
impl core::fmt::Display for MdFields {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::T31 => write!(f, "31"),
Self::T55 => write!(f, "55"),
Self::T58 => write!(f, "58"),
Self::T70 => write!(f, "70"),
Self::T71 => write!(f, "71"),
Self::T73 => write!(f, "73"),
Self::T74 => write!(f, "74"),
Self::T75 => write!(f, "75"),
Self::T76 => write!(f, "76"),
Self::T77 => write!(f, "77"),
Self::T78 => write!(f, "78"),
Self::T79 => write!(f, "79"),
Self::T80 => write!(f, "80"),
Self::T82 => write!(f, "82"),
Self::T83 => write!(f, "83"),
Self::T84 => write!(f, "84"),
Self::T85 => write!(f, "85"),
Self::T86 => write!(f, "86"),
Self::T87 => write!(f, "87"),
Self::T88 => write!(f, "88"),
Self::T6004 => write!(f, "6004"),
Self::T6008 => write!(f, "6008"),
Self::T6070 => write!(f, "6070"),
Self::T6072 => write!(f, "6072"),
Self::T6073 => write!(f, "6073"),
Self::T6119 => write!(f, "6119"),
Self::T6457 => write!(f, "6457"),
Self::T6508 => write!(f, "6508"),
Self::T6509 => write!(f, "6509"),
Self::T7051 => write!(f, "7051"),
Self::T7057 => write!(f, "7057"),
Self::T7058 => write!(f, "7058"),
Self::T7059 => write!(f, "7059"),
Self::T7068 => write!(f, "7068"),
Self::T7084 => write!(f, "7084"),
Self::T7085 => write!(f, "7085"),
Self::T7086 => write!(f, "7086"),
Self::T7087 => write!(f, "7087"),
Self::T7088 => write!(f, "7088"),
Self::T7089 => write!(f, "7089"),
Self::T7094 => write!(f, "7094"),
Self::T7184 => write!(f, "7184"),
Self::T7219 => write!(f, "7219"),
Self::T7220 => write!(f, "7220"),
Self::T7221 => write!(f, "7221"),
Self::T7280 => write!(f, "7280"),
Self::T7281 => write!(f, "7281"),
Self::T7282 => write!(f, "7282"),
Self::T7283 => write!(f, "7283"),
Self::T7284 => write!(f, "7284"),
Self::T7285 => write!(f, "7285"),
Self::T7292 => write!(f, "7292"),
Self::T7293 => write!(f, "7293"),
Self::T7294 => write!(f, "7294"),
Self::T7295 => write!(f, "7295"),
Self::T7296 => write!(f, "7296"),
Self::T7308 => write!(f, "7308"),
Self::T7309 => write!(f, "7309"),
Self::T7310 => write!(f, "7310"),
Self::T7311 => write!(f, "7311"),
Self::T7607 => write!(f, "7607"),
Self::T7633 => write!(f, "7633"),
Self::T7635 => write!(f, "7635"),
Self::T7636 => write!(f, "7636"),
Self::T7637 => write!(f, "7637"),
Self::T7638 => write!(f, "7638"),
Self::T7639 => write!(f, "7639"),
Self::T7644 => write!(f, "7644"),
Self::T7671 => write!(f, "7671"),
Self::T7672 => write!(f, "7672"),
Self::T7674 => write!(f, "7674"),
Self::T7675 => write!(f, "7675"),
Self::T7676 => write!(f, "7676"),
Self::T7677 => write!(f, "7677"),
Self::T7678 => write!(f, "7678"),
Self::T7679 => write!(f, "7679"),
Self::T7724 => write!(f, "7724"),
Self::T7681 => write!(f, "7681"),
Self::T7682 => write!(f, "7682"),
Self::T7683 => write!(f, "7683"),
Self::T7684 => write!(f, "7684"),
Self::T7685 => write!(f, "7685"),
Self::T7686 => write!(f, "7686"),
Self::T7687 => write!(f, "7687"),
Self::T7688 => write!(f, "7688"),
Self::T7689 => write!(f, "7689"),
Self::T7690 => write!(f, "7690"),
Self::T7694 => write!(f, "7694"),
Self::T7695 => write!(f, "7695"),
Self::T7696 => write!(f, "7696"),
Self::T7697 => write!(f, "7697"),
Self::T7698 => write!(f, "7698"),
Self::T7699 => write!(f, "7699"),
Self::T7700 => write!(f, "7700"),
Self::T7702 => write!(f, "7702"),
Self::T7703 => write!(f, "7703"),
Self::T7704 => write!(f, "7704"),
Self::T7705 => write!(f, "7705"),
Self::T7706 => write!(f, "7706"),
Self::T7707 => write!(f, "7707"),
Self::T7708 => write!(f, "7708"),
Self::T7714 => write!(f, "7714"),
Self::T7715 => write!(f, "7715"),
Self::T7720 => write!(f, "7720"),
Self::T7741 => write!(f, "7741"),
Self::T7762 => write!(f, "7762"),
Self::T7768 => write!(f, "7768"),
Self::T7920 => write!(f, "7920"),
Self::T7921 => write!(f, "7921"),
Self::T7943 => write!(f, "7943"),
}
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct MessageIdRequestBody {
/// Array of order reply messageId identifier strings to be suppressed.
#[serde(rename = "messageIds")]
pub message_ids: Option<Vec<MessageIdRequestBodyMessageId>>,
}
/// A warning message to be pre-approved.
/// * `o163` - The following order exceeds the price percentage limit
/// * `o354` - """You are submitting an order without market data. We strongly recommend against this as it may result in erroneous and unexpected trades. Are you sure you want to submit this order?"""
/// * `o382` - The following value exceeds the tick size limit
/// * `o383` - """The following order \""BUY 650 AAPL NASDAQ.NMS\"" size exceeds the Size Limit of 500.
/// Are you sure you want to submit this order?"""
/// * `o403` - """This order will most likely trigger and fill immediately.
/// Are you sure you want to submit this order?"""
/// * `o451` - """The following order \""BUY 650 AAPL NASDAQ.NMS\"" value estimate of 124,995.00 USD exceeds
/// the Total Value Limit of 100,000 USD.
/// Are you sure you want to submit this order?"""
/// * `o2136` - Mixed allocation order warning
/// * `o2137` - Cross side order warning
/// * `o2165` - Warns that instrument does not support trading in fractions outside regular trading hours
/// * `o10082` - Called Bond warning
/// * `o10138` - The following order size modification exceeds the size modification limit.
/// * `o10151` - Warns about risks with Market Orders
/// * `o10152` - Warns about risks associated with stop orders once they become active
/// * `o10153` - <h4>Confirm Mandatory Cap Price</h4>To avoid trading at a price that is not consistent with a fair and orderly market, IB may set a cap (for a buy order) or sell order). THIS MAY CAUSE AN ORDER THAT WOULD OTHERWISE BE MARKETABLE TO NOT BE TRADED.
/// * `o10164` - """Traders are responsible for understanding cash quantity details, which are provided on a best efforts basis only."""
/// * `o10223` - """<h4>Cash Quantity Order Confirmation</h4>Orders that express size using a monetary value (cash quantity) are provided on a non-guaranteed basis. The system simulates the order by cancelling it once the specified amount is spent (for buy orders) or collected (for sell orders). In addition to the monetary value, the order uses a maximum size that is calculated using the Cash Quantity Estimate Factor, which you can modify in Presets."""
/// * `o10288` - Warns about risks associated with market orders for Crypto
/// * `o10331` - """You are about to submit a stop order. Please be aware of the various stop order types available and the risks associated with each one.
/// Are you sure you want to submit this order?"""
/// * `o10332` - OSL Digital Securities LTD Crypto Order Warning
/// * `o10333` - Option Exercise at the Money warning
/// * `o10334` - Warns that order will be placed into current omnibus account instead of currently selected global account.
/// * `o10335` - Serves internal Rapid Entry window.
/// * `o10336` - This security has limited liquidity. If you choose to trade this security, there is a heightened risk that you may not be able to close your position at the time you wish, at a price you wish, and/or without incurring a loss. Confirm that you understand the risks of trading illiquid securities.
/// * `Are you sure you want to submit this order?
/// * `p6` - This order will be distributed over multiple accounts. We strongly suggest you familiarize yourself with our allocation facilities before submitting orders.
/// * `p12` - "If your order is not immediately executable, our systems may, depending on market conditions, reject your order if its limit price is more than the allowed amount away from the reference price at that time. If this happens, you will not receive a fill. This is a control designed to ensure that we comply with our regulatory obligations to avoid submitting disruptive orders to the marketplace.\
/// Use the Price Management Algo?"
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum MessageIdRequestBodyMessageId {
#[serde(rename = "o163")]
#[default]
O163,
#[serde(rename = "o354")]
O354,
#[serde(rename = "o382")]
O382,
#[serde(rename = "o383")]
O383,
#[serde(rename = "o403")]
O403,
#[serde(rename = "o451")]
O451,
#[serde(rename = "o2136")]
O2136,
#[serde(rename = "o2137")]
O2137,
#[serde(rename = "o2165")]
O2165,
#[serde(rename = "o10082")]
O10082,
#[serde(rename = "o10138")]
O10138,
#[serde(rename = "o10151")]
O10151,
#[serde(rename = "o10152")]
O10152,
#[serde(rename = "o10153")]
O10153,
#[serde(rename = "o10164")]
O10164,
#[serde(rename = "o10223")]
O10223,
#[serde(rename = "o10288")]
O10288,
#[serde(rename = "o10331")]
O10331,
#[serde(rename = "o10332")]
O10332,
#[serde(rename = "o10333")]
O10333,
#[serde(rename = "o10334")]
O10334,
#[serde(rename = "o10335")]
O10335,
#[serde(rename = "o10336")]
O10336,
#[serde(rename = "p6")]
P6,
#[serde(rename = "p12")]
P12,
}
impl core::fmt::Display for MessageIdRequestBodyMessageId {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::O163 => write!(f, "o163"),
Self::O354 => write!(f, "o354"),
Self::O382 => write!(f, "o382"),
Self::O383 => write!(f, "o383"),
Self::O403 => write!(f, "o403"),
Self::O451 => write!(f, "o451"),
Self::O2136 => write!(f, "o2136"),
Self::O2137 => write!(f, "o2137"),
Self::O2165 => write!(f, "o2165"),
Self::O10082 => write!(f, "o10082"),
Self::O10138 => write!(f, "o10138"),
Self::O10151 => write!(f, "o10151"),
Self::O10152 => write!(f, "o10152"),
Self::O10153 => write!(f, "o10153"),
Self::O10164 => write!(f, "o10164"),
Self::O10223 => write!(f, "o10223"),
Self::O10288 => write!(f, "o10288"),
Self::O10331 => write!(f, "o10331"),
Self::O10332 => write!(f, "o10332"),
Self::O10333 => write!(f, "o10333"),
Self::O10334 => write!(f, "o10334"),
Self::O10335 => write!(f, "o10335"),
Self::O10336 => write!(f, "o10336"),
Self::P6 => write!(f, "p6"),
Self::P12 => write!(f, "p12"),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct MessageResponse {
/// Indicates success or failure of request to discard cached positions.
pub message: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ModelListResponse {
/// Base currency of the established model.
#[serde(rename = "baseCcy")]
pub base_ccy: Option<String>,
/// Advisor account responsible for the model.
#[serde(rename = "masterAccount")]
pub master_account: Option<String>,
/// List of all models held under the masterAccount.
pub models: Option<Vec<ModelListResponseItem>>,
/// Request identifier to uniquely track a request.
/// - Example: `Some(540_607i32)`
#[serde(rename = "reqID")]
pub req_id: Option<i32>,
/// Describes if the model is in polling mode.
#[serde(rename = "subscriptionStatus")]
pub subscription_status: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ModelListResponseItem {
/// Used internally for client portal designation. Should be ignored.
pub bootstrapped: Option<bool>,
/// Used internally for client portal. Should be ignored.
#[serde(rename = "customIndex")]
pub custom_index: Option<bool>,
/// Personal description of model to read in IBKR GUI elements.
pub desc: Option<String>,
/// Determine if investing and rebalancing should be handled statically or dynamically. * `true` - Static models will always use the original targets. * `false` - Dynamic models will adjust allocation in response to market movements.
#[serde(rename = "isStatic")]
pub is_static: Option<bool>,
/// Notes if the Actual allocation has become misalligned with the Target.
pub mismatch: Option<bool>,
/// Name of the model.
pub model: Option<String>,
/// Market value of the model.
pub nlv: Option<f64>,
/// Lists the number of accounts held within the model.
#[serde(rename = "numAccounts")]
pub num_accounts: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ModelPositionResponse {
/// An object representing each currency held in the model.
pub cash: Option<Vec<ModelPositionResponseCash>>,
/// Notes if the Actual allocation has become misalligned with the Target.
pub mismatched: Option<bool>,
/// Name of the model.
pub model: Option<String>,
/// Market value of the model.
pub nlv: Option<f64>,
/// List of object containing each equity in the model.
#[serde(rename = "positionList")]
pub position_list: Option<Vec<ModelPositionResponsePositionList>>,
/// Epoch timestamp when the position was retrieved.
#[serde(rename = "positionTs")]
pub position_ts: Option<i64>,
/// Request identifier to uniquely track a request.
#[serde(rename = "reqID")]
pub req_id: Option<i32>,
/// Describes if the model contains only stocks.
#[serde(rename = "stkOnly")]
pub stk_only: Option<bool>,
/// Describes if the model is in polling mode.
#[serde(rename = "subscriptionStatus")]
pub subscription_status: Option<i32>,
/// Diplayed total liquidation value of the model.
#[serde(rename = "totalDlv")]
pub total_dlv: Option<f64>,
/// Market value of the entire position.
#[serde(rename = "totalMv")]
pub total_mv: Option<f64>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ModelPositionResponseCash {
/// Actual percent of the model held in the postion.
pub actual: Option<f64>,
/// Currency symbol.
pub ccy: Option<String>,
/// Exchange rate of the account base currency to the model base currency.
#[serde(rename = "exchangeRate")]
pub exchange_rate: Option<f64>,
/// Describes the percentage of imbalance of the actual allocation from the model.
#[serde(rename = "instrumentImbalance")]
pub instrument_imbalance: Option<f64>,
/// Market value of the position.
pub mv: Option<f64>,
/// Target percentage of the model to hold in the position.
pub target: Option<f64>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ModelPositionResponsePositionList {
/// Actual percent of the model held in the postion.
pub actual: Option<f64>,
/// Maximum accepted tolerance above the target.
#[serde(rename = "actualRangeMax")]
pub actual_range_max: Option<f64>,
/// Minimum accepted tolerance below the target.
#[serde(rename = "actualRangeMin")]
pub actual_range_min: Option<f64>,
/// Currency symbol.
pub ccy: Option<String>,
/// Contract identifier for the instrument.
pub conid: Option<f64>,
/// Displayed liquidation value.
pub dlv: Option<f64>,
/// Used internally for client portal. Should be ignored.
#[serde(rename = "exchangeRate")]
pub exchange_rate: Option<f64>,
/// Used internally for client portal. Should be ignored.
pub flags: Option<i32>,
/// Symbol of the position.
pub instrument: Option<String>,
/// Describes the percentage of imbalance of the actual allocation from the model.
#[serde(rename = "instrumentImbalance")]
pub instrument_imbalance: Option<f64>,
/// Used internally for client portal. Should be ignored.
#[serde(rename = "mismatchType")]
pub mismatch_type: Option<f64>,
/// Market Value.
pub mv: Option<f64>,
/// The total size of the position held in the model.
pub position: Option<f64>,
/// The desired allocation percentage of the position in the model.
pub target: Option<f64>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
pub struct ModelPresetsResponse {
/// Avoid negative offsetting cash in Independent
#[serde(rename = "avoidNegativeCashInIndependent")]
pub avoid_negative_cash_in_independent: Option<bool>,
/// Close out the full position while divesting.
#[serde(rename = "closeDivestIndependentPosition")]
pub close_divest_independent_position: Option<bool>,
/// Use the maximum avialble funds to increase long positions.
#[serde(rename = "fullyInvestExistingLongPositions")]
pub fully_invest_existing_long_positions: Option<bool>,
/// Keep model open for fully divested accounts.
#[serde(rename = "keepModelOpen")]
pub keep_model_open: Option<bool>,
/// Transfer positions to Independent instead of liquidating.
#[serde(rename = "preferCrossWithIndependent")]
pub prefer_cross_with_independent: Option<bool>,
/// Transfer positions from Independent structure when possible.
#[serde(rename = "preferTransferFromIndependent")]
pub prefer_transfer_from_independent: Option<bool>,
/// Request identifier to uniquely track a request.
#[serde(rename = "reqID")]
pub req_id: Option<i32>,
/// Determine if allocation quantities should be handled by lot size.
#[serde(rename = "roundAllocationQuantityToExchangeBoardLot")]
pub round_allocation_quantity_to_exchange_board_lot: Option<bool>,
/// Describes if the model is in polling mode.
#[serde(rename = "subscriptionStatus")]
pub subscription_status: Option<i32>,
/// Use non-base balances when available.
#[serde(rename = "useNonBaseCcy")]
pub use_non_base_ccy: Option<bool>,
/// Designate of tolerance ranges should be used for rebalancing.
#[serde(rename = "useToleranceRange")]
pub use_tolerance_range: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ModelSummaryResponse {
/// Used internally for client portal designation. Should be ignored.
pub bootstrapped: Option<bool>,
/// Used internally for client portal. Should be ignored.
#[serde(rename = "customIndex")]
pub custom_index: Option<bool>,
/// Personal description of model to read in IBKR GUI elements.
pub desc: Option<String>,
/// Determine if investing and rebalancing should be handled statically or dynamically. * `true` - Static models will always use the original targets. * `false` - Dynamic models will adjust allocation in response to market movements.
#[serde(rename = "isStatic")]
pub is_static: Option<bool>,
/// Notes if the Actual allocation has become misalligned with the Target.
pub mismatch: Option<bool>,
/// Name of the model.
pub model: Option<String>,
/// Net Liquidation of the model.
pub nlv: Option<f64>,
/// Lists the number of accounts held within the model.
#[serde(rename = "numAccounts")]
pub num_accounts: Option<i32>,
/// Request identifier to uniquely track a request.
/// - Example: `Some(540_609i32)`
#[serde(rename = "reqID")]
pub req_id: Option<i32>,
/// Describes if the model is in polling mode.
#[serde(rename = "subscriptionStatus")]
pub subscription_status: Option<i32>,
}
/// Modify an existing allocation group.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct ModifyAllocationGroupRequest {
#[validate(nested)]
pub body: GroupRequestBody,
}
impl ModifyAllocationGroupRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<CreateAllocationGroupResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<SuccessResponse>::json_with_diagnostics(req)
.await?;
return Ok(CreateAllocationGroupResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(CreateAllocationGroupResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(CreateAllocationGroupResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(CreateAllocationGroupResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(CreateAllocationGroupResponse::Unknown);
}
}
/// Choose whether a particular device is enabled or disabled.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct ModifyFyiDeliveryRequest {
pub body: FyiEnableDeviceOption,
}
impl ModifyFyiDeliveryRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<ModifyFyiDeliveryResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<FyiVT>::json_with_diagnostics(req).await?;
return Ok(ModifyFyiDeliveryResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(ModifyFyiDeliveryResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(ModifyFyiDeliveryResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(ModifyFyiDeliveryResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(ModifyFyiDeliveryResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(ModifyFyiDeliveryResponse::Unknown);
}
}
/// Response types for modifyFyiDelivery
#[derive(Debug, Clone)]
pub enum ModifyFyiDeliveryResponse {
///200: Successfully retrieve preset details
Ok(FyiVT),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Enable or disable your account's primary email to receive notifications.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct ModifyFyiEmailsRequest {
pub query: ModifyFyiEmailsRequestQuery,
}
impl ModifyFyiEmailsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<ModifyFyiEmailsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<FyiVT>::json_with_diagnostics(req).await?;
return Ok(ModifyFyiEmailsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(ModifyFyiEmailsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(ModifyFyiEmailsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(ModifyFyiEmailsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(ModifyFyiEmailsResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct ModifyFyiEmailsRequestQuery {
/// Enable or disable your email. Value format: true: Enable; false: Disable
pub enabled: serde_json::Value,
}
/// Response types for modifyFyiEmails
#[derive(Debug, Clone)]
pub enum ModifyFyiEmailsResponse {
///200: Successfully enabled or disabled your email notifications.
Ok(FyiVT),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Enable or disable group of notifications by the specific typecode.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct ModifyFyiNotificationRequest {
pub path: ModifyFyiNotificationRequestPath,
pub body: EnabledRequestBody,
}
impl ModifyFyiNotificationRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<ModifyFyiEmailsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<FyiVT>::json_with_diagnostics(req).await?;
return Ok(ModifyFyiEmailsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(ModifyFyiEmailsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(ModifyFyiEmailsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(ModifyFyiEmailsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(ModifyFyiEmailsResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, oas3_gen_support::Default)]
pub struct ModifyFyiNotificationRequestPath {
/// Many FYI endpoints reference a "typecode" value. The table below lists the available codes and what they correspond to.
/// * `BA` - Borrow Availability
/// * `CA` - Comparable Algo
/// * `DA` - Dividends Advisory
/// * `EA` - Upcoming Earnings
/// * `MF` - Mutual Fund Advisory
/// * `OE` - Option Expiration
/// * `PR` - Portfolio Builder Rebalance
/// * `SE` - Suspend Order on Economic Event
/// * `SG` - Short Term Gain turning Long Term
/// * `SM` - System Messages
/// * `T2` - Assignment Realizing Long-Term Gains
/// * `TO` - Takeover
/// * `UA` - User Alert
/// * `M8` - M871 Trades
/// * `PS` - Platform Use Suggestions
/// * `DL` - Unexercised Option Loss Prevention Reminder
/// * `PT` - Position Transfer
/// * `CB` - Missing Cost Basis
/// * `MS` - Milestones
/// * `TD` - MiFID || 10% Deprecation Notice
/// * `ST` - Save Taxes
/// * `TI` - Trade Idea
/// * `CT` - Cash Transfer
pub typecode: Typecodes,
}
/// Modify an existing, unfilled order.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct ModifyOpenOrderRequest {
#[validate(nested)]
pub path: ModifyOpenOrderRequestPath,
#[validate(nested)]
pub body: SingleOrderSubmissionRequest,
}
impl ModifyOpenOrderRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<ModifyOpenOrderResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Order200Response>::json_with_diagnostics(req)
.await?;
return Ok(ModifyOpenOrderResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(ModifyOpenOrderResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(ModifyOpenOrderResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(ModifyOpenOrderResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(ModifyOpenOrderResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(ModifyOpenOrderResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct ModifyOpenOrderRequestPath {
/// The account to which the order will clear.
/// - Example: `"DU123456".to_string()`
#[validate(length(min = 1u64))]
pub account_id: String,
/// The IB-assigned order ID of the desired order ticket.
/// - Example: `1_799_796_559i32`
pub order_id: i32,
}
/// Response types for modifyOpenOrder
#[derive(Debug, Clone)]
pub enum ModifyOpenOrderResponse {
///200: Status of submission
Ok(Order200Response),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct NameRequestBody {
/// Name of an existing allocation group.
/// - Example: `"Group_1_NetLiq".to_string()`
#[validate(length(min = 1u64))]
pub name: String,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct NonDisclosedDetail {
/// - Example: `Some("320043".to_string())`
#[serde(rename = "buyerSellBic")]
#[validate(length(min = 0u64, max = 64u64))]
pub buyer_sell_bic: Option<String>,
/// - Example: `Some("123456".to_string())`
#[serde(rename = "memberAccountId")]
#[validate(length(min = 0u64, max = 64u64))]
pub member_account_id: Option<String>,
/// - Example: `Some("DTCYUS33XXX".to_string())`
#[serde(rename = "psetBic")]
#[validate(length(min = 0u64, max = 64u64))]
pub pset_bic: Option<String>,
/// - Example: `Some("CH100164".to_string())`
#[serde(rename = "reagDeagBic")]
#[validate(length(min = 0u64, max = 64u64))]
pub reag_deag_bic: Option<String>,
/// - Example: `Some("123456".to_string())`
#[serde(rename = "safeKeepingAccountId")]
#[validate(length(min = 0u64, max = 64u64))]
pub safe_keeping_account_id: Option<String>,
/// - Example: `"2023-07-18".to_string()`
#[serde(rename = "settleDate")]
#[validate(length(min = 1u64))]
pub settle_date: String,
/// - Example: `"2023-07-08".to_string()`
#[serde(rename = "tradeDate")]
#[validate(length(min = 1u64))]
pub trade_date: String,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct NotificationReadAcknowledge {
/// Returns details about the notification read status.
#[serde(rename = "P")]
pub p: Option<NotificationReadAcknowledgeP>,
/// Returns the time in ms to complete the edit.
#[serde(rename = "T")]
pub t: Option<i32>,
/// Returns 1 to state message was acknowledged.
#[serde(rename = "V")]
pub v: Option<i32>,
}
/// Returns details about the notification read status.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct NotificationReadAcknowledgeP {
/// Returns the ID for the notification.
#[serde(rename = "ID")]
pub id: Option<String>,
/// Returns if the message was read (1) or unread (0).
#[serde(rename = "R")]
pub r: Option<i32>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct NotificationRequestBody {
/// IB-assigned order identifier obtained from the ntf websocket message that delivered the server prompt.
/// - Example: `Some(987_654_321i32)`
#[serde(rename = "orderId")]
pub order_id: Option<i32>,
/// IB-assigned request identifier obtained from the ntf websocket message that delivered the server prompt.
/// - Example: `Some("12345".to_string())`
#[serde(rename = "reqId")]
pub req_id: Option<String>,
/// The selected value from the "options" array delivered in the server prompt ntf websocket message.
/// - Example: `Some("Yes".to_string())`
pub text: Option<String>,
}
pub type Notifications = Vec<NotificationsNotification>;
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct NotificationsNotification {
/// Notification date as an epoch string.
#[serde(rename = "D")]
pub d: Option<String>,
/// FYI code, we can use it to find whether the disclaimer is accepted or not in settings
#[serde(rename = "FC")]
pub fc: Option<String>,
/// HT
/// - Example: `Some(0i32)`
#[serde(rename = "HT")]
pub ht: Option<i32>,
/// Unique way to reference the notification.
#[serde(rename = "ID")]
pub id: Option<String>,
/// Content of notification.
#[serde(rename = "MD")]
pub md: Option<String>,
/// Title of notification.
#[serde(rename = "MS")]
pub ms: Option<String>,
/// Return if the notification was read or not. Value Format: 0: Disabled; 1: Enabled.
#[serde(rename = "R")]
pub r: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct OauthTokenResponse {
/// Temporary OAuth access token. 20 character hex value.
pub oauth_token: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum Order200Response {
/// A successful submission of one or more order tickets.
#[default]
OrderSubmitSuccess(OrderSubmitSuccess),
/// Indicates that the order reply message or submission was not accepted.
OrderSubmitError(OrderSubmitError),
/// An array containing objects that each deliver the order reply messages emitted against one order ticket in the submission request's array. Indicies of the order reply message objects in this array correspond to the indicies of the order tickets in the submission request's array.
OrderReplyMessage(OrderReplyMessage),
/// Relates a message generated in response to the rejection of the submitted order ticket. In some cases, it may also present a mechanism to resubmit the same order following a prompted decision.
AdvancedOrderReject(AdvancedOrderReject),
}
impl Order200Response {
/// Indicates that the order reply message or submission was not accepted.
pub fn order_submit_error(error: Option<String>) -> Self {
Self::OrderSubmitError(OrderSubmitError {
error,
..Default::default()
})
}
/// Relates a message generated in response to the rejection of the submitted order ticket. In some cases, it may also present a mechanism to resubmit the same order following a prompted decision.
pub fn advanced_order_reject() -> Self {
Self::AdvancedOrderReject(AdvancedOrderReject::default())
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum Order200Response2 {
/// Acknowledges IB's acceptance of the request to cancel the order. Does not report whether the cancellation can or will ultimately be enacted.
#[default]
CancelSuccess(OrderCancelSuccess),
/// Indicates that the order reply message or submission was not accepted.
SubmitError(OrderSubmitError),
}
impl Order200Response2 {
/// Acknowledges IB's acceptance of the request to cancel the order. Does not report whether the cancellation can or will ultimately be enacted.
pub fn cancel_success() -> Self {
Self::CancelSuccess(OrderCancelSuccess::default())
}
/// Indicates that the order reply message or submission was not accepted.
pub fn submit_error(error: Option<String>) -> Self {
Self::SubmitError(OrderSubmitError {
error,
..Default::default()
})
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum Order200Response3 {
/// A successful submission of one or more order tickets.
#[default]
OrderSubmitSuccess(OrderSubmitSuccess),
/// An array containing objects that each deliver the order reply messages emitted against one order ticket in the submission request's array. Indicies of the order reply message objects in this array correspond to the indicies of the order tickets in the submission request's array.
OrderReplyMessage(OrderReplyMessage),
/// Indicates that the order reply message or submission was not accepted.
OrderSubmitError(OrderSubmitError),
/// Relates a message generated in response to the rejection of the submitted order ticket. In some cases, it may also present a mechanism to resubmit the same order following a prompted decision.
AdvancedOrderReject(AdvancedOrderReject),
}
impl Order200Response3 {
/// Indicates that the order reply message or submission was not accepted.
pub fn order_submit_error(error: Option<String>) -> Self {
Self::OrderSubmitError(OrderSubmitError {
error,
..Default::default()
})
}
/// Relates a message generated in response to the rejection of the submitted order ticket. In some cases, it may also present a mechanism to resubmit the same order following a prompted decision.
pub fn advanced_order_reject() -> Self {
Self::AdvancedOrderReject(AdvancedOrderReject::default())
}
}
/// Acknowledges IB's acceptance of the request to cancel the order. Does not report whether the cancellation can or will ultimately be enacted.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(default)]
pub struct OrderCancelSuccess {
/// IB account to which the order was originally set to clear.
pub account: Option<String>,
/// IB contract ID of the order ticket's instrument.
pub conid: Option<String>,
/// Indicates success with value 'Request was submitted'
#[default(Some("Request was submitted".to_string()))]
pub msg: Option<String>,
/// IB order ID of the order ticket requested for cancellation.
pub order_id: Option<String>,
}
/// Projected costs and changes to margin and equity values in the account, if the order ticket were executed in full.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct OrderPreview {
/// Describes the projected costs associated with the order ticket.
pub amount: Option<OrderPreviewAmount>,
/// Describes the projected change to the account's equity.
pub equity: Option<OrderPreviewEquity>,
/// Human-readable text of an error message, if applicable. Otherwise null.
pub error: Option<String>,
/// Describes the projected change to initial margin.
pub initial: Option<OrderPreviewInitial>,
/// Describes the projected change to maintenance margin.
pub maintenance: Option<OrderPreviewMaintenance>,
/// Describes the projected change to the account's position in the instrument.
pub position: Option<OrderPreviewPosition>,
/// Human-readable text of warning message, if applicable. Otherwise null.
pub warn: Option<String>,
}
/// Describes the projected costs associated with the order ticket.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct OrderPreviewAmount {
/// Projected cost of the order, current reference price times total quantity.
pub amount: Option<String>,
/// Projected commissions and fees associated with the order.
pub commission: Option<String>,
/// Sum of projected cost and commission values for the order.
pub total: Option<String>,
}
/// Describes the projected change to the account's equity.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct OrderPreviewEquity {
/// Projected equity after execution of the order.
pub after: Option<String>,
/// Difference between current and projected equity values.
pub change: Option<String>,
/// Current equity.
pub current: Option<String>,
}
/// Describes the projected change to initial margin.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct OrderPreviewInitial {
/// Projected initial margin after execution of the order.
pub after: Option<String>,
/// Difference between current and projected initial margin values.
pub change: Option<String>,
/// Current initial margin.
pub current: Option<String>,
}
/// Describes the projected change to maintenance margin.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct OrderPreviewMaintenance {
/// Projected maintenance margin after execution of the order.
pub after: Option<String>,
/// Difference between current and projected maintenance margin values.
pub change: Option<String>,
/// Current maintenance margin.
pub current: Option<String>,
}
/// Describes the projected change to the account's position in the instrument.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct OrderPreviewPosition {
/// Projected position size after execution of the order.
pub after: Option<String>,
/// Difference between current and projected position sizes.
pub change: Option<String>,
/// Current position in the instrument.
pub current: Option<String>,
}
/// An array containing objects that each deliver the order reply messages emitted against one order ticket in the submission request's array. Indicies of the order reply message objects in this array correspond to the indicies of the order tickets in the submission request's array.
pub type OrderReplyMessage = Vec<OrderReplyMessageOrderReplyMessage>;
/// An object containing order reply messages emitted against a single order ticket.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct OrderReplyMessageOrderReplyMessage {
/// The replyId UUID of the order ticket's emitted order reply messages, used to confirm them and proceed. Use the POST /iserver/reply/{replyId} endpoint to confirm an order reply message.
pub id: Option<String>,
/// Internal use. Always delivers value 'false'.
#[serde(rename = "isSuppressed")]
pub is_suppressed: Option<bool>,
/// An array containing the human-readable text of all order reply messages emitted for the order ticket.
pub message: Option<Vec<String>>,
/// An array containing identifiers that categorize the types of order reply messages that have been emitted. Elements of this array are ordered so that indicies match the corresponding human-readable text strings in the 'message' array. A messageId can typically be passed in the POST /iserver/questions/suppress endpoint to auto-accept a given warning message.
#[serde(rename = "messageIds")]
pub message_ids: Option<Vec<String>>,
}
/// Indicates that the order reply ID does not exist.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct OrderReplyNotFound {
/// Message indicating that order reply id was not found.
pub error: Option<String>,
}
/// Object containing information about the status of an order ticket.
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
pub struct OrderStatus {
/// The account receiving executions against this order ticket.
pub account: Option<String>,
/// Indicates that an alert is active for the order ticket.
pub alert_active: Option<AlertActivationRequestAlertActive>,
/// Indicates whether an identical order on the opposite side can be placed.
pub allowed_duplicate_opposite: Option<bool>,
/// Internal use. Indicates chart periods available for the instrument.
pub available_chart_periods: Option<String>,
/// Average price of fills against the order, if any.
pub average_price: Option<String>,
/// Internal use. IB's UI background color in hex.
#[serde(rename = "bgColor")]
pub bg_color: Option<String>,
/// Indicates whether the order ticket can be cancelled.
pub cannot_cancel_order: Option<bool>,
/// Indicates if the order ticket is hedged, and if so, in what way. 0 = No hedge, A = Attached child hedge order, B = Beta/portfolio hedge
pub child_order_type: Option<OrderStatusChildOrderType>,
/// Name of the company or asset associated with the instrument.
pub company_name: Option<String>,
/// Contract ID of the order's instrument.
pub conid: Option<i32>,
/// Contract ID and routing destination in format 123456@EXCHANGE.
pub conidex: Option<String>,
/// Human-readable description of the order's instrument.
pub contract_description_1: Option<String>,
/// Cumulative filled quantity of the instrument against the order ticket.
pub cum_fill: Option<String>,
/// The currency in which the instrument trades and executions are conducted.
pub currency: Option<String>,
/// Indicates whether the order ticket can be deactivated.
pub deactivate_order: Option<bool>,
/// Indicates which fields of the order ticket can be modified currently.
pub editable_fields: Option<String>,
/// Internal use. A string describing an active Client Portal exit strategy, or the result of its execution.
pub exit_strategy_chart_description: Option<String>,
/// Internal use. The UI-displayed price associated with a Client Portal exist strategy.
pub exit_strategy_display_price: Option<String>,
/// Internal use. Indicates the availability of Client Portal exit strategy tool for the order.
pub exit_strategy_tool_availability: Option<String>,
/// Internal use. IB's UI foreground color in hex.
#[serde(rename = "fgColor")]
pub fg_color: Option<String>,
/// Primary listing exchange of the order ticket's instrument.
pub listing_exchange: Option<String>,
/// Internal use only.
pub option_acct: Option<String>,
/// IB internal order status.
pub order_ccp_status: Option<String>,
/// The IB account to which the order ticket clears.
pub order_clearing_account: Option<String>,
/// Human-readable description of the status or current result of the order ticket, meant for UI presentation.
pub order_description: Option<String>,
/// Human-readable description of the status or current result of the order ticket, meant for UI presentation. Includes instrument name.
pub order_description_with_contract: Option<String>,
/// The IB-assigned order identifier of the order, as provided in the request path.
pub order_id: Option<i32>,
/// Indicates whether the order ticket can be modified.
pub order_not_editable: Option<bool>,
/// Status of the order ticket.
pub order_status: Option<OrderStatusOrderStatus>,
/// Human-readable rendering of the order's status meant for presentation in UI.
pub order_status_description: Option<String>,
/// Time of the order's submission in format YYMMDDhhmmss.
pub order_time: Option<String>,
/// The order's IB order type.
pub order_type: Option<String>,
/// Internal use only. IB-assigned identifier for the status request.
pub request_id: Option<String>,
/// IB asset class identifier.
pub sec_type: Option<OrderStatusSecType>,
/// IB-assigned meta-identifier used to associate rejected and resubmitted orders following Server Prompts.
pub server_id: Option<String>,
/// Side of the order ticket.
pub side: Option<Side>,
/// Remaining unfilled size of the order ticket. Will reflect 0.0 if order is filled in full, cancelled, or otherwise resolved and no longer working.
pub size: Option<String>,
/// A string reflecting the cumulative fills and total size of the order.
pub size_and_fills: Option<String>,
/// Internal use only.
pub sub_type: Option<String>,
/// Symbol of the order ticket's instrument.
pub symbol: Option<String>,
/// Time in force of the order ticket.
pub tif: Option<OrderStatusTif>,
/// The total size of the order ticket.
pub total_size: Option<String>,
}
/// Indicates if the order ticket is hedged, and if so, in what way. 0 = No hedge, A = Attached child hedge order, B = Beta/portfolio hedge
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
pub enum OrderStatusChildOrderType {
#[serde(rename = "0")]
#[default]
T0,
A,
B,
}
impl core::fmt::Display for OrderStatusChildOrderType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::T0 => write!(f, "0"),
Self::A => write!(f, "A"),
Self::B => write!(f, "B"),
}
}
}
/// Status of the order ticket.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
pub enum OrderStatusOrderStatus {
#[default]
Inactive,
PendingSubmit,
PreSubmitted,
Submitted,
Filled,
PendingCancel,
Cancelled,
WarnState,
}
impl core::fmt::Display for OrderStatusOrderStatus {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Inactive => write!(f, "Inactive"),
Self::PendingSubmit => write!(f, "PendingSubmit"),
Self::PreSubmitted => write!(f, "PreSubmitted"),
Self::Submitted => write!(f, "Submitted"),
Self::Filled => write!(f, "Filled"),
Self::PendingCancel => write!(f, "PendingCancel"),
Self::Cancelled => write!(f, "Cancelled"),
Self::WarnState => write!(f, "WarnState"),
}
}
}
/// IB asset class identifier.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
pub enum OrderStatusSecType {
#[serde(rename = "STK")]
#[default]
Stk,
#[serde(rename = "OPT")]
Opt,
#[serde(rename = "FUT")]
Fut,
#[serde(rename = "FOP")]
Fop,
#[serde(rename = "CASH")]
Cash,
#[serde(rename = "CRYPTO")]
Crypto,
#[serde(rename = "BOND")]
Bond,
#[serde(rename = "WAR")]
War,
#[serde(rename = "FUND")]
Fund,
}
impl core::fmt::Display for OrderStatusSecType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Stk => write!(f, "STK"),
Self::Opt => write!(f, "OPT"),
Self::Fut => write!(f, "FUT"),
Self::Fop => write!(f, "FOP"),
Self::Cash => write!(f, "CASH"),
Self::Crypto => write!(f, "CRYPTO"),
Self::Bond => write!(f, "BOND"),
Self::War => write!(f, "WAR"),
Self::Fund => write!(f, "FUND"),
}
}
}
/// Time in force of the order ticket.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
pub enum OrderStatusTif {
#[serde(rename = "DAY")]
#[default]
Day,
#[serde(rename = "IOC")]
Ioc,
#[serde(rename = "GTC")]
Gtc,
#[serde(rename = "OPG")]
Opg,
#[serde(rename = "PAX")]
Pax,
}
impl core::fmt::Display for OrderStatusTif {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Day => write!(f, "DAY"),
Self::Ioc => write!(f, "IOC"),
Self::Gtc => write!(f, "GTC"),
Self::Opg => write!(f, "OPG"),
Self::Pax => write!(f, "PAX"),
}
}
}
/// Indicates that the order reply message or submission was not accepted.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct OrderSubmitError {
/// Message indicating that order submission was not successful.
pub error: Option<String>,
}
/// A successful submission of one or more order tickets.
pub type OrderSubmitSuccess = Vec<OrderSubmitSuccessOrderSubmitSuccess>;
/// Result of successful submission of one order ticket.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct OrderSubmitSuccessOrderSubmitSuccess {
/// Internal use only.
pub encrypt_message: Option<String>,
/// The order ID assigned to your order ticket by IB. Contains only numerals.
pub order_id: Option<String>,
/// Status describing where the order stands in its lifecycle.
pub order_status: Option<String>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct OrdersSubmissionRequest {
/// Array of order tickets objects. Only one order ticket object may be submitted per request, unless constructing a bracket.
#[validate(nested)]
pub orders: Option<Vec<SingleOrderSubmissionRequest>>,
}
/// Query status of account by accountId<br><br>**Scope**: `accounts.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PatchGwApiV1AccountsAccountidStatusRequest {
#[validate(nested)]
pub path: PatchGwApiV1AccountsAccountidStatusRequestPath,
pub body: AccountRequestBody,
}
impl PatchGwApiV1AccountsAccountidStatusRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1AccountsAccountidStatusResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<AccountStatusResponse>::json_with_diagnostics(req)
.await?;
return Ok(GetGwApiV1AccountsAccountidStatusResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidStatusResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidStatusResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidStatusResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidStatusResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidStatusResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1AccountsAccountidStatusResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct PatchGwApiV1AccountsAccountidStatusRequestPath {
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Task status can be updated from this api<br><br>**Scope**: `accounts.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PatchGwApiV1AccountsAccountidTasksRequest {
#[validate(nested)]
pub path: PatchGwApiV1AccountsAccountidTasksRequestPath,
pub body: AccountRequestBody,
}
impl PatchGwApiV1AccountsAccountidTasksRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1AccountsAccountidTasksResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Task200Response2>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1AccountsAccountidTasksResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsAccountidTasksResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsAccountidTasksResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsAccountidTasksResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsAccountidTasksResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsAccountidTasksResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsAccountidTasksResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct PatchGwApiV1AccountsAccountidTasksRequestPath {
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Update information for an existing accountId<br><br>**Scope**: `accounts.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PatchGwApiV1AccountsRequest {
pub body: AccountRequestBody,
}
impl PatchGwApiV1AccountsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1AccountsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<StatusResponse>::json_with_diagnostics(req).await?;
return Ok(PostGwApiV1AccountsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsResponse::Unknown);
}
}
/// This api will be used to update the status of am request<br><br>**Scope**: `accounts.read`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PatchGwApiV1RequestsRequestidStatusRequest {
pub path: PatchGwApiV1RequestsRequestidStatusRequestPath,
pub body: AccountRequestBody,
}
impl PatchGwApiV1RequestsRequestidStatusRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PatchGwApiV1RequestsRequestidStatusResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<AmRequestStatusResponse>::json_with_diagnostics(
req,
)
.await?;
return Ok(PatchGwApiV1RequestsRequestidStatusResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PatchGwApiV1RequestsRequestidStatusResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(PatchGwApiV1RequestsRequestidStatusResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PatchGwApiV1RequestsRequestidStatusResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(PatchGwApiV1RequestsRequestidStatusResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PatchGwApiV1RequestsRequestidStatusResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PatchGwApiV1RequestsRequestidStatusResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, oas3_gen_support::Default)]
pub struct PatchGwApiV1RequestsRequestidStatusRequestPath {
pub request_id: i32,
}
/// Response types for patch_gw_api_v1_requests_requestid_status
#[derive(Debug, Clone)]
pub enum PatchGwApiV1RequestsRequestidStatusResponse {
///200: This api will be used to update the status of am request
Ok(AmRequestStatusResponse),
///400: Returns error description representing bad request
BadRequest,
///401: Returns error description representing access issue
Unauthorized,
///403: Returns error description representing access issue
Forbidden,
///415: Unsupported Media Type
UnsupportedMediaType,
///500: Returns error description representing internal server error
InternalServerError,
///default: Unknown response
Unknown,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct PendingTask {
pub action: Option<String>,
#[serde(rename = "au10tixCreatedDate")]
pub au10tix_created_date: Option<chrono::DateTime<chrono::Utc>>,
#[serde(rename = "au10tixExpiryDate")]
pub au10tix_expiry_date: Option<chrono::DateTime<chrono::Utc>>,
#[serde(rename = "documentRejectReason")]
pub document_reject_reason: Option<Vec<String>>,
#[serde(rename = "entityId")]
pub entity_id: Option<i32>,
#[serde(rename = "externalId")]
pub external_id: Option<String>,
#[serde(rename = "formName")]
pub form_name: Option<String>,
#[serde(rename = "formNumber")]
pub form_number: Option<i32>,
#[serde(rename = "onlineTask")]
pub online_task: Option<bool>,
#[serde(rename = "questionIds")]
pub question_ids: Option<Vec<i32>>,
#[serde(rename = "requiredForApproval")]
pub required_for_approval: Option<bool>,
#[serde(rename = "requiredForTrading")]
pub required_for_trading: Option<bool>,
#[serde(rename = "startDate")]
pub start_date: Option<chrono::DateTime<chrono::Utc>>,
pub state: Option<String>,
#[serde(rename = "taskNumber")]
pub task_number: Option<i32>,
pub url: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct PendingTasksResponse {
#[serde(rename = "accountId")]
pub account_id: Option<String>,
pub description: Option<String>,
pub error: Option<Box<ErrorResponse>>,
#[serde(rename = "errorDescription")]
pub error_description: Option<String>,
#[serde(rename = "hasError")]
pub has_error: Option<bool>,
#[serde(rename = "pendingTaskPresent")]
pub pending_task_present: Option<bool>,
#[serde(rename = "pendingTasks")]
pub pending_tasks: Option<Vec<PendingTask>>,
pub state: Option<String>,
pub status: Option<String>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
#[serde(default)]
pub struct PerformanceRequestBody {
/// An array of strings containing each account identifier to retrieve performance details for.
#[serde(rename = "acctIds")]
pub acct_ids: Option<Vec<serde_json::Value>>,
/// Specify the period for which the account should be analyzed. Available period lengths:
/// * `1D` - The last 24 hours.
/// * `7D` - The last 7 full days.
/// * `MTD` - Performance since the 1st of the month.
/// * `1M` - A full calendar month from the last full trade day.
/// * `3M` - 3 full calendar months from the last full trade day.
/// * `6M` - 6 full calendar months from the last full trade day.
/// * `12M` - 12 full calendar month from the last full trade day.
/// * `YTD` - Performance since January 1st.
#[default(Some(Default::default()))]
pub period: Option<PerformanceRequestBodyPeriod>,
}
/// Specify the period for which the account should be analyzed. Available period lengths:
/// * `1D` - The last 24 hours.
/// * `7D` - The last 7 full days.
/// * `MTD` - Performance since the 1st of the month.
/// * `1M` - A full calendar month from the last full trade day.
/// * `3M` - 3 full calendar months from the last full trade day.
/// * `6M` - 6 full calendar months from the last full trade day.
/// * `12M` - 12 full calendar month from the last full trade day.
/// * `YTD` - Performance since January 1st.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum PerformanceRequestBodyPeriod {
#[serde(rename = "1D")]
#[default]
T1d,
#[serde(rename = "7D")]
T7d,
#[serde(rename = "MTD")]
Mtd,
#[serde(rename = "1M")]
T1m,
#[serde(rename = "3M")]
T3m,
#[serde(rename = "6M")]
T6m,
#[serde(rename = "12M")]
T12m,
#[serde(rename = "YTD")]
Ytd,
}
impl core::fmt::Display for PerformanceRequestBodyPeriod {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::T1d => write!(f, "1D"),
Self::T7d => write!(f, "7D"),
Self::Mtd => write!(f, "MTD"),
Self::T1m => write!(f, "1M"),
Self::T3m => write!(f, "3M"),
Self::T6m => write!(f, "6M"),
Self::T12m => write!(f, "12M"),
Self::Ytd => write!(f, "YTD"),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct PerformanceResponse {
/// Returns the object containing the Cumulative performance data.
pub cps: Option<PerformanceResponseCps>,
/// Confirms if the currency type. If trading exclusively in your base currency, "base" will be returned.
#[serde(rename = "currencyType")]
pub currency_type: Option<String>,
/// Returns the request identifier, getPerformanceData.
pub id: Option<String>,
/// Returns an array containing accounts reviewed.
pub included: Option<Vec<serde_json::Value>>,
/// Net asset value data for the account or consolidated accounts. NAV data is not applicable to benchmarks.
pub nav: Option<PerformanceResponseNav>,
/// Returns the total data points.
pub nd: Option<i32>,
/// Portfolio Measure. Used to indicate TWR or MWR values returned.
pub pm: Option<String>,
/// Returns the data identifier (Internal Use Only).
pub rc: Option<i32>,
/// Returns the time period performance data.
pub tpps: Option<PerformanceResponseTpps>,
}
/// Returns the object containing the Cumulative performance data.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct PerformanceResponseCps {
/// Returns the array of cps data available.
pub data: Option<Vec<PerformanceResponseCpsDatum>>,
/// Returns the dates corresponding to the frequency of data.
pub dates: Option<Vec<serde_json::Value>>,
/// Returns the determining frequency of the data range.
pub freq: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct PerformanceResponseCpsDatum {
/// Returns the base curency for the account.
#[serde(rename = "baseCurrency")]
pub base_currency: Option<String>,
/// Returns the ending value of the value range.
pub end: Option<String>,
/// Returns the account identifier.
pub id: Option<String>,
/// Returns the key value of the request.
#[serde(rename = "idType")]
pub id_type: Option<String>,
/// Returns all cps values in order between the start and end times.
pub returns: Option<Vec<serde_json::Value>>,
/// Returns the starting value of the value range.
pub start: Option<String>,
}
/// Net asset value data for the account or consolidated accounts. NAV data is not applicable to benchmarks.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct PerformanceResponseNav {
/// Contains the affiliated 'nav' data.
pub data: Option<Vec<PerformanceResponseNavDatum>>,
/// Returns the array of dates formatted as strings corresponding to your frequency, the length should be same as the length of returns inside data.
pub dates: Option<Vec<serde_json::Value>>,
/// Displays the values corresponding to a given frequency.
pub freq: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct PerformanceResponseNavDatum {
/// Returns the base currency used in the account.
#[serde(rename = "baseCurrency")]
pub base_currency: Option<String>,
/// Returns the end of the available frequency.
pub end: Option<String>,
/// Returns the account identifier.
pub id: Option<String>,
/// Returns how identifiers are determined.
#[serde(rename = "idType")]
pub id_type: Option<String>,
/// Returns sequential data points corresponding to the net asset value between the "start" and "end" days.
pub navs: Option<Vec<serde_json::Value>>,
/// Returns the first available date for data.
pub start: Option<String>,
/// Returns the intiial NAV available.
#[serde(rename = "startNAV")]
pub start_nav: Option<PerformanceResponseNavDatumStartNav>,
}
/// Returns the intiial NAV available.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct PerformanceResponseNavDatumStartNav {
/// Returns the starting date for the request.
pub date: Option<String>,
/// Returns the Net Asset Value of the account.
pub val: Option<f64>,
}
/// Returns the time period performance data.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct PerformanceResponseTpps {
/// Object containing all data about tpps.
pub data: Option<Vec<PerformanceResponseCpsDatum>>,
/// Returns the dates corresponding to the frequency of data.
pub dates: Option<Vec<serde_json::Value>>,
/// Returns the determining frequency of the data range.
pub freq: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct PnlPartitionedResponse {
/// Refers to the U accounts PnL. This does reference Realized Profit and Loss.
pub upnl: Option<PnlPartitionedResponseUpnl>,
}
/// Refers to the U accounts PnL. This does reference Realized Profit and Loss.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct PnlPartitionedResponseUpnl {
/// The account or model's Profit and Loss.
#[serde(rename = "U1234567.Core")]
pub u1234567_core: Option<PnlPartitionedResponseUpnlU1234567Core>,
}
/// The account or model's Profit and Loss.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct PnlPartitionedResponseUpnlU1234567Core {
/// Daily PnL for the specified account profile.
pub dpl: Option<f64>,
/// Excess Liquidity for the specified account profile.
pub el: Option<f64>,
/// Margin value for the specified account profile.
pub mv: Option<f64>,
/// Net Liquidity for the specified account profile.
pub nl: Option<f64>,
/// Returns the positional value of the returned account. Always returns 1 for individual accounts.
#[serde(rename = "rowType")]
pub row_type: Option<i32>,
/// Unrealized PnL for the specified account profile.
pub upl: Option<f64>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct PollingInstructionResult {
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `Some("Please poll for status after 10 minutes".to_string())`
pub description: Option<String>,
pub error: Option<ResultError>,
/// - Example: `Some(23456745.0)`
#[serde(rename = "ibReferenceId")]
pub ib_reference_id: Option<f64>,
/// - Example: `45123654.0`
#[serde(rename = "instructionId")]
pub instruction_id: f64,
/// - Example: `"PENDING"`
#[serde(rename = "instructionStatus")]
pub instruction_status: PollingInstructionResultInstructionStatus,
/// - Example: `"INTERNAL_CASH_TRANSFER"`
#[serde(rename = "instructionType")]
pub instruction_type: InstructionResultInstructionType,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
pub enum PollingInstructionResultInstructionStatus {
#[serde(rename = "PENDING")]
#[default]
Pending,
#[serde(rename = "REJECTED")]
Rejected,
#[serde(rename = "PROCESSED")]
Processed,
}
impl core::fmt::Display for PollingInstructionResultInstructionStatus {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Pending => write!(f, "PENDING"),
Self::Rejected => write!(f, "REJECTED"),
Self::Processed => write!(f, "PROCESSED"),
}
}
}
/// Array of position objects, each defining a position held in the account.
pub type Portfolio2Positions = Vec<Portfolio2PositionsPortfolio2position>;
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct Portfolio2PositionsPortfolio2position {
/// Asset class of the requested instrument.
#[serde(rename = "assetClass")]
pub asset_class: Option<String>,
/// The account's average cost for its position.
#[serde(rename = "avgCost")]
pub avg_cost: Option<serde_json::Value>,
/// The account's average price for its position.
#[serde(rename = "avgPrice")]
pub avg_price: Option<f64>,
/// IB contract ID for the instrument.
pub conid: Option<i32>,
/// Currency in which the instrument trades.
pub currency: Option<String>,
/// Contract's local symbol
pub description: Option<String>,
/// Industry sub-categorization of the instrument.
pub group: Option<String>,
#[serde(rename = "isLastToLoq")]
pub is_last_to_loq: Option<bool>,
/// Current market price of the instrument, in the instrument's currency.
#[serde(rename = "marketPrice")]
pub market_price: Option<f64>,
/// Current market value of the account's position in the instrument, in the instrument's currency.
#[serde(rename = "marketValue")]
pub market_value: Option<f64>,
/// Name of the model portfolio in which the account is invested that contributes this position.
pub model: Option<String>,
/// Size of position in units of instrument.
pub position: Option<f64>,
/// Realized PnL for the instrument in the instrument's currency.
#[serde(rename = "realizedPnl")]
pub realized_pnl: Option<f64>,
/// The security type of the instrument.
#[serde(rename = "secType")]
pub sec_type: Option<String>,
/// Industry sector categorization of the instrument.
pub sector: Option<String>,
/// Time taken to retrieve position data in milliseconds.
pub timestamp: Option<i32>,
/// Unrealized PnL for the instrument in the account.
#[serde(rename = "unrealizedPnl")]
pub unrealized_pnl: Option<f64>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct PortfolioAllocations {
/// Object containing values of positions sorted by long/short and asset class.
#[serde(rename = "assetClass")]
pub asset_class: Option<PortfolioAllocationsAssetClass>,
/// Object containing values of positions sorted by long/short and Sector Group.
pub group: Option<PortfolioAllocationsGroup>,
/// Object containing values of positions sorted by long/short and Sector.
pub sector: Option<PortfolioAllocationsSector>,
}
/// Object containing values of positions sorted by long/short and asset class.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct PortfolioAllocationsAssetClass {
/// Object containing value of long positions in the account aggregated by asset class.
pub long: Option<std::collections::HashMap<String, f64>>,
/// Object containing value of short positions in the account aggregated by asset class.
pub short: Option<std::collections::HashMap<String, f64>>,
}
/// Object containing values of positions sorted by long/short and Sector Group.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct PortfolioAllocationsGroup {
/// Object containing value of long positions in the account aggregated by Sector Group.
pub long: Option<std::collections::HashMap<String, f64>>,
/// Object containing value of short positions in the account aggregated by Sector Group.
pub short: Option<std::collections::HashMap<String, f64>>,
}
/// Object containing values of positions sorted by long/short and Sector.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct PortfolioAllocationsSector {
/// Object containing value of long positions in the account aggregated by Sector.
pub long: Option<std::collections::HashMap<String, f64>>,
/// Object containing value of short positions in the account aggregated by Sector.
pub short: Option<std::collections::HashMap<String, f64>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct PortfolioSummary {
pub accountcode: Option<serde_json::Value>,
pub accountready: Option<serde_json::Value>,
pub accounttype: Option<serde_json::Value>,
pub accruedcash: Option<serde_json::Value>,
#[serde(rename = "accruedcash-c")]
pub accruedcash_c: Option<serde_json::Value>,
#[serde(rename = "accruedcash-s")]
pub accruedcash_s: Option<serde_json::Value>,
pub accrueddividend: Option<serde_json::Value>,
#[serde(rename = "accrueddividend-c")]
pub accrueddividend_c: Option<serde_json::Value>,
#[serde(rename = "accrueddividend-s")]
pub accrueddividend_s: Option<serde_json::Value>,
pub availablefunds: Option<serde_json::Value>,
#[serde(rename = "availablefunds-c")]
pub availablefunds_c: Option<serde_json::Value>,
#[serde(rename = "availablefunds-s")]
pub availablefunds_s: Option<serde_json::Value>,
pub availabletotrade: Option<serde_json::Value>,
#[serde(rename = "availabletotrade-c")]
pub availabletotrade_c: Option<serde_json::Value>,
#[serde(rename = "availabletotrade-s")]
pub availabletotrade_s: Option<serde_json::Value>,
pub availabletowithdraw: Option<serde_json::Value>,
#[serde(rename = "availabletowithdraw-c")]
pub availabletowithdraw_c: Option<serde_json::Value>,
#[serde(rename = "availabletowithdraw-s")]
pub availabletowithdraw_s: Option<serde_json::Value>,
pub billable: Option<serde_json::Value>,
#[serde(rename = "billable-c")]
pub billable_c: Option<serde_json::Value>,
#[serde(rename = "billable-s")]
pub billable_s: Option<serde_json::Value>,
pub buyingpower: Option<serde_json::Value>,
#[serde(rename = "columnprio-c")]
pub columnprio_c: Option<serde_json::Value>,
#[serde(rename = "columnprio-s")]
pub columnprio_s: Option<serde_json::Value>,
pub cushion: Option<serde_json::Value>,
pub daytradesremaining: Option<serde_json::Value>,
#[serde(rename = "daytradesremainingt+1")]
pub daytradesremainingt_1: Option<serde_json::Value>,
#[serde(rename = "daytradesremainingt+2")]
pub daytradesremainingt_2: Option<serde_json::Value>,
#[serde(rename = "daytradesremainingt+3")]
pub daytradesremainingt_3: Option<serde_json::Value>,
#[serde(rename = "daytradesremainingt+4")]
pub daytradesremainingt_4: Option<serde_json::Value>,
#[serde(rename = "daytradingstatus-s")]
pub daytradingstatus_s: Option<serde_json::Value>,
pub depositoncredithold: Option<serde_json::Value>,
pub equitywithloanvalue: Option<serde_json::Value>,
#[serde(rename = "equitywithloanvalue-c")]
pub equitywithloanvalue_c: Option<serde_json::Value>,
#[serde(rename = "equitywithloanvalue-s")]
pub equitywithloanvalue_s: Option<serde_json::Value>,
pub excessliquidity: Option<serde_json::Value>,
#[serde(rename = "excessliquidity-c")]
pub excessliquidity_c: Option<serde_json::Value>,
#[serde(rename = "excessliquidity-s")]
pub excessliquidity_s: Option<serde_json::Value>,
pub fullavailablefunds: Option<serde_json::Value>,
#[serde(rename = "fullavailablefunds-c")]
pub fullavailablefunds_c: Option<serde_json::Value>,
#[serde(rename = "fullavailablefunds-s")]
pub fullavailablefunds_s: Option<serde_json::Value>,
pub fullexcessliquidity: Option<serde_json::Value>,
#[serde(rename = "fullexcessliquidity-c")]
pub fullexcessliquidity_c: Option<serde_json::Value>,
#[serde(rename = "fullexcessliquidity-s")]
pub fullexcessliquidity_s: Option<serde_json::Value>,
pub fullinitmarginreq: Option<serde_json::Value>,
#[serde(rename = "fullinitmarginreq-c")]
pub fullinitmarginreq_c: Option<serde_json::Value>,
#[serde(rename = "fullinitmarginreq-s")]
pub fullinitmarginreq_s: Option<serde_json::Value>,
pub fullmaintmarginreq: Option<serde_json::Value>,
#[serde(rename = "fullmaintmarginreq-c")]
pub fullmaintmarginreq_c: Option<serde_json::Value>,
#[serde(rename = "fullmaintmarginreq-s")]
pub fullmaintmarginreq_s: Option<serde_json::Value>,
pub grosspositionvalue: Option<serde_json::Value>,
#[serde(rename = "grosspositionvalue-s")]
pub grosspositionvalue_s: Option<serde_json::Value>,
pub guarantee: Option<serde_json::Value>,
#[serde(rename = "guarantee-c")]
pub guarantee_c: Option<serde_json::Value>,
#[serde(rename = "guarantee-s")]
pub guarantee_s: Option<serde_json::Value>,
pub highestseverity: Option<serde_json::Value>,
pub indianstockhaircut: Option<serde_json::Value>,
#[serde(rename = "indianstockhaircut-c")]
pub indianstockhaircut_c: Option<serde_json::Value>,
#[serde(rename = "indianstockhaircut-s")]
pub indianstockhaircut_s: Option<serde_json::Value>,
pub initmarginreq: Option<serde_json::Value>,
#[serde(rename = "initmarginreq-c")]
pub initmarginreq_c: Option<serde_json::Value>,
#[serde(rename = "initmarginreq-s")]
pub initmarginreq_s: Option<serde_json::Value>,
#[serde(rename = "leverage-s")]
pub leverage_s: Option<serde_json::Value>,
pub lookaheadavailablefunds: Option<serde_json::Value>,
#[serde(rename = "lookaheadavailablefunds-c")]
pub lookaheadavailablefunds_c: Option<serde_json::Value>,
#[serde(rename = "lookaheadavailablefunds-s")]
pub lookaheadavailablefunds_s: Option<serde_json::Value>,
pub lookaheadexcessliquidity: Option<serde_json::Value>,
#[serde(rename = "lookaheadexcessliquidity-c")]
pub lookaheadexcessliquidity_c: Option<serde_json::Value>,
#[serde(rename = "lookaheadexcessliquidity-s")]
pub lookaheadexcessliquidity_s: Option<serde_json::Value>,
pub lookaheadinitmarginreq: Option<serde_json::Value>,
#[serde(rename = "lookaheadinitmarginreq-c")]
pub lookaheadinitmarginreq_c: Option<serde_json::Value>,
#[serde(rename = "lookaheadinitmarginreq-s")]
pub lookaheadinitmarginreq_s: Option<serde_json::Value>,
pub lookaheadmaintmarginreq: Option<serde_json::Value>,
#[serde(rename = "lookaheadmaintmarginreq-c")]
pub lookaheadmaintmarginreq_c: Option<serde_json::Value>,
#[serde(rename = "lookaheadmaintmarginreq-s")]
pub lookaheadmaintmarginreq_s: Option<serde_json::Value>,
pub lookaheadnextchange: Option<serde_json::Value>,
pub maintmarginreq: Option<serde_json::Value>,
#[serde(rename = "maintmarginreq-c")]
pub maintmarginreq_c: Option<serde_json::Value>,
#[serde(rename = "maintmarginreq-s")]
pub maintmarginreq_s: Option<serde_json::Value>,
pub netliquidation: Option<serde_json::Value>,
#[serde(rename = "netliquidation-c")]
pub netliquidation_c: Option<serde_json::Value>,
#[serde(rename = "netliquidation-s")]
pub netliquidation_s: Option<serde_json::Value>,
pub netliquidationuncertainty: Option<serde_json::Value>,
pub nlvandmargininreview: Option<serde_json::Value>,
pub pasharesvalue: Option<serde_json::Value>,
#[serde(rename = "pasharesvalue-c")]
pub pasharesvalue_c: Option<serde_json::Value>,
#[serde(rename = "pasharesvalue-s")]
pub pasharesvalue_s: Option<serde_json::Value>,
pub physicalcertificatevalue: Option<serde_json::Value>,
#[serde(rename = "physicalcertificatevalue-c")]
pub physicalcertificatevalue_c: Option<serde_json::Value>,
#[serde(rename = "physicalcertificatevalue-s")]
pub physicalcertificatevalue_s: Option<serde_json::Value>,
pub postexpirationexcess: Option<serde_json::Value>,
#[serde(rename = "postexpirationexcess-c")]
pub postexpirationexcess_c: Option<serde_json::Value>,
#[serde(rename = "postexpirationexcess-s")]
pub postexpirationexcess_s: Option<serde_json::Value>,
pub postexpirationmargin: Option<serde_json::Value>,
#[serde(rename = "postexpirationmargin-c")]
pub postexpirationmargin_c: Option<serde_json::Value>,
#[serde(rename = "postexpirationmargin-s")]
pub postexpirationmargin_s: Option<serde_json::Value>,
pub previousdayequitywithloanvalue: Option<serde_json::Value>,
#[serde(rename = "previousdayequitywithloanvalue-s")]
pub previousdayequitywithloanvalue_s: Option<serde_json::Value>,
pub regtequity: Option<serde_json::Value>,
#[serde(rename = "regtequity-s")]
pub regtequity_s: Option<serde_json::Value>,
pub regtmargin: Option<serde_json::Value>,
#[serde(rename = "regtmargin-s")]
pub regtmargin_s: Option<serde_json::Value>,
#[serde(rename = "segmenttitle-c")]
pub segmenttitle_c: Option<serde_json::Value>,
#[serde(rename = "segmenttitle-s")]
pub segmenttitle_s: Option<serde_json::Value>,
pub sma: Option<serde_json::Value>,
#[serde(rename = "sma-s")]
pub sma_s: Option<serde_json::Value>,
pub totalcashvalue: Option<serde_json::Value>,
#[serde(rename = "totalcashvalue-c")]
pub totalcashvalue_c: Option<serde_json::Value>,
#[serde(rename = "totalcashvalue-s")]
pub totalcashvalue_s: Option<serde_json::Value>,
pub totaldebitcardpendingcharges: Option<serde_json::Value>,
#[serde(rename = "totaldebitcardpendingcharges-c")]
pub totaldebitcardpendingcharges_c: Option<serde_json::Value>,
#[serde(rename = "totaldebitcardpendingcharges-s")]
pub totaldebitcardpendingcharges_s: Option<serde_json::Value>,
#[serde(rename = "tradingtype-s")]
pub tradingtype_s: Option<serde_json::Value>,
pub whatifpmenabled: Option<serde_json::Value>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
pub struct PortfolioSummaryValue {
/// Numerical data for the associated key.
pub amount: Option<f64>,
/// The currency in which the value of the 'amount' field is denominated.
pub currency: Option<f64>,
/// Indicates whether the associated key's value does not exist, as opposed to a value of zero.
#[serde(rename = "isNull")]
pub is_null: Option<bool>,
/// severity
pub severity: Option<i32>,
/// Unix epoch timestamp of returned data in milliseconds.
pub timestamp: Option<i32>,
/// String and boolean (non-numerical) data for the associated key.
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct Position200Response {
/// Additional properties not defined in the schema.
#[serde(flatten)]
pub additional_properties: std::collections::HashMap<String, IndividualPosition>,
}
/// Array of objects reflecting all positions in the given account.
pub type Position200Response2 = Vec<IndividualPosition>;
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct PositionRequestBody {
/// Define the model to retrieve accounts from.
pub model: Option<String>,
/// Request identifier to uniquely track a request.
#[serde(rename = "reqID")]
pub req_id: Option<i32>,
/// Describes if the model is in polling mode.
#[serde(rename = "subscriptionStatus")]
pub subscription_status: Option<i32>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct PositionRequestBody2 {
/// Maximum number of positions to return.
/// - Example: `Some(10i32)`
pub limit: Option<i32>,
/// Name of your model.
/// - Example: `Some("Sample-Model".to_string())`
pub model: Option<String>,
/// Request identifier to uniquely track a request.
/// - Example: `Some(540_609i32)`
#[serde(rename = "reqID")]
pub req_id: Option<i32>,
/// Direction to sort the request by.
/// * `ASC` - Sort from greatest to smallest.
/// * `DESC` - Sort from smallest to greatest.
#[serde(rename = "sortDirection")]
pub sort_direction: Option<PositionRequestBody2SortDirection>,
/// Field to sort the response by.
/// * `actual` - Current actual model allocation for the instrument.
/// * `actualRangeMax` - Maximum actual model allocation allowed for the instrument.
/// * `actualRangeMin` - Minimum actual model allocation allowed for the instrument.
/// * `ccy` - Currency of the instrument.
/// * `conid` - Contract identifier, or conid.
/// * `dlv` - Market value.
/// * `instrumentImbalance` - How far an instrument's actual allocation is from its model.
/// * `instrument` - Symbol of the security.
/// * `mv` - Market value of the model position.
/// * `position` - Number of shares held by the model.
/// * `target` - Target percentage of an instrument held within a model.
#[serde(rename = "sortField")]
pub sort_field: Option<PositionRequestBody2SortField>,
}
/// Direction to sort the request by.
/// * `ASC` - Sort from greatest to smallest.
/// * `DESC` - Sort from smallest to greatest.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum PositionRequestBody2SortDirection {
#[serde(rename = "ASC")]
#[default]
Asc,
#[serde(rename = "DESC")]
Desc,
}
impl core::fmt::Display for PositionRequestBody2SortDirection {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Asc => write!(f, "ASC"),
Self::Desc => write!(f, "DESC"),
}
}
}
/// Field to sort the response by.
/// * `actual` - Current actual model allocation for the instrument.
/// * `actualRangeMax` - Maximum actual model allocation allowed for the instrument.
/// * `actualRangeMin` - Minimum actual model allocation allowed for the instrument.
/// * `ccy` - Currency of the instrument.
/// * `conid` - Contract identifier, or conid.
/// * `dlv` - Market value.
/// * `instrumentImbalance` - How far an instrument's actual allocation is from its model.
/// * `instrument` - Symbol of the security.
/// * `mv` - Market value of the model position.
/// * `position` - Number of shares held by the model.
/// * `target` - Target percentage of an instrument held within a model.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum PositionRequestBody2SortField {
#[serde(rename = "actual")]
#[default]
Actual,
#[serde(rename = "actualRangeMax")]
ActualRangeMax,
#[serde(rename = "actualRangeMin")]
ActualRangeMin,
#[serde(rename = "ccy")]
Ccy,
#[serde(rename = "conid")]
Conid,
#[serde(rename = "dlv")]
Dlv,
#[serde(rename = "instrumentImbalance")]
InstrumentImbalance,
#[serde(rename = "instrument")]
Instrument,
#[serde(rename = "mismatchType")]
MismatchType,
#[serde(rename = "mv")]
Mv,
#[serde(rename = "position")]
Position,
#[serde(rename = "target")]
Target,
}
impl core::fmt::Display for PositionRequestBody2SortField {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Actual => write!(f, "actual"),
Self::ActualRangeMax => write!(f, "actualRangeMax"),
Self::ActualRangeMin => write!(f, "actualRangeMin"),
Self::Ccy => write!(f, "ccy"),
Self::Conid => write!(f, "conid"),
Self::Dlv => write!(f, "dlv"),
Self::InstrumentImbalance => write!(f, "instrumentImbalance"),
Self::Instrument => write!(f, "instrument"),
Self::MismatchType => write!(f, "mismatchType"),
Self::Mv => write!(f, "mv"),
Self::Position => write!(f, "position"),
Self::Target => write!(f, "target"),
}
}
}
/// Task can be assigned from this api<br><br>**Scope**: `accounts.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1AccountsAccountidTasksRequest {
#[validate(nested)]
pub path: PostGwApiV1AccountsAccountidTasksRequestPath,
pub body: AccountRequestBody,
}
impl PostGwApiV1AccountsAccountidTasksRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1AccountsAccountidTasksResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Task200Response2>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1AccountsAccountidTasksResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsAccountidTasksResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsAccountidTasksResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsAccountidTasksResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsAccountidTasksResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsAccountidTasksResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsAccountidTasksResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1AccountsAccountidTasksRequestPath {
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for post_gw_api_v1_accounts_accountid_tasks
#[derive(Debug, Clone)]
pub enum PostGwApiV1AccountsAccountidTasksResponse {
///200: Task can be assigned from this api
Ok(Task200Response2),
///400: Returns error description representing bad request
BadRequest,
///401: Returns error description representing access issue
Unauthorized,
///403: Returns error description representing access issue
Forbidden,
///415: Unsupported Media Type
UnsupportedMediaType,
///500: Returns error description representing internal server error
InternalServerError,
///default: Unknown response
Unknown,
}
/// Provides mechanism to submit Agreements and Disclosures to IBKR once a day instead of with each application. We store these documents on the servers and will use them for new application requests submitted that day.<ul><li>Documents will need to be submitted once a day (before the Applications are submitted). PDFs will be displayed and submitted as is- no changes/edits will be made to the actual PDF files.</li><li>This end-point will not process any Tax Form Documents. Tax Form document should be submitted with every application</li><li>If submitted in the morning, you only need to include the Tax Form attachment for each applicant. Otherwise, you will need to include PDFs with each application (Create Account).</li></ul><br><br>**Scope**: `accounts.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1AccountsDocumentsRequest {
pub body: AccountRequestBody,
}
impl PostGwApiV1AccountsDocumentsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1AccountsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<StatusResponse>::json_with_diagnostics(req).await?;
return Ok(PostGwApiV1AccountsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsResponse::Unknown);
}
}
/// Submit account application. This will create brokerage account for the end user.<br><br>**Scope**: `accounts.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1AccountsRequest {
pub body: AccountRequestBody,
}
impl PostGwApiV1AccountsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1AccountsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<StatusResponse>::json_with_diagnostics(req).await?;
return Ok(PostGwApiV1AccountsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsResponse::Forbidden);
}
if status == http::StatusCode::UNSUPPORTED_MEDIA_TYPE {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsResponse::UnsupportedMediaType);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1AccountsResponse::Unknown);
}
}
/// Response types for post_gw_api_v1_accounts
#[derive(Debug, Clone)]
pub enum PostGwApiV1AccountsResponse {
///200: Submit account application. This will create brokerage account for the end user.
Ok(StatusResponse),
///400: Returns error description representing bad request
BadRequest,
///401: Returns error description representing access issue
Unauthorized,
///403: Returns error description representing access issue
Forbidden,
///415: Unsupported Media Type
UnsupportedMediaType,
///500: Returns error description representing internal server error
InternalServerError,
///default: Unknown response
Unknown,
}
/// View available cash for withdrawal and account equity value by accountId<br><br>**Scope**: `balances.read`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1BalancesQueryRequest {
pub query: PostGwApiV1BalancesQueryRequestQuery,
/// Create an query request body
pub body: QueryRequestBody,
}
impl PostGwApiV1BalancesQueryRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1BalancesQueryResponse> {
let status = req.status();
if status == http::StatusCode::CREATED {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BalancesQueryResponse::Created);
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BalancesQueryResponse::BadRequest);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BalancesQueryResponse::Forbidden);
}
if status == http::StatusCode::UNPROCESSABLE_ENTITY {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BalancesQueryResponse::UnprocessableEntity);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BalancesQueryResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1BalancesQueryResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct PostGwApiV1BalancesQueryRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
}
/// Response types for post_gw_api_v1_balances_query
#[derive(Debug, Clone)]
pub enum PostGwApiV1BalancesQueryResponse {
///201: Instruction successfully created and processed synchronously
Created,
///400: Returns a Problem detail instance representing a bad request.
BadRequest,
///403: Returns a Problem detail instance representing a forbidden request.
Forbidden,
///422: Returns a Problem detail instance representing a business error.
UnprocessableEntity,
///500: Returns a Problem detail instance representing an internal server error.
InternalServerError,
///default: Unknown response
Unknown,
}
/// <br>**Scope**: `bank-instructions.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1BankInstructionsBulkRequest {
pub query: PostGwApiV1BankInstructionsBulkRequestQuery,
/// Create Bulk Banking Instructions request body
pub body: BankInstructionsBulkRequestBody,
}
impl PostGwApiV1BankInstructionsBulkRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1BankInstructionsBulkResponse> {
let status = req.status();
if status == http::StatusCode::ACCEPTED {
let data = oas3_gen_support::Diagnostics::<
AsynchronousInstructionSetResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::Accepted(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::BadRequest);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct PostGwApiV1BankInstructionsBulkRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
}
/// Response types for post_gw_api_v1_bank_instructions_bulk
#[derive(Debug, Clone)]
pub enum PostGwApiV1BankInstructionsBulkResponse {
///202: Accepts all instructions in Bulk request to create them asynchronously
Accepted(AsynchronousInstructionSetResponse),
///400: Returns a Problem detail instance representing a bad request. Returned even if only one instruction in the bulk upload has syntactical errors.
BadRequest,
///500: Unable to process request due to an Internal Error. Please try again later.
InternalServerError,
///default: Unknown response
Unknown,
}
/// View active bank instructions for an accountId.<br><br>**Scope**: `bank-instructions.read`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1BankInstructionsQueryRequest {
pub query: PostGwApiV1BankInstructionsQueryRequestQuery,
/// Create get instruction name request body
pub body: QueryRequestBody2,
}
impl PostGwApiV1BankInstructionsQueryRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1BankInstructionsQueryResponse> {
let status = req.status();
if status == http::StatusCode::CREATED {
let data =
oas3_gen_support::Diagnostics::<Query201Response>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1BankInstructionsQueryResponse::Created(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsQueryResponse::BadRequest);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsQueryResponse::Forbidden);
}
if status == http::StatusCode::UNPROCESSABLE_ENTITY {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsQueryResponse::UnprocessableEntity);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsQueryResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsQueryResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct PostGwApiV1BankInstructionsQueryRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
}
/// Response types for post_gw_api_v1_bank_instructions_query
#[derive(Debug, Clone)]
pub enum PostGwApiV1BankInstructionsQueryResponse {
///201: Instruction successfully created and processed synchronously
Created(Query201Response),
///400: Returns a Problem detail instance representing a bad request.
BadRequest,
///403: Returns a Problem detail instance representing a forbidden request.
Forbidden,
///422: Returns a Problem detail instance representing a business error.
UnprocessableEntity,
///500: Returns a Problem detail instance representing an internal server error.
InternalServerError,
///default: Unknown response
Unknown,
}
/// Create or delete bank instructions by accountId. Only ACH and EDDA are supported for 'Create'.<br><br>**Scope**: `bank-instructions.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1BankInstructionsRequest {
pub query: PostGwApiV1BankInstructionsRequestQuery,
pub body: InstructionRequestBody,
}
impl PostGwApiV1BankInstructionsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1BankInstructionsResponse> {
let status = req.status();
if status == http::StatusCode::ACCEPTED {
let data = oas3_gen_support::Diagnostics::<
AsynchronousInstructionResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1BankInstructionsResponse::Accepted(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::BadRequest);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::Forbidden);
}
if status == http::StatusCode::UNPROCESSABLE_ENTITY {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::UnprocessableEntity);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct PostGwApiV1BankInstructionsRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
}
/// Response types for post_gw_api_v1_bank_instructions
#[derive(Debug, Clone)]
pub enum PostGwApiV1BankInstructionsResponse {
///202: Accepts request to create a new instruction asynchronously
Accepted(AsynchronousInstructionResponse),
///400: Returns a Problem detail instance representing a bad request.
BadRequest,
///403: Returns a Problem detail instance representing a forbidden request.
Forbidden,
///422: Returns a Problem detail instance representing a business error.
UnprocessableEntity,
///500: Returns a Problem detail instance representing an internal server error.
InternalServerError,
///default: Unknown response
Unknown,
}
/// <br>**Scope**: `echo.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1EchoSignedJwtRequest {
/// Create a Signed JWT echo request.
pub body: AccountRequestBody,
}
impl PostGwApiV1EchoSignedJwtRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<GetGwApiV1EchoHttpsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<EchoResponse>::json_with_diagnostics(req).await?;
return Ok(GetGwApiV1EchoHttpsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(GetGwApiV1EchoHttpsResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(GetGwApiV1EchoHttpsResponse::Forbidden);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(GetGwApiV1EchoHttpsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(GetGwApiV1EchoHttpsResponse::Unknown);
}
}
/// <br>**Scope**: `transfers.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1ExternalAssetTransfersBulkRequest {
pub query: PostGwApiV1ExternalAssetTransfersBulkRequestQuery,
/// Create Bulk External Asset transfers (Fop, DWAC and Complex Asset Transfer) request body
pub body: ExternalAssetTransfersBulkRequestBody,
}
impl PostGwApiV1ExternalAssetTransfersBulkRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1BankInstructionsBulkResponse> {
let status = req.status();
if status == http::StatusCode::ACCEPTED {
let data = oas3_gen_support::Diagnostics::<
AsynchronousInstructionSetResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::Accepted(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::BadRequest);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct PostGwApiV1ExternalAssetTransfersBulkRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
}
/// Initiate request to submit external position transfer. Methods- ACATS, ATON, Basic FOP, FOP, DWAC. More information on transfer methods can be found here - https://www.interactivebrokers.com/campus/trading-lessons/cash-and-position-transfers/<br><br>**Scope**: `transfers.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1ExternalAssetTransfersRequest {
pub query: PostGwApiV1ExternalAssetTransfersRequestQuery,
pub body: TransferRequestBody2,
}
impl PostGwApiV1ExternalAssetTransfersRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1BankInstructionsResponse> {
let status = req.status();
if status == http::StatusCode::ACCEPTED {
let data = oas3_gen_support::Diagnostics::<
AsynchronousInstructionResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1BankInstructionsResponse::Accepted(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::BadRequest);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::Forbidden);
}
if status == http::StatusCode::UNPROCESSABLE_ENTITY {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::UnprocessableEntity);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct PostGwApiV1ExternalAssetTransfersRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
}
/// <br>**Scope**: `transfers.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1ExternalCashTransfersBulkRequest {
pub query: PostGwApiV1ExternalCashTransfersBulkRequestQuery,
/// Create Bulk External Cash transfers (Deposit and Withdraw fund) request body
pub body: ExternalCashTransfersBulkRequestBody,
}
impl PostGwApiV1ExternalCashTransfersBulkRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1BankInstructionsBulkResponse> {
let status = req.status();
if status == http::StatusCode::ACCEPTED {
let data = oas3_gen_support::Diagnostics::<
AsynchronousInstructionSetResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::Accepted(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::BadRequest);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct PostGwApiV1ExternalCashTransfersBulkRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
}
/// View available cash for withdrawal with and without margin loan by accountId<br><br>**Scope**: `transfers.read`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1ExternalCashTransfersQueryRequest {
pub query: PostGwApiV1ExternalCashTransfersQueryRequestQuery,
/// Create an external cash transfer query request body
pub body: QueryRequestBody3,
}
impl PostGwApiV1ExternalCashTransfersQueryRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1ExternalCashTransfersQueryResponse> {
let status = req.status();
if status == http::StatusCode::CREATED {
let data =
oas3_gen_support::Diagnostics::<Query201Response2>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1ExternalCashTransfersQueryResponse::Created(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1ExternalCashTransfersQueryResponse::BadRequest);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1ExternalCashTransfersQueryResponse::Forbidden);
}
if status == http::StatusCode::UNPROCESSABLE_ENTITY {
let _ = req.bytes().await?;
return Ok(PostGwApiV1ExternalCashTransfersQueryResponse::UnprocessableEntity);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1ExternalCashTransfersQueryResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1ExternalCashTransfersQueryResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct PostGwApiV1ExternalCashTransfersQueryRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
}
/// Response types for post_gw_api_v1_external_cash_transfers_query
#[derive(Debug, Clone)]
pub enum PostGwApiV1ExternalCashTransfersQueryResponse {
///201: Instruction successfully created and processed synchronously
Created(Query201Response2),
///400: Returns a Problem detail instance representing a bad request.
BadRequest,
///403: Returns a Problem detail instance representing a forbidden request.
Forbidden,
///422: Returns a Problem detail instance representing a business error.
UnprocessableEntity,
///500: Returns a Problem detail instance representing an internal server error.
InternalServerError,
///default: Unknown response
Unknown,
}
/// Initiate request to deposit or withdrawal between IBKR account and bank account. More information on transfer methods can be found here - https://www.interactivebrokers.com/campus/trading-lessons/cash-and-position-transfers<br><br>**Scope**: `transfers.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1ExternalCashTransfersRequest {
pub query: PostGwApiV1ExternalCashTransfersRequestQuery,
pub body: TransferRequestBody3,
}
impl PostGwApiV1ExternalCashTransfersRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1BankInstructionsResponse> {
let status = req.status();
if status == http::StatusCode::ACCEPTED {
let data = oas3_gen_support::Diagnostics::<
AsynchronousInstructionResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1BankInstructionsResponse::Accepted(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::BadRequest);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::Forbidden);
}
if status == http::StatusCode::UNPROCESSABLE_ENTITY {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::UnprocessableEntity);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct PostGwApiV1ExternalCashTransfersRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
}
/// <br>**Scope**: `instructions.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1InstructionsCancelBulkRequest {
pub query: PostGwApiV1InstructionsCancelBulkRequestQuery,
/// Create Bulk Cancel Instructions request body
pub body: CancelBulkRequestBody,
}
impl PostGwApiV1InstructionsCancelBulkRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1BankInstructionsBulkResponse> {
let status = req.status();
if status == http::StatusCode::ACCEPTED {
let data = oas3_gen_support::Diagnostics::<
AsynchronousInstructionSetResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::Accepted(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::BadRequest);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct PostGwApiV1InstructionsCancelBulkRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
}
/// Cancel request by instructionId.<br><br>**Scope**: `instructions.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1InstructionsCancelRequest {
pub query: PostGwApiV1InstructionsCancelRequestQuery,
#[validate(nested)]
pub body: CancelRequestBody,
}
impl PostGwApiV1InstructionsCancelRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1InstructionsCancelResponse> {
let status = req.status();
if status == http::StatusCode::CREATED {
let data = oas3_gen_support::Diagnostics::<
SynchronousInstructionResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1InstructionsCancelResponse::Created(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1InstructionsCancelResponse::BadRequest);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1InstructionsCancelResponse::Forbidden);
}
if status == http::StatusCode::UNPROCESSABLE_ENTITY {
let _ = req.bytes().await?;
return Ok(PostGwApiV1InstructionsCancelResponse::UnprocessableEntity);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1InstructionsCancelResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1InstructionsCancelResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct PostGwApiV1InstructionsCancelRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
}
/// Response types for post_gw_api_v1_instructions_cancel
#[derive(Debug, Clone)]
pub enum PostGwApiV1InstructionsCancelResponse {
///201: Instruction successfully created and processed synchronously
Created(SynchronousInstructionResponse),
///400: Returns a Problem detail instance representing a bad request.
BadRequest,
///403: Returns a Problem detail instance representing a forbidden request.
Forbidden,
///422: Returns a Problem detail instance representing a business error.
UnprocessableEntity,
///500: Returns a Problem detail instance representing an internal server error.
InternalServerError,
///default: Unknown response
Unknown,
}
/// Query list of recent transactions (up to 30 days) based on accountId.<br><br>**Scope**: `instructions.read`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1InstructionsQueryRequest {
pub query: PostGwApiV1InstructionsQueryRequestQuery,
/// Create recent instructions request body
#[validate(nested)]
pub body: QueryRequestBody4,
}
impl PostGwApiV1InstructionsQueryRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1BankInstructionsResponse> {
let status = req.status();
if status == http::StatusCode::ACCEPTED {
let data = oas3_gen_support::Diagnostics::<
AsynchronousInstructionResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1BankInstructionsResponse::Accepted(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::BadRequest);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::Forbidden);
}
if status == http::StatusCode::UNPROCESSABLE_ENTITY {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::UnprocessableEntity);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct PostGwApiV1InstructionsQueryRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
}
/// <br>**Scope**: `transfers.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1InternalAssetTransfersBulkRequest {
pub query: PostGwApiV1InternalAssetTransfersBulkRequestQuery,
/// Create Bulk Internal Asset Transfers request body
pub body: InternalAssetTransfersBulkRequestBody,
}
impl PostGwApiV1InternalAssetTransfersBulkRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1BankInstructionsBulkResponse> {
let status = req.status();
if status == http::StatusCode::ACCEPTED {
let data = oas3_gen_support::Diagnostics::<
AsynchronousInstructionSetResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::Accepted(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::BadRequest);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct PostGwApiV1InternalAssetTransfersBulkRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
}
/// Transfer positions internally between two accounts with Interactive Brokers<br><br>**Scope**: `transfers.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1InternalAssetTransfersRequest {
pub query: PostGwApiV1InternalAssetTransfersRequestQuery,
#[validate(nested)]
pub body: TransferRequestBody4,
}
impl PostGwApiV1InternalAssetTransfersRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1BankInstructionsResponse> {
let status = req.status();
if status == http::StatusCode::ACCEPTED {
let data = oas3_gen_support::Diagnostics::<
AsynchronousInstructionResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1BankInstructionsResponse::Accepted(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::BadRequest);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::Forbidden);
}
if status == http::StatusCode::UNPROCESSABLE_ENTITY {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::UnprocessableEntity);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct PostGwApiV1InternalAssetTransfersRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
}
/// <br>**Scope**: `transfers.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1InternalCashTransfersBulkRequest {
pub query: PostGwApiV1InternalCashTransfersBulkRequestQuery,
/// Create Bulk Internal Cash Transfers request body
pub body: InternalCashTransfersBulkRequestBody,
}
impl PostGwApiV1InternalCashTransfersBulkRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1BankInstructionsBulkResponse> {
let status = req.status();
if status == http::StatusCode::ACCEPTED {
let data = oas3_gen_support::Diagnostics::<
AsynchronousInstructionSetResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::Accepted(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::BadRequest);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1BankInstructionsBulkResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct PostGwApiV1InternalCashTransfersBulkRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
}
/// Transfer cash internally between two accounts with Interactive Brokers.<br><br>**Scope**: `transfers.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1InternalCashTransfersRequest {
pub query: PostGwApiV1InternalCashTransfersRequestQuery,
#[validate(nested)]
pub body: TransferRequestBody5,
}
impl PostGwApiV1InternalCashTransfersRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1InstructionsCancelResponse> {
let status = req.status();
if status == http::StatusCode::CREATED {
let data = oas3_gen_support::Diagnostics::<
SynchronousInstructionResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1InstructionsCancelResponse::Created(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1InstructionsCancelResponse::BadRequest);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1InstructionsCancelResponse::Forbidden);
}
if status == http::StatusCode::UNPROCESSABLE_ENTITY {
let _ = req.bytes().await?;
return Ok(PostGwApiV1InstructionsCancelResponse::UnprocessableEntity);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1InstructionsCancelResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1InstructionsCancelResponse::Unknown);
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct PostGwApiV1InternalCashTransfersRequestQuery {
/// The client's clientId
/// - Example: `Some("abc123".to_string())`
#[serde(rename = "client-id")]
pub client_id: Option<String>,
}
/// <br>**Scope**: `sso-browser-sessions.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1SsoBrowserSessionsRequest {
#[validate(nested)]
pub header: PostGwApiV1SsoBrowserSessionsRequestHeader,
/// Create browser session on behalf of end-user.
pub body: AccountRequestBody,
}
impl PostGwApiV1SsoBrowserSessionsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1SsoBrowserSessionsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<
CreateBrowserSessionResponse,
>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1SsoBrowserSessionsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1SsoBrowserSessionsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(PostGwApiV1SsoBrowserSessionsResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1SsoBrowserSessionsResponse::Forbidden);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1SsoBrowserSessionsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1SsoBrowserSessionsResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1SsoBrowserSessionsRequestHeader {
/// Specifies the authorization header value (e.g., Bearer eyJ0eXAiOiJKV1...).
/// - Example: `"Bearer eyJ0eXAiOiJKV1...".to_string()`
#[validate(length(min = 1u64))]
pub authorization: String,
}
impl core::convert::TryFrom<&PostGwApiV1SsoBrowserSessionsRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(
headers: &PostGwApiV1SsoBrowserSessionsRequestHeader,
) -> core::result::Result<Self, Self::Error> {
let mut map = http::HeaderMap::with_capacity(1usize);
let header_value = http::HeaderValue::try_from(&headers.authorization)?;
map.insert(AUTHORIZATION, header_value);
Ok(map)
}
}
impl core::convert::TryFrom<PostGwApiV1SsoBrowserSessionsRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(
headers: PostGwApiV1SsoBrowserSessionsRequestHeader,
) -> core::result::Result<Self, Self::Error> {
http::HeaderMap::try_from(&headers)
}
}
/// Response types for post_gw_api_v1_sso_browser_sessions
#[derive(Debug, Clone)]
pub enum PostGwApiV1SsoBrowserSessionsResponse {
///200: Create a Single Sign On (SSO) to access the IBKR hosted portal (White Branded).
Ok(CreateBrowserSessionResponse),
///400: Returns a Problem detail instance representing a bad request.
BadRequest,
///401: Returns a Problem detail instance representing an unauthorized request.
Unauthorized,
///403: Returns a Problem detail instance representing a forbidden request.
Forbidden,
///500: Returns a Problem detail instance representing an internal server error.
InternalServerError,
///default: Unknown response
Unknown,
}
/// <br>**Scope**: `sso-sessions.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1SsoSessionsRequest {
#[validate(nested)]
pub header: PostGwApiV1SsoSessionsRequestHeader,
/// Create session on behalf of end-user.
pub body: AccountRequestBody,
}
impl PostGwApiV1SsoSessionsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1SsoSessionsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<CreateSessionResponse>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1SsoSessionsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1SsoSessionsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(PostGwApiV1SsoSessionsResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1SsoSessionsResponse::Forbidden);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1SsoSessionsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1SsoSessionsResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1SsoSessionsRequestHeader {
/// Specifies the authorization header value (e.g., Bearer eyJ0eXAiOiJKV1...).
/// - Example: `"Bearer eyJ0eXAiOiJKV1...".to_string()`
#[validate(length(min = 1u64))]
pub authorization: String,
}
impl core::convert::TryFrom<&PostGwApiV1SsoSessionsRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(
headers: &PostGwApiV1SsoSessionsRequestHeader,
) -> core::result::Result<Self, Self::Error> {
let mut map = http::HeaderMap::with_capacity(1usize);
let header_value = http::HeaderValue::try_from(&headers.authorization)?;
map.insert(AUTHORIZATION, header_value);
Ok(map)
}
}
impl core::convert::TryFrom<PostGwApiV1SsoSessionsRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(
headers: PostGwApiV1SsoSessionsRequestHeader,
) -> core::result::Result<Self, Self::Error> {
http::HeaderMap::try_from(&headers)
}
}
/// Response types for post_gw_api_v1_sso_sessions
#[derive(Debug, Clone)]
pub enum PostGwApiV1SsoSessionsResponse {
///200: Returns a JSON object containing a reference to the newly created SSO session.
Ok(CreateSessionResponse),
///400: Returns a Problem detail instance representing a bad request.
BadRequest,
///401: Returns a Problem detail instance representing an unauthorized request.
Unauthorized,
///403: Returns a Problem detail instance representing a forbidden request.
Forbidden,
///500: Returns a Problem detail instance representing an internal server error.
InternalServerError,
///default: Unknown response
Unknown,
}
/// <br>**Scope**: `statements.read` OR `statements.write` OR `reports.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1StatementsRequest {
#[validate(nested)]
pub header: PostGwApiV1StatementsRequestHeader,
/// Report request object
#[validate(nested)]
pub body: StmtRequest,
}
impl PostGwApiV1StatementsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1StatementsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<GetStatementsResponse>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1StatementsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1StatementsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(PostGwApiV1StatementsResponse::Unauthorized);
}
if status == http::StatusCode::PAYMENT_REQUIRED {
let _ = req.bytes().await?;
return Ok(PostGwApiV1StatementsResponse::PaymentRequired);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1StatementsResponse::Forbidden);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1StatementsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1StatementsResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1StatementsRequestHeader {
/// Specifies the authorization header value (e.g., Bearer eyJ0eXAiOiJKV1...).
/// - Example: `"Bearer eyJ0eXAiOiJKV1...".to_string()`
#[validate(length(min = 1u64))]
pub authorization: String,
}
impl core::convert::TryFrom<&PostGwApiV1StatementsRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(
headers: &PostGwApiV1StatementsRequestHeader,
) -> core::result::Result<Self, Self::Error> {
let mut map = http::HeaderMap::with_capacity(1usize);
let header_value = http::HeaderValue::try_from(&headers.authorization)?;
map.insert(AUTHORIZATION, header_value);
Ok(map)
}
}
impl core::convert::TryFrom<PostGwApiV1StatementsRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(
headers: PostGwApiV1StatementsRequestHeader,
) -> core::result::Result<Self, Self::Error> {
http::HeaderMap::try_from(&headers)
}
}
/// Response types for post_gw_api_v1_statements
#[derive(Debug, Clone)]
pub enum PostGwApiV1StatementsResponse {
///200: Returns a JSON object containing the relevant statement.
Ok(GetStatementsResponse),
///400: Returns a Problem detail instance representing a bad request.
BadRequest,
///401: Returns a Problem detail instance representing an unauthorized request.
Unauthorized,
///402: Returns a Problem detail instance representing an unauthorized request.
PaymentRequired,
///403: Returns a Problem detail instance representing a forbidden request.
Forbidden,
///500: Returns a Problem detail instance representing an internal server error.
InternalServerError,
///default: Unknown response
Unknown,
}
/// <br>**Scope**: `statements.write` OR `reports.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1TaxDocumentsRequest {
#[validate(nested)]
pub header: PostGwApiV1TaxDocumentsRequestHeader,
/// Tax Form request object
#[validate(nested)]
pub body: TaxFormRequest,
}
impl PostGwApiV1TaxDocumentsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1TaxDocumentsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<TaxFormResponse>::json_with_diagnostics(req)
.await?;
return Ok(PostGwApiV1TaxDocumentsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1TaxDocumentsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(PostGwApiV1TaxDocumentsResponse::Unauthorized);
}
if status == http::StatusCode::PAYMENT_REQUIRED {
let _ = req.bytes().await?;
return Ok(PostGwApiV1TaxDocumentsResponse::PaymentRequired);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1TaxDocumentsResponse::Forbidden);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1TaxDocumentsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1TaxDocumentsResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1TaxDocumentsRequestHeader {
/// Specifies the authorization header value (e.g., Bearer eyJ0eXAiOiJKV1...).
/// - Example: `"Bearer eyJ0eXAiOiJKV1...".to_string()`
#[validate(length(min = 1u64))]
pub authorization: String,
}
impl core::convert::TryFrom<&PostGwApiV1TaxDocumentsRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(
headers: &PostGwApiV1TaxDocumentsRequestHeader,
) -> core::result::Result<Self, Self::Error> {
let mut map = http::HeaderMap::with_capacity(1usize);
let header_value = http::HeaderValue::try_from(&headers.authorization)?;
map.insert(AUTHORIZATION, header_value);
Ok(map)
}
}
impl core::convert::TryFrom<PostGwApiV1TaxDocumentsRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(
headers: PostGwApiV1TaxDocumentsRequestHeader,
) -> core::result::Result<Self, Self::Error> {
http::HeaderMap::try_from(&headers)
}
}
/// Response types for post_gw_api_v1_tax_documents
#[derive(Debug, Clone)]
pub enum PostGwApiV1TaxDocumentsResponse {
///200: Returns a JSON object containing the relevant Tax Form.
Ok(TaxFormResponse),
///400: Returns a Problem detail instance representing a bad request.
BadRequest,
///401: Returns a Problem detail instance representing an unauthorized request.
Unauthorized,
///402: Returns a Problem detail instance representing an unauthorized request.
PaymentRequired,
///403: Returns a Problem detail instance representing a forbidden request.
Forbidden,
///500: Returns a Problem detail instance representing an internal server error.
InternalServerError,
///default: Unknown response
Unknown,
}
/// <br>**Scope**: `statements.write` OR `reports.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1TradeConfirmationsRequest {
#[validate(nested)]
pub header: PostGwApiV1TradeConfirmationsRequestHeader,
/// Trade confirmation request body
#[validate(nested)]
pub body: TradeConfirmationRequest,
}
impl PostGwApiV1TradeConfirmationsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostGwApiV1TradeConfirmationsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<TradeConfirmationResponse>::json_with_diagnostics(
req,
)
.await?;
return Ok(PostGwApiV1TradeConfirmationsResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostGwApiV1TradeConfirmationsResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(PostGwApiV1TradeConfirmationsResponse::Unauthorized);
}
if status == http::StatusCode::PAYMENT_REQUIRED {
let _ = req.bytes().await?;
return Ok(PostGwApiV1TradeConfirmationsResponse::PaymentRequired);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(PostGwApiV1TradeConfirmationsResponse::Forbidden);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostGwApiV1TradeConfirmationsResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(PostGwApiV1TradeConfirmationsResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct PostGwApiV1TradeConfirmationsRequestHeader {
/// Specifies the authorization header value (e.g., Bearer eyJ0eXAiOiJKV1...).
/// - Example: `"Bearer eyJ0eXAiOiJKV1...".to_string()`
#[validate(length(min = 1u64))]
pub authorization: String,
}
impl core::convert::TryFrom<&PostGwApiV1TradeConfirmationsRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(
headers: &PostGwApiV1TradeConfirmationsRequestHeader,
) -> core::result::Result<Self, Self::Error> {
let mut map = http::HeaderMap::with_capacity(1usize);
let header_value = http::HeaderValue::try_from(&headers.authorization)?;
map.insert(AUTHORIZATION, header_value);
Ok(map)
}
}
impl core::convert::TryFrom<PostGwApiV1TradeConfirmationsRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(
headers: PostGwApiV1TradeConfirmationsRequestHeader,
) -> core::result::Result<Self, Self::Error> {
http::HeaderMap::try_from(&headers)
}
}
/// Response types for post_gw_api_v1_trade_confirmations
#[derive(Debug, Clone)]
pub enum PostGwApiV1TradeConfirmationsResponse {
///200: Returns a JSON object containing the relevant Trade Confirmation.
Ok(TradeConfirmationResponse),
///400: Returns a Problem detail instance representing a bad request.
BadRequest,
///401: Returns a Problem detail instance representing an unauthorized request.
Unauthorized,
///402: Returns a Problem detail instance representing an unauthorized request.
PaymentRequired,
///403: Returns a Problem detail instance representing a forbidden request.
Forbidden,
///500: Returns a Problem detail instance representing an internal server error.
InternalServerError,
///default: Unknown response
Unknown,
}
/// Create a named watchlist by submitting a set of conids.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PostNewWatchlistRequest {
/// Watchlist contents.
#[validate(nested)]
pub body: WatchlistRequestBody,
}
impl PostNewWatchlistRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PostNewWatchlistResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Watchlist200Response>::json_with_diagnostics(req)
.await?;
return Ok(PostNewWatchlistResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PostNewWatchlistResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(PostNewWatchlistResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PostNewWatchlistResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(PostNewWatchlistResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(PostNewWatchlistResponse::Unknown);
}
}
/// Response types for postNewWatchlist
#[derive(Debug, Clone)]
pub enum PostNewWatchlistResponse {
///200: Watchlist creation successful.
Ok(Watchlist200Response),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct PredefinedDestinationInstruction {
/// - Example: `"U2323232".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64, max = 10u64))]
pub account_id: String,
/// - Example: `"ACH"`
#[serde(rename = "bankInstructionMethod")]
pub bank_instruction_method: PredefinedDestinationInstructionBankInstructionMethod,
/// - Example: `"Instruction".to_string()`
#[serde(rename = "bankInstructionName")]
#[validate(length(min = 1u64, max = 100u64))]
pub bank_instruction_name: String,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `"USD".to_string()`
#[validate(length(min = 3u64, max = 3u64))]
pub currency: String,
#[serde(rename = "financialInstitution")]
#[validate(nested)]
pub financial_institution: PredefinedDestinationInstructionFinancialInstitution,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum PredefinedDestinationInstructionBankInstructionMethod {
#[serde(rename = "LVP")]
#[default]
Lvp,
#[serde(rename = "SEPA")]
Sepa,
#[serde(rename = "WIRE")]
Wire,
#[serde(rename = "ACH")]
Ach,
#[serde(rename = "CPA")]
Cpa,
}
impl core::fmt::Display for PredefinedDestinationInstructionBankInstructionMethod {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Lvp => write!(f, "LVP"),
Self::Sepa => write!(f, "SEPA"),
Self::Wire => write!(f, "WIRE"),
Self::Ach => write!(f, "ACH"),
Self::Cpa => write!(f, "CPA"),
}
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct PredefinedDestinationInstructionFinancialInstitution {
#[serde(rename = "branchCode")]
#[validate(length(min = 0u64, max = 32u64))]
pub branch_code: Option<String>,
/// - Example: `Some("BSB_AUD")`
#[serde(rename = "branchCodeType")]
pub branch_code_type:
Option<PredefinedDestinationInstructionFinancialInstitutionBranchCodeType>,
/// - Example: `"132456789".to_string()`
#[serde(rename = "clientAccountId")]
#[validate(length(min = 1u64, max = 32u64))]
pub client_account_id: String,
/// - Example: `"SBIN001000".to_string()`
#[validate(length(min = 1u64, max = 24u64))]
pub identifier: String,
/// - Example: `"BIC"`
#[serde(rename = "identifierType")]
pub identifier_type: PredefinedDestinationInstructionFinancialInstitutionIdentifierType,
/// - Example: `"SBI BANK".to_string()`
#[validate(length(min = 1u64, max = 100u64))]
pub name: String,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum PredefinedDestinationInstructionFinancialInstitutionBranchCodeType {
#[serde(rename = "BSB_AUD")]
#[default]
BsbAud,
#[serde(rename = "BANK_CODE_CAD")]
BankCodeCad,
#[serde(rename = "NONE")]
None,
}
impl core::fmt::Display for PredefinedDestinationInstructionFinancialInstitutionBranchCodeType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::BsbAud => write!(f, "BSB_AUD"),
Self::BankCodeCad => write!(f, "BANK_CODE_CAD"),
Self::None => write!(f, "NONE"),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum PredefinedDestinationInstructionFinancialInstitutionIdentifierType {
#[serde(rename = "BIC")]
#[default]
Bic,
#[serde(rename = "IFSC")]
Ifsc,
}
impl core::fmt::Display for PredefinedDestinationInstructionFinancialInstitutionIdentifierType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Bic => write!(f, "BIC"),
Self::Ifsc => write!(f, "IFSC"),
}
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
pub struct Presets {
/// Interactive Brokers supports two forms of allocation methods. Allocation methods that have calculations completed by Interactive Brokers, and a set of allocation methods calculated by the user and then specified. IB-computed allocation methods:
/// * `A` - Available Equity
/// * `E` - Equal
/// * `N` - Net Liquidation Value
///
/// User-specified allocation methods:
/// * `C` - Cash Quantity
/// * `P` - Percentage
/// * `R` - Ratios
/// * `S` - Shares
pub default_method_for_all: Option<PresetsDefaultMethodForAll>,
/// Determines if allocation groups should prioritize closing positions over equal distribution.
pub group_auto_close_positions: Option<bool>,
/// Determines if the system should keep allocation groups proportional for scaling.
pub group_proportional_allocation: Option<bool>,
/// Determines if allocation profiles should prioritize closing positions over equal distribution.
pub profiles_auto_close_positions: Option<bool>,
/// Determines if the system should always check user credit before beginning the order process every time, or only at the time of order placement and execution.
pub strict_credit_check: Option<bool>,
}
/// Interactive Brokers supports two forms of allocation methods. Allocation methods that have calculations completed by Interactive Brokers, and a set of allocation methods calculated by the user and then specified. IB-computed allocation methods:
/// * `A` - Available Equity
/// * `E` - Equal
/// * `N` - Net Liquidation Value
///
/// User-specified allocation methods:
/// * `C` - Cash Quantity
/// * `P` - Percentage
/// * `R` - Ratios
/// * `S` - Shares
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
pub enum PresetsDefaultMethodForAll {
#[default]
AvailableEquity,
E,
N,
C,
P,
R,
S,
}
impl core::fmt::Display for PresetsDefaultMethodForAll {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::AvailableEquity => write!(f, "AvailableEquity"),
Self::E => write!(f, "E"),
Self::N => write!(f, "N"),
Self::C => write!(f, "C"),
Self::P => write!(f, "P"),
Self::R => write!(f, "R"),
Self::S => write!(f, "S"),
}
}
}
/// Preview the projected effects of an order ticket or bracket of orders, including cost and changes to margin and account equity.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct PreviewMarginImpactRequest {
#[validate(nested)]
pub path: PreviewMarginImpactRequestPath,
#[validate(nested)]
pub body: OrdersSubmissionRequest,
}
impl PreviewMarginImpactRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<PreviewMarginImpactResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<OrderPreview>::json_with_diagnostics(req).await?;
return Ok(PreviewMarginImpactResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(PreviewMarginImpactResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(PreviewMarginImpactResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(PreviewMarginImpactResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(PreviewMarginImpactResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(PreviewMarginImpactResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct PreviewMarginImpactRequestPath {
/// The account to which the order will clear.
/// - Example: `"DU123456".to_string()`
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for previewMarginImpact
#[derive(Debug, Clone)]
pub enum PreviewMarginImpactResponse {
///200: Order Preview
Ok(OrderPreview),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum Query201Response {
#[default]
RecentRecurringEvent(QueryRecentRecurringEventResponse),
BankInstruction(QueryBankInstructionResponse),
RecurringInstructions(QueryRecurringInstructionsResponse),
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum Query201Response2 {
#[default]
QueryWithdrawableAmountsResponse(QueryWithdrawableAmountsResponse),
WithoutOriginHold(QueryWithdrawableAmountsWithoutOriginHoldResponse),
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct QueryBankInstruction {
/// - Example: `"U399192".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64))]
pub account_id: String,
/// - Example: `"WIRE"`
#[serde(rename = "bankInstructionMethod")]
pub bank_instruction_method: BankInstructionMethod,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryBankInstructionResponse {
#[serde(rename = "instructionResult")]
pub instruction_result: Option<QueryBankInstructionResult>,
/// - Example: `-1988905739.0`
#[serde(rename = "instructionSetId")]
pub instruction_set_id: f64,
/// - Example: `202.0`
pub status: f64,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryBankInstructionResult {
#[serde(rename = "accountId")]
pub account_id: String,
#[serde(rename = "bankInstructionDetails")]
pub bank_instruction_details: Vec<QueryBankInstructionResultBankInstructionDetail>,
#[serde(rename = "bankInstructionMethod")]
pub bank_instruction_method: BankInstructionMethod,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `Some("Please poll for status after 10 minutes".to_string())`
pub description: Option<String>,
/// - Example: `Some(23456745.0)`
#[serde(rename = "ibReferenceId")]
pub ib_reference_id: Option<f64>,
/// - Example: `45123654.0`
#[serde(rename = "instructionId")]
pub instruction_id: f64,
/// - Example: `"PENDING"`
#[serde(rename = "instructionStatus")]
pub instruction_status: InstructionResultInstructionStatus,
/// - Example: `"INTERNAL_CASH_TRANSFER"`
#[serde(rename = "instructionType")]
pub instruction_type: InstructionResultInstructionType,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryBankInstructionResultBankInstructionDetail {
/// - Example: `"*****0000".to_string()`
#[serde(rename = "bankAccountNumber")]
pub bank_account_number: String,
/// - Example: `"000000000".to_string()`
#[serde(rename = "bankRoutingNumber")]
pub bank_routing_number: String,
/// - Example: `"USD".to_string()`
pub currency: String,
/// - Example: `"testinstr".to_string()`
#[serde(rename = "instructionName")]
pub instruction_name: String,
/// - Example: `"PROCESSED".to_string()`
#[serde(rename = "instructionStatus")]
pub instruction_status: String,
/// - Example: `"CREDIT".to_string()`
#[serde(rename = "type")]
pub r#type: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct QueryIRAContributions {
/// - Example: `"U399192".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64))]
pub account_id: String,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `"2003".to_string()`
#[validate(length(min = 4u64, max = 4u64))]
pub year: String,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryIRAContributionsResponse {
#[serde(rename = "instructionResult")]
pub instruction_result: Option<QueryIRAContributionsResult>,
/// - Example: `-1988905739.0`
#[serde(rename = "instructionSetId")]
pub instruction_set_id: f64,
/// - Example: `202.0`
pub status: f64,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryIRAContributionsResult {
#[serde(rename = "accountId")]
pub account_id: String,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
pub contributions: Vec<QueryIRAContributionsResultContribution>,
/// - Example: `Some("Please poll for status after 10 minutes".to_string())`
pub description: Option<String>,
pub error: Option<ResultError>,
/// - Example: `Some(23456745.0)`
#[serde(rename = "ibReferenceId")]
pub ib_reference_id: Option<f64>,
/// - Example: `45123654.0`
#[serde(rename = "instructionId")]
pub instruction_id: f64,
/// - Example: `"PENDING"`
#[serde(rename = "instructionStatus")]
pub instruction_status: PollingInstructionResultInstructionStatus,
/// - Example: `"INTERNAL_CASH_TRANSFER"`
#[serde(rename = "instructionType")]
pub instruction_type: InstructionResultInstructionType,
#[serde(rename = "iraType")]
pub ira_type: String,
pub year: String,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryIRAContributionsResultContribution {
#[serde(rename = "allowedContributionLimit")]
pub allowed_contribution_limit: f64,
#[serde(rename = "maximumContributionLimit")]
pub maximum_contribution_limit: f64,
#[serde(rename = "yearToDateContribution")]
pub year_to_date_contribution: f64,
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum QueryInstructionKind {
#[default]
BankInstruction(QueryBankInstruction),
RecentRecurringEvents(QueryRecentRecurringEvents),
RecurringInstructions(QueryRecurringInstructions),
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum QueryInstructionKind2 {
#[default]
WithdrawableFunds(QueryWithdrawableFunds),
IRAContributions(QueryIRAContributions),
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryRecentInstructionResponse {
#[serde(rename = "instructionResult")]
pub instruction_result: Option<QueryRecentInstructionResult>,
/// - Example: `-1988905739.0`
#[serde(rename = "instructionSetId")]
pub instruction_set_id: f64,
/// - Example: `202.0`
pub status: f64,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryRecentInstructionResult {
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `Some("Please poll for status after 10 minutes".to_string())`
pub description: Option<String>,
pub error: Option<ResultError>,
/// - Example: `Some(23456745.0)`
#[serde(rename = "ibReferenceId")]
pub ib_reference_id: Option<f64>,
#[serde(rename = "instructionHistory")]
pub instruction_history: QueryRecentInstructionResultInstructionHistory,
/// - Example: `45123654.0`
#[serde(rename = "instructionId")]
pub instruction_id: f64,
/// - Example: `"PENDING"`
#[serde(rename = "instructionStatus")]
pub instruction_status: PollingInstructionResultInstructionStatus,
/// - Example: `"INTERNAL_CASH_TRANSFER"`
#[serde(rename = "instructionType")]
pub instruction_type: InstructionResultInstructionType,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryRecentInstructionResultInstructionHistory {
#[serde(rename = "historyMaxDepthNumberOfDays")]
pub history_max_depth_number_of_days: i32,
#[serde(rename = "historyMaxDepthNumberOfInstruction")]
pub history_max_depth_number_of_instruction: i32,
pub result: Vec<serde_json::Value>,
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct QueryRecentInstructions {
/// - Example: `"U399192".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64))]
pub account_id: String,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
#[serde(rename = "transactionHistory")]
#[validate(nested)]
pub transaction_history: QueryRecentInstructionsTransactionHistory,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct QueryRecentInstructionsTransactionHistory {
/// - Example: `5.0`
#[serde(rename = "daysToGoBack")]
#[validate(range(min = 1.0))]
pub days_to_go_back: f64,
/// - Example: `Some("INTERNAL_CASH_TRANSFER")`
#[serde(rename = "transactionType")]
pub transaction_type: Option<QueryRecentInstructionsTransactionHistoryTransactionType>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum QueryRecentInstructionsTransactionHistoryTransactionType {
#[serde(rename = "ALL")]
#[default]
All,
#[serde(rename = "ACH_INSTRUCTION")]
AchInstruction,
#[serde(rename = "PREDEFINED_DESTINATION_INSTRUCTION")]
PredefinedDestinationInstruction,
#[serde(rename = "WITHDRAWAL")]
Withdrawal,
#[serde(rename = "DEPOSIT")]
Deposit,
#[serde(rename = "DWAC")]
Dwac,
#[serde(rename = "FOP")]
Fop,
#[serde(rename = "EDDA_INSTRUCTION")]
EddaInstruction,
#[serde(rename = "TRADITIONAL_BANK_INSTRUCTION_VERIFICATION")]
TraditionalBankInstructionVerification,
#[serde(rename = "CANCEL_INSTRUCTION")]
CancelInstruction,
#[serde(rename = "DELETE_BANK_INSTRUCTION")]
DeleteBankInstruction,
#[serde(rename = "EXTERNAL_POSITION_TRANSFER")]
ExternalPositionTransfer,
#[serde(rename = "INTERNAL_CASH_TRANSFER")]
InternalCashTransfer,
#[serde(rename = "INTERNAL_POSITION_TRANSFER")]
InternalPositionTransfer,
#[serde(rename = "COMPLEX_ASSET_TRANSFER")]
ComplexAssetTransfer,
}
impl core::fmt::Display for QueryRecentInstructionsTransactionHistoryTransactionType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::All => write!(f, "ALL"),
Self::AchInstruction => write!(f, "ACH_INSTRUCTION"),
Self::PredefinedDestinationInstruction => {
write!(f, "PREDEFINED_DESTINATION_INSTRUCTION")
}
Self::Withdrawal => write!(f, "WITHDRAWAL"),
Self::Deposit => write!(f, "DEPOSIT"),
Self::Dwac => write!(f, "DWAC"),
Self::Fop => write!(f, "FOP"),
Self::EddaInstruction => write!(f, "EDDA_INSTRUCTION"),
Self::TraditionalBankInstructionVerification => {
write!(f, "TRADITIONAL_BANK_INSTRUCTION_VERIFICATION")
}
Self::CancelInstruction => write!(f, "CANCEL_INSTRUCTION"),
Self::DeleteBankInstruction => write!(f, "DELETE_BANK_INSTRUCTION"),
Self::ExternalPositionTransfer => write!(f, "EXTERNAL_POSITION_TRANSFER"),
Self::InternalCashTransfer => write!(f, "INTERNAL_CASH_TRANSFER"),
Self::InternalPositionTransfer => write!(f, "INTERNAL_POSITION_TRANSFER"),
Self::ComplexAssetTransfer => write!(f, "COMPLEX_ASSET_TRANSFER"),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryRecentRecurringEventResponse {
#[serde(rename = "instructionResult")]
pub instruction_result: Option<QueryRecentRecurringEventResult>,
/// - Example: `-1988905739.0`
#[serde(rename = "instructionSetId")]
pub instruction_set_id: f64,
/// - Example: `202.0`
pub status: f64,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryRecentRecurringEventResult {
pub amount: f64,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
pub currency: String,
/// - Example: `Some("Please poll for status after 10 minutes".to_string())`
pub description: Option<String>,
/// - Example: `Some(23456745.0)`
#[serde(rename = "ibReferenceId")]
pub ib_reference_id: Option<f64>,
/// - Example: `45123654.0`
#[serde(rename = "instructionId")]
pub instruction_id: f64,
/// - Example: `"PENDING"`
#[serde(rename = "instructionStatus")]
pub instruction_status: InstructionResultInstructionStatus,
/// - Example: `"INTERNAL_CASH_TRANSFER"`
#[serde(rename = "instructionType")]
pub instruction_type: InstructionResultInstructionType,
pub method: String,
#[serde(rename = "recurringInstructionName")]
pub recurring_instruction_name: String,
#[serde(rename = "recurringTransactionStatus")]
pub recurring_transaction_status: String,
#[serde(rename = "recurringTransactionType")]
pub recurring_transaction_type: String,
#[serde(rename = "transactionHistory")]
pub transaction_history: QueryRecentRecurringEventResultTransactionHistory,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryRecentRecurringEventResultTransactionHistory {
#[serde(rename = "maxNumberOfTransactions")]
pub max_number_of_transactions: Option<i32>,
pub result: Option<Vec<QueryRecentRecurringEventResultTransactionHistoryResult>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryRecentRecurringEventResultTransactionHistoryResult {
#[serde(rename = "ibRequestId")]
pub ib_request_id: Option<i32>,
pub status: Option<String>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct QueryRecentRecurringEvents {
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `-343872793.0`
#[serde(rename = "ibReferenceId")]
#[validate(range(min = 0.0))]
pub ib_reference_id: f64,
/// - Example: `Some(15.0)`
#[serde(rename = "numberOfTransactions")]
#[validate(range(min = 1.0))]
pub number_of_transactions: Option<f64>,
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct QueryRecurringInstructions {
/// - Example: `"U399192".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64))]
pub account_id: String,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryRecurringInstructionsResponse {
#[serde(rename = "instructionResult")]
pub instruction_result: Option<QueryRecurringInstructionsResult>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryRecurringInstructionsResult {
#[serde(rename = "accountId")]
pub account_id: String,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `Some("Please poll for status after 10 minutes".to_string())`
pub description: Option<String>,
/// - Example: `Some(23456745.0)`
#[serde(rename = "ibReferenceId")]
pub ib_reference_id: Option<f64>,
/// - Example: `45123654.0`
#[serde(rename = "instructionId")]
pub instruction_id: f64,
/// - Example: `"PENDING"`
#[serde(rename = "instructionStatus")]
pub instruction_status: InstructionResultInstructionStatus,
/// - Example: `"INTERNAL_CASH_TRANSFER"`
#[serde(rename = "instructionType")]
pub instruction_type: InstructionResultInstructionType,
#[serde(rename = "recurringInstructions")]
pub recurring_instructions: Vec<QueryRecurringInstructionsResultRecurringInstruction>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryRecurringInstructionsResultRecurringInstruction {
pub amount: Option<f64>,
#[serde(rename = "bankInstructionMethod")]
pub bank_instruction_method: Option<String>,
#[serde(rename = "bankInstructionName")]
pub bank_instruction_name: Option<String>,
pub currency: Option<String>,
#[serde(rename = "endDate")]
pub end_date: Option<String>,
pub frequency: Option<String>,
#[serde(rename = "requestId")]
pub request_id: Option<i32>,
#[serde(rename = "startDate")]
pub start_date: Option<String>,
#[serde(rename = "transactionType")]
pub transaction_type: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
#[serde(default)]
pub struct QueryRequestBody {
pub instruction: QueryRequestBodyInstruction,
#[serde(rename = "instructionType")]
#[default("QUERY_WITHDRAWABLE_CASH_EQUITY".to_string())]
pub instruction_type: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct QueryRequestBody2 {
pub instruction: QueryInstructionKind,
#[serde(rename = "instructionType")]
pub instruction_type: QueryRequestBody2InstructionType,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum QueryRequestBody2InstructionType {
#[serde(rename = "QUERY_BANK_INSTRUCTION")]
#[default]
QueryBankInstruction,
#[serde(rename = "QUERY_RECENT_RECURRING_EVENTS")]
QueryRecentRecurringEvents,
#[serde(rename = "QUERY_RECURRING_INSTRUCTIONS")]
QueryRecurringInstructions,
}
impl core::fmt::Display for QueryRequestBody2InstructionType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::QueryBankInstruction => write!(f, "QUERY_BANK_INSTRUCTION"),
Self::QueryRecentRecurringEvents => {
write!(f, "QUERY_RECENT_RECURRING_EVENTS")
}
Self::QueryRecurringInstructions => write!(f, "QUERY_RECURRING_INSTRUCTIONS"),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct QueryRequestBody3 {
pub instruction: QueryInstructionKind2,
#[serde(rename = "instructionType")]
pub instruction_type: QueryRequestBody3InstructionType,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum QueryRequestBody3InstructionType {
#[serde(rename = "QUERY_WITHDRAWABLE_FUNDS")]
#[default]
QueryWithdrawableFunds,
#[serde(rename = "QUERY_IRA_CONTRIBUTIONS")]
QueryIraContributions,
}
impl core::fmt::Display for QueryRequestBody3InstructionType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::QueryWithdrawableFunds => write!(f, "QUERY_WITHDRAWABLE_FUNDS"),
Self::QueryIraContributions => write!(f, "QUERY_IRA_CONTRIBUTIONS"),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
#[serde(default)]
pub struct QueryRequestBody4 {
#[validate(nested)]
pub instruction: QueryRecentInstructions,
#[serde(rename = "instructionType")]
#[default("QUERY_RECENT_INSTRUCTIONS".to_string())]
pub instruction_type: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum QueryRequestBodyInstruction {
#[default]
QueryWithdrawableCashEquity(QueryWithdrawableCashEquity),
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryWithdrawableAmountsInstructionResult {
#[serde(rename = "accountId")]
pub account_id: String,
#[serde(rename = "allowedTransferAmountToMaster")]
pub allowed_transfer_amount_to_master: f64,
#[serde(rename = "allowedTransferAmountToMasterNoBorrow")]
pub allowed_transfer_amount_to_master_no_borrow: f64,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
pub currency: String,
/// - Example: `Some("Please poll for status after 10 minutes".to_string())`
pub description: Option<String>,
pub error: Option<ResultError>,
/// - Example: `Some(23456745.0)`
#[serde(rename = "ibReferenceId")]
pub ib_reference_id: Option<f64>,
/// - Example: `45123654.0`
#[serde(rename = "instructionId")]
pub instruction_id: f64,
/// - Example: `"PENDING"`
#[serde(rename = "instructionStatus")]
pub instruction_status: PollingInstructionResultInstructionStatus,
/// - Example: `"INTERNAL_CASH_TRANSFER"`
#[serde(rename = "instructionType")]
pub instruction_type: InstructionResultInstructionType,
#[serde(rename = "withdrawableAmount")]
pub withdrawable_amount: f64,
#[serde(rename = "withdrawableAmountNoBorrow")]
pub withdrawable_amount_no_borrow: f64,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryWithdrawableAmountsResponse {
#[serde(rename = "instructionResult")]
pub instruction_result: Option<QueryWithdrawableAmountsInstructionResult>,
/// - Example: `-1988905739.0`
#[serde(rename = "instructionSetId")]
pub instruction_set_id: f64,
/// - Example: `202.0`
pub status: f64,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryWithdrawableAmountsWithoutOriginHoldResponse {
#[serde(rename = "instructionResult")]
pub instruction_result: Option<QueryWithdrawableAmountsWithoutOriginHoldResult>,
/// - Example: `-1988905739.0`
#[serde(rename = "instructionSetId")]
pub instruction_set_id: f64,
/// - Example: `202.0`
pub status: f64,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QueryWithdrawableAmountsWithoutOriginHoldResult {
#[serde(rename = "accountId")]
pub account_id: String,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
pub currency: String,
/// - Example: `Some("Please poll for status after 10 minutes".to_string())`
pub description: Option<String>,
pub error: Option<ResultError>,
/// - Example: `Some(23456745.0)`
#[serde(rename = "ibReferenceId")]
pub ib_reference_id: Option<f64>,
/// - Example: `45123654.0`
#[serde(rename = "instructionId")]
pub instruction_id: f64,
/// - Example: `"PENDING"`
#[serde(rename = "instructionStatus")]
pub instruction_status: PollingInstructionResultInstructionStatus,
/// - Example: `"INTERNAL_CASH_TRANSFER"`
#[serde(rename = "instructionType")]
pub instruction_type: InstructionResultInstructionType,
#[serde(rename = "withdrawableAmountWithoutOriginationHold")]
pub withdrawable_amount_without_origination_hold: f64,
#[serde(rename = "withdrawableAmountWithoutOriginationHoldNoBorrow")]
pub withdrawable_amount_without_origination_hold_no_borrow: f64,
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct QueryWithdrawableCashEquity {
/// - Example: `"U399192".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64))]
pub account_id: String,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `"USD".to_string()`
#[validate(length(min = 3u64, max = 3u64))]
pub currency: String,
}
#[serde_with::skip_serializing_none]
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
)]
pub struct QueryWithdrawableCashEquityResponse {
#[serde(rename = "instructionResult")]
#[validate(nested)]
pub instruction_result: Option<QueryWithdrawableCashEquityResult>,
/// - Example: `-1988905739.0`
#[serde(rename = "instructionSetId")]
pub instruction_set_id: f64,
/// - Example: `202.0`
pub status: f64,
}
#[serde_with::skip_serializing_none]
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
)]
pub struct QueryWithdrawableCashEquityResult {
#[serde(rename = "accountId")]
#[validate(length(min = 1u64))]
pub account_id: String,
#[serde(rename = "availableEquityValue")]
pub available_equity_value: f64,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
#[validate(length(min = 1u64))]
pub currency: String,
/// - Example: `Some("Please poll for status after 10 minutes".to_string())`
pub description: Option<String>,
#[validate(nested)]
pub error: Option<ResultError>,
/// - Example: `Some(23456745.0)`
#[serde(rename = "ibReferenceId")]
pub ib_reference_id: Option<f64>,
/// - Example: `45123654.0`
#[serde(rename = "instructionId")]
pub instruction_id: f64,
/// - Example: `"PENDING"`
#[serde(rename = "instructionStatus")]
pub instruction_status: PollingInstructionResultInstructionStatus,
/// - Example: `"INTERNAL_CASH_TRANSFER"`
#[serde(rename = "instructionType")]
pub instruction_type: InstructionResultInstructionType,
#[serde(rename = "withdrawableCashAmount")]
pub withdrawable_cash_amount: f64,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct QueryWithdrawableFunds {
/// - Example: `"U399192".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64))]
pub account_id: String,
/// If bankAccountNumber is provided then bankRoutingNumber is also required, cannot be passed with bankInstructionName
/// - Example: `Some("9876543210".to_string())`
#[serde(rename = "bankAccountNumber")]
#[validate(length(min = 1u64))]
pub bank_account_number: Option<String>,
/// bankInstructionName cannot be passed with (bankAccountNumber or bankRoutingNumber)
/// - Example: `Some("test".to_string())`
#[serde(rename = "bankInstructionName")]
#[validate(length(min = 1u64))]
pub bank_instruction_name: Option<String>,
/// If bankRoutingNumber is provided then bankAccountNumber is also required, cannot be passed with bankInstructionName
/// - Example: `Some("122199983".to_string())`
#[serde(rename = "bankRoutingNumber")]
#[validate(length(min = 1u64))]
pub bank_routing_number: Option<String>,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `"USD".to_string()`
#[validate(length(min = 1u64))]
pub currency: String,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct QuestionnaireResponse {
pub answers: Option<Vec<AnswerResponse>>,
#[serde(rename = "isMandatoryToAnswer")]
pub is_mandatory_to_answer: Option<bool>,
pub question: Option<String>,
#[serde(rename = "questionId")]
pub question_id: Option<i64>,
#[serde(rename = "questionType")]
pub question_type: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct RateResponse {
/// Returns the exchange rate for the currency pair.
pub rate: Option<f64>,
}
/// Mark a specific disclaimer message as read.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct ReadFyiDisclaimerRequest {
pub path: ReadFyiDisclaimerRequestPath,
}
impl ReadFyiDisclaimerRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<ModifyFyiDeliveryResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<FyiVT>::json_with_diagnostics(req).await?;
return Ok(ModifyFyiDeliveryResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(ModifyFyiDeliveryResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(ModifyFyiDeliveryResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(ModifyFyiDeliveryResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(ModifyFyiDeliveryResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(ModifyFyiDeliveryResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, oas3_gen_support::Default)]
pub struct ReadFyiDisclaimerRequestPath {
/// Many FYI endpoints reference a "typecode" value. The table below lists the available codes and what they correspond to.
/// * `BA` - Borrow Availability
/// * `CA` - Comparable Algo
/// * `DA` - Dividends Advisory
/// * `EA` - Upcoming Earnings
/// * `MF` - Mutual Fund Advisory
/// * `OE` - Option Expiration
/// * `PR` - Portfolio Builder Rebalance
/// * `SE` - Suspend Order on Economic Event
/// * `SG` - Short Term Gain turning Long Term
/// * `SM` - System Messages
/// * `T2` - Assignment Realizing Long-Term Gains
/// * `TO` - Takeover
/// * `UA` - User Alert
/// * `M8` - M871 Trades
/// * `PS` - Platform Use Suggestions
/// * `DL` - Unexercised Option Loss Prevention Reminder
/// * `PT` - Position Transfer
/// * `CB` - Missing Cost Basis
/// * `MS` - Milestones
/// * `TD` - MiFID || 10% Deprecation Notice
/// * `ST` - Save Taxes
/// * `TI` - Trade Idea
/// * `CT` - Cash Transfer
pub typecode: Typecodes,
}
/// Mark a particular notification message as read or unread.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct ReadFyiNotificationRequest {
pub path: ReadFyiNotificationRequestPath,
}
impl ReadFyiNotificationRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<ReadFyiNotificationResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<
NotificationReadAcknowledge,
>::json_with_diagnostics(req)
.await?;
return Ok(ReadFyiNotificationResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(ReadFyiNotificationResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(ReadFyiNotificationResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(ReadFyiNotificationResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(ReadFyiNotificationResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(ReadFyiNotificationResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, oas3_gen_support::Default)]
pub struct ReadFyiNotificationRequestPath {
/// Code used to signify a specific notification to mark. Value received from /fyi/notifications
pub notification_id: serde_json::Value,
}
/// Response types for readFyiNotification
#[derive(Debug, Clone)]
pub enum ReadFyiNotificationResponse {
///200: Successfully enabled or disabled your email notifications.
Ok(NotificationReadAcknowledge),
///400: Invalid input format or missing required fields
BadRequest,
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct RecurringInstructionDetail {
/// - Example: `Some("2023-10-16".to_string())`
#[serde(rename = "endDate")]
pub end_date: Option<String>,
/// - Example: `"MONTHLY"`
pub frequency: RecurringInstructionDetailFrequency,
/// - Example: `"Arkansas-Test".to_string()`
#[serde(rename = "instructionName")]
#[validate(length(min = 1u64, max = 64u64))]
pub instruction_name: String,
/// - Example: `"2023-10-16".to_string()`
#[serde(rename = "startDate")]
#[validate(length(min = 1u64))]
pub start_date: String,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum RecurringInstructionDetailFrequency {
#[serde(rename = "MONTHLY")]
#[default]
Monthly,
#[serde(rename = "QUARTERLY")]
Quarterly,
#[serde(rename = "YEARLY")]
Yearly,
}
impl core::fmt::Display for RecurringInstructionDetailFrequency {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Monthly => write!(f, "MONTHLY"),
Self::Quarterly => write!(f, "QUARTERLY"),
Self::Yearly => write!(f, "YEARLY"),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct RegistrationTask {
pub action: Option<String>,
#[serde(rename = "dateCompleted")]
pub date_completed: Option<chrono::DateTime<chrono::Utc>>,
#[serde(rename = "externalId")]
pub external_id: Option<String>,
#[serde(rename = "formName")]
pub form_name: Option<String>,
#[serde(rename = "formNumber")]
pub form_number: Option<i32>,
#[serde(rename = "isCompleted")]
pub is_completed: Option<bool>,
#[serde(rename = "isDeclined")]
pub is_declined: Option<bool>,
#[serde(rename = "isRequiredForApproval")]
pub is_required_for_approval: Option<bool>,
#[serde(rename = "questionIds")]
pub question_ids: Option<Vec<i32>>,
pub state: Option<String>,
pub warning: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct RegistrationTasksResponse {
#[serde(rename = "accountId")]
pub account_id: Option<String>,
pub description: Option<String>,
pub error: Option<Box<ErrorResponse>>,
#[serde(rename = "errorDescription")]
pub error_description: Option<String>,
#[serde(rename = "hasError")]
pub has_error: Option<bool>,
#[serde(rename = "registrationTaskPresent")]
pub registration_task_present: Option<bool>,
#[serde(rename = "registrationTasks")]
pub registration_tasks: Option<Vec<RegistrationTask>>,
pub state: Option<String>,
pub status: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum Reply200Response {
/// A successful submission of one or more order tickets.
#[default]
OrderSubmitSuccess(OrderSubmitSuccess),
/// An array containing objects that each deliver the order reply messages emitted against one order ticket in the submission request's array. Indicies of the order reply message objects in this array correspond to the indicies of the order tickets in the submission request's array.
OrderReplyMessage(OrderReplyMessage),
/// Indicates that the order reply message or submission was not accepted.
OrderSubmitError(OrderSubmitError),
/// Indicates that the order reply ID does not exist.
OrderReplyNotFound(OrderReplyNotFound),
/// Relates a message generated in response to the rejection of the submitted order ticket. In some cases, it may also present a mechanism to resubmit the same order following a prompted decision.
AdvancedOrderReject(AdvancedOrderReject),
}
impl Reply200Response {
/// Indicates that the order reply message or submission was not accepted.
pub fn order_submit_error(error: Option<String>) -> Self {
Self::OrderSubmitError(OrderSubmitError {
error,
..Default::default()
})
}
/// Indicates that the order reply ID does not exist.
pub fn order_reply_not_found(error: Option<String>) -> Self {
Self::OrderReplyNotFound(OrderReplyNotFound {
error,
..Default::default()
})
}
/// Relates a message generated in response to the rejection of the submitted order ticket. In some cases, it may also present a mechanism to resubmit the same order following a prompted decision.
pub fn advanced_order_reject() -> Self {
Self::AdvancedOrderReject(AdvancedOrderReject::default())
}
}
/// Request an access token for the IB username that has granted authorization to the consumer.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct ReqAccessTokenRequest {
pub header: ReqAccessTokenRequestHeader,
}
impl ReqAccessTokenRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<ReqAccessTokenResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<AccessToken200Response>::json_with_diagnostics(req)
.await?;
return Ok(ReqAccessTokenResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(ReqAccessTokenResponse::Unauthorized);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(ReqAccessTokenResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(ReqAccessTokenResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, oas3_gen_support::Default)]
pub struct ReqAccessTokenRequestHeader {
/// OAuth 1.0a authorization request header for request to /access_token endpoint.
/// - Example: `Some("OAuth oauth_verifier=\"1e1dc5666e87ca5a18e0\",oauth_token=\"e0d75b4c5c1d2c0f2af7\",oauth_consumer_key=\"TESTCONS\",oauth_nonce=\"v235...456h\",oauth_signature=\"af1%252...0nd2\",oauth_signature_method=\"RSA-SHA256\",oauth_timestamp=\"1714489450\",realm=\"test_realm\"".to_string())`
pub authorization: Option<String>,
}
impl core::convert::TryFrom<&ReqAccessTokenRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(headers: &ReqAccessTokenRequestHeader) -> core::result::Result<Self, Self::Error> {
let mut map = http::HeaderMap::with_capacity(1usize);
if let Some(value) = &headers.authorization {
let header_value = http::HeaderValue::try_from(value)?;
map.insert(AUTHORIZATION, header_value);
}
Ok(map)
}
}
impl core::convert::TryFrom<ReqAccessTokenRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(headers: ReqAccessTokenRequestHeader) -> core::result::Result<Self, Self::Error> {
http::HeaderMap::try_from(&headers)
}
}
/// Response types for reqAccessToken
#[derive(Debug, Clone)]
pub enum ReqAccessTokenResponse {
///200: Success response with permanent OAuth access token
Ok(AccessToken200Response),
///401: Invalid or expired access token
Unauthorized,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct ReqIDRequestBody {
/// Request identifier to uniquely track a request.
/// - Example: `540_608i32`
#[serde(rename = "reqID")]
pub req_id: i32,
}
/// Generate a Live Session Token shared secret and gain access to Web API.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct ReqLiveSessionTokenRequest {
pub header: ReqLiveSessionTokenRequestHeader,
}
impl ReqLiveSessionTokenRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<ReqLiveSessionTokenResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<
LiveSessionToken200Response,
>::json_with_diagnostics(req)
.await?;
return Ok(ReqLiveSessionTokenResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(ReqLiveSessionTokenResponse::Unauthorized);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(ReqLiveSessionTokenResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(ReqLiveSessionTokenResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, oas3_gen_support::Default)]
pub struct ReqLiveSessionTokenRequestHeader {
/// OAuth 1.0a authorization request header for request to /live_session_token endpoint.
/// - Example: `Some("OAuth diffie_hellman_challenge=\"b393...g6f3\",oauth_token=\"56786fc07bcbabc4584\",oauth_consumer_key=\"TESTCONS\",oauth_nonce=\"v235...456h\",oauth_signature=\"af1%252...0nd2\",oauth_signature_method=\"RSA-SHA256\",oauth_timestamp=\"1714489460\",realm=\"test_realm\"".to_string())`
pub authorization: Option<String>,
}
impl core::convert::TryFrom<&ReqLiveSessionTokenRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(
headers: &ReqLiveSessionTokenRequestHeader,
) -> core::result::Result<Self, Self::Error> {
let mut map = http::HeaderMap::with_capacity(1usize);
if let Some(value) = &headers.authorization {
let header_value = http::HeaderValue::try_from(value)?;
map.insert(AUTHORIZATION, header_value);
}
Ok(map)
}
}
impl core::convert::TryFrom<ReqLiveSessionTokenRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(
headers: ReqLiveSessionTokenRequestHeader,
) -> core::result::Result<Self, Self::Error> {
http::HeaderMap::try_from(&headers)
}
}
/// Response types for reqLiveSessionToken
#[derive(Debug, Clone)]
pub enum ReqLiveSessionTokenResponse {
///200: Success response with Diffie-Hellman challenge and Signature value
Ok(LiveSessionToken200Response),
///401: Invalid or expired access token
Unauthorized,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Request a temporary token as a third party to begin the OAuth 1.0a authorization workflow.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct ReqTempTokenRequest {
pub header: ReqTempTokenRequestHeader,
}
impl ReqTempTokenRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<ReqTempTokenResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<OauthTokenResponse>::json_with_diagnostics(req)
.await?;
return Ok(ReqTempTokenResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(ReqTempTokenResponse::Unauthorized);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(ReqTempTokenResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(ReqTempTokenResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, oas3_gen_support::Default)]
pub struct ReqTempTokenRequestHeader {
/// OAuth 1.0a authorization request header for request to /request_token endpoint.
/// - Example: `Some("OAuth oauth_callback=\"oob\",oauth_consumer_key=\"TESTCONS\",oauth_nonce=\"b249...8f57\",oauth_signature=\"41Sx%252...ZYZ2\",oauth_signature_method=\"RSA-SHA256\",oauth_timestamp=\"1714489440\",realm=\"test_realm\"".to_string())`
pub authorization: Option<String>,
}
impl core::convert::TryFrom<&ReqTempTokenRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(headers: &ReqTempTokenRequestHeader) -> core::result::Result<Self, Self::Error> {
let mut map = http::HeaderMap::with_capacity(1usize);
if let Some(value) = &headers.authorization {
let header_value = http::HeaderValue::try_from(value)?;
map.insert(AUTHORIZATION, header_value);
}
Ok(map)
}
}
impl core::convert::TryFrom<ReqTempTokenRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(headers: ReqTempTokenRequestHeader) -> core::result::Result<Self, Self::Error> {
http::HeaderMap::try_from(&headers)
}
}
/// Response types for reqTempToken
#[derive(Debug, Clone)]
pub enum ReqTempTokenResponse {
///200: Success response with temporary OAuth access token
Ok(OauthTokenResponse),
///401: Invalid or expired access token
Unauthorized,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct RequestDetail {
#[serde(rename = "accountID")]
pub account_id: Option<String>,
#[serde(rename = "dateSubmitted")]
pub date_submitted: Option<String>,
#[serde(rename = "requestId")]
pub request_id: Option<i64>,
#[serde(rename = "requestType")]
pub request_type: Option<String>,
pub status: Option<String>,
}
#[serde_with::skip_serializing_none]
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
)]
pub struct RequestDetailsRequest {
#[serde(rename = "endDate")]
pub end_date: chrono::NaiveDate,
#[validate(range(min = 1i32, max = 1_000i32))]
pub limit: Option<i32>,
#[validate(range(min = 0i32))]
pub offset: Option<i32>,
#[serde(rename = "startDate")]
pub start_date: chrono::NaiveDate,
pub status: Option<RequestStatus>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct RequestDetailsResponse {
pub limit: Option<i32>,
pub offset: Option<i32>,
#[serde(rename = "requestDetails")]
pub request_details: Option<Vec<RequestDetail>>,
pub total: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
pub enum RequestStatus {
#[default]
N,
O,
P,
C,
A,
E,
F,
I,
J,
L,
M,
R,
W,
Q,
}
impl core::fmt::Display for RequestStatus {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::N => write!(f, "N"),
Self::O => write!(f, "O"),
Self::P => write!(f, "P"),
Self::C => write!(f, "C"),
Self::A => write!(f, "A"),
Self::E => write!(f, "E"),
Self::F => write!(f, "F"),
Self::I => write!(f, "I"),
Self::J => write!(f, "J"),
Self::L => write!(f, "L"),
Self::M => write!(f, "M"),
Self::R => write!(f, "R"),
Self::W => write!(f, "W"),
Self::Q => write!(f, "Q"),
}
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
pub struct RequiredFormsRequest {
#[serde(rename = "accountType")]
pub account_type: Option<String>,
#[serde(rename = "additionalAccount")]
pub additional_account: Option<bool>,
#[serde(rename = "additionalApplicant")]
pub additional_applicant: Option<bool>,
#[serde(rename = "applicantType")]
pub applicant_type: Option<String>,
pub capability: Option<Vec<String>>,
#[serde(rename = "faTradingAccount")]
pub fa_trading_account: Option<bool>,
pub ira: Option<bool>,
#[serde(rename = "iraType")]
pub ira_type: Option<String>,
#[serde(rename = "mifidCategory")]
pub mifid_category: Option<String>,
#[serde(rename = "processType")]
pub process_type: Option<String>,
#[serde(rename = "requestedFCBP")]
pub requested_fcbp: Option<bool>,
#[serde(rename = "requestedSYEP")]
pub requested_syep: Option<bool>,
#[serde(rename = "residenceCountry")]
pub residence_country: Option<String>,
#[serde(rename = "tradingPermissions")]
pub trading_permissions: Option<Vec<String>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct RequiredFormsResponse {
pub error: Option<Box<ErrorResponse>>,
#[serde(rename = "errorDescription")]
pub error_description: Option<String>,
pub forms: Option<Vec<String>>,
#[serde(rename = "hasError")]
pub has_error: Option<bool>,
}
/// Removes suppression of all order reply messages that were previously suppressed in the current brokerage session.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct ResetOrderSuppressionRequest {}
impl ResetOrderSuppressionRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<ResetOrderSuppressionResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<StatusResponse3>::json_with_diagnostics(req)
.await?;
return Ok(ResetOrderSuppressionResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(ResetOrderSuppressionResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(ResetOrderSuppressionResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(ResetOrderSuppressionResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(ResetOrderSuppressionResponse::Unknown);
}
}
/// Response types for resetOrderSuppression
#[derive(Debug, Clone)]
pub enum ResetOrderSuppressionResponse {
///200: Request's status
Ok(StatusResponse3),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ResponseData {
/// specify response media types that are acceptable
pub accept: Option<String>,
/// the data type of the value after decoding
#[serde(rename = "dataType")]
pub data_type: Option<String>,
/// encoding used for the value
pub encoding: Option<String>,
/// content encoding flag. Represents whether the response is compressed
pub gzip: Option<bool>,
/// mimeType of document after decoding and serializing the value
#[serde(rename = "mimeType")]
pub mime_type: Option<String>,
/// Base 64 encoded String of byte[]. Byte[] represents compressed data when gzip is true
pub value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ResponseFileResponse {
pub data: Option<serde_json::Value>,
pub error: Option<Box<ErrorResponse>>,
#[serde(rename = "errorDescription")]
pub error_description: Option<String>,
#[serde(rename = "hasError")]
pub has_error: Option<bool>,
#[serde(rename = "isProcessed")]
pub is_processed: Option<bool>,
pub name: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct RestrictionInfo {
#[serde(rename = "byIB")]
pub by_ib: Option<bool>,
pub id: Option<i32>,
pub name: Option<String>,
}
/// Signed JWT token
pub type RestrictionRequestBody = String;
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
)]
pub struct ResultError {
#[serde(rename = "errorCode")]
#[validate(length(min = 1u64))]
pub error_code: String,
#[serde(rename = "errorMessage")]
#[validate(length(min = 1u64))]
pub error_message: String,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct Rule200Response {
/// Allowed to sell shares you own.
pub allow_sell_long: Option<bool>,
/// Indicates the industry category of the instrument.
pub category: Option<String>,
/// Classification of Financial Instrument codes
pub cfi_code: Option<String>,
pub classifier: Option<String>,
/// Indicates the name of the company or index.
pub company_name: Option<String>,
/// Indicates the contract identifier of the given contract.
pub con_id: Option<i32>,
pub contract_clarification_type: Option<String>,
/// Indicates the year and month the contract expires.
pub contract_month: Option<String>,
/// Base currency contract is traded in.
pub currency: Option<String>,
/// Returns the CUSIP for the given instrument. Only used in BOND trading.
pub cusip: Option<String>,
/// Indicates the primary exchange for which the contract can be traded.
pub exchange: Option<String>,
/// Returns the expiration month of the contract.
pub expiry_full: Option<String>,
/// Specific group of companies or businesses.
pub industry: Option<String>,
/// Asset class of the instrument.
pub instrument_type: Option<String>,
/// Indicates if the contract supports zero commission trading.
pub is_zero_commission_security: Option<bool>,
/// Contract's symbol from primary exchange. For options it is the OCC symbol.
pub local_symbol: Option<String>,
/// Indicates the final maturity date of the given contract.
pub maturity_date: Option<String>,
/// Indicates the multiplier of the contract.
pub multiplier: Option<String>,
/// Indicates if the contract can be traded outside regular trading hours or not.
pub r_t_h: Option<bool>,
/// detailed contract information
pub rules: Option<ContractRules>,
/// Indicates if the contract can be smart routed or not.
pub smart_available: Option<bool>,
/// Underlying symbol
pub symbol: Option<String>,
/// Indicates the display name of the contract, as shown with Client Portal.
pub text: Option<String>,
/// Designated trading class of the contract.
pub trading_class: Option<String>,
/// Underlying contract identifier for the requested contract.
pub underlying_con_id: Option<i32>,
/// Indicates the issuer of the underlying.
pub underlying_issuer: Option<String>,
/// Comma separated list of support exchanges or trading venues.
pub valid_exchanges: Option<String>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
#[serde(default)]
pub struct RuleRequestBody {
/// Contract identifier for the interested contract.
pub conid: i32,
/// Side of the market rules apply too. Set to true for Buy Orders, set to false for Sell orders.
#[serde(rename = "isBuy")]
#[default(Some(true))]
pub is_buy: Option<bool>,
/// Used to find trading rules related to an existing order.
#[serde(rename = "modifyOrder")]
#[default(Some(false))]
pub modify_order: Option<bool>,
/// Specify the order identifier used for tracking a given order.
#[serde(rename = "orderId")]
pub order_id: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct Save200Response {
/// Report the behavior when attempting to save.
pub error: Option<String>,
/// Request identifier to uniquely track a request.
#[serde(rename = "reqID")]
pub req_id: Option<i32>,
/// Describes if the model is in polling mode.
#[serde(rename = "subscriptionStatus")]
pub subscription_status: Option<i32>,
/// Signifies that the request was successfully submitted.
pub success: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct Save200Response2 {
/// Request identifier to uniquely track a request.
/// - Example: `Some(540_607i32)`
#[serde(rename = "reqID")]
pub req_id: Option<i32>,
/// Signifies that the request was successfully submitted.
pub success: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct SaveRequestBody {
/// Array target cash objects
#[serde(rename = "cashTargets")]
pub cash_targets: Vec<SaveRequestBodyCashTarget>,
/// Personal description of model to read in IBKR GUI elements.
#[validate(length(min = 1u64))]
pub desc: String,
/// Determine if investing and rebalancing should be handled statically or dynamically.
/// * `true` - Static models will always use the original targets.
/// * `false` - Dynamic models will adjust allocation in response to market movements.
#[serde(rename = "isStatic")]
pub is_static: bool,
/// Name of your model.
/// - Example: `"Sample-Model".to_string()`
#[validate(length(min = 1u64))]
pub model: String,
/// List containing all contracts to hold in the model.
#[serde(rename = "positionTargets")]
pub position_targets: Vec<SaveRequestBodyPositionTarget>,
/// Request identifier to uniquely track a request.
/// - Example: `540_607i32`
#[serde(rename = "reqID")]
pub req_id: i32,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct SaveRequestBodyCashTarget {
/// Currency code to hold positions.
/// - Example: `Some("USD".to_string())`
pub ccy: Option<String>,
/// Percentage of model to distribute to the given currency.
/// - Example: `Some(0.0)`
pub target: Option<f64>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct SaveRequestBodyPositionTarget {
/// Contract identifier, conid, to designate which security to hold.
/// - Example: `Some(265_598i32)`
pub conid: Option<i32>,
/// Percentage of model to distribute to the given currency.
/// - Example: `Some(0.0)`
pub target: Option<f64>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ScheduleResponse {
/// Returns the time zone the exchange trades in.
pub exchange_time_zone: Option<String>,
/// Returns a series of date objects of the given contract.
pub schedules: Option<ScheduleResponseSchedules>,
}
/// Returns a series of date objects of the given contract.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ScheduleResponseSchedules {
/// object containing the of hours objects detailing extended and liquid trading.
pub date: Option<ScheduleResponseSchedulesDate>,
}
/// object containing the of hours objects detailing extended and liquid trading.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ScheduleResponseSchedulesDate {
pub extended_hours: Option<Vec<ScheduleResponseSchedulesDateExtendedHour>>,
pub liquid_hours: Option<Vec<ScheduleResponseSchedulesDateLiquidHour>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ScheduleResponseSchedulesDateExtendedHour {
/// Determines if DAY orders are canceled after 'closing' time.
pub cancel_daily_orders: Option<bool>,
/// Epoch timestamp of the exchange's close.
pub closing: Option<i32>,
/// Epoch timestamp of the exchange's open.
pub opening: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct ScheduleResponseSchedulesDateLiquidHour {
/// Epoch timestamp of the exchange's close.
pub closing: Option<i32>,
/// Epoch timestamp of the exchange's open.
pub opening: Option<i32>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
#[serde(default)]
pub struct SearchRequestBody {
/// fund search
pub fund: Option<bool>,
#[serde(rename = "fundFamilyConidEx")]
pub fund_family_conid_ex: Option<String>,
pub more: Option<bool>,
/// Denotes if the symbol value is the ticker symbol or part of the company's name.
pub name: Option<bool>,
/// pattern search
pub pattern: Option<bool>,
pub referrer: Option<String>,
/// Available underlying security types:
/// * `STK` - Represents an underlying as a Stock security type.
/// * `IND` - Represents an underlying as an Index security type.
/// * `BOND` - Represents an underlying as a Bond security type.
#[serde(rename = "secType")]
#[default(Some(Default::default()))]
pub sec_type: Option<GetContractSymbolsRequestQuerySecType>,
/// The ticker symbol, bond issuer type, or company name of the equity you are looking to trade.
/// - Example: `"AAPL".to_string()`
#[validate(length(min = 1u64))]
pub symbol: String,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SecDefInfoResponse {
/// Name of the company for the given contract.
#[serde(rename = "companyName")]
pub company_name: Option<String>,
/// Contract Identifier of the given contract.
pub conid: Option<i32>,
/// Traded currency allowed for the given contract.
pub currency: Option<String>,
/// Exchange requesting data for.
pub exchange: Option<String>,
/// Primary listing exchange for the given contract.
#[serde(rename = "listingExchange")]
pub listing_exchange: Option<String>,
/// Date of expiration for the given contract.
#[serde(rename = "maturityDate")]
pub maturity_date: Option<String>,
#[serde(rename = "priceRendering")]
pub price_rendering: Option<String>,
/// Set the right for the given contract. * `C` - for Call options. * `P` - for Put options.
pub right: Option<IndividualPositionPutOrCall>,
/// Security type for the given contract.
#[serde(rename = "secType")]
pub sec_type: Option<String>,
/// Returns the given strike value for the given contract.
pub strike: Option<f64>,
/// Ticker symbol for the given contract
pub ticker: Option<String>,
/// Series of all valid exchanges the contract can be traded on in a single comma-separated string.
#[serde(rename = "validExchanges")]
pub valid_exchanges: Option<String>,
}
pub type SecdefSearchResponse = Vec<SecdefSearchResponseSecdefSearchResponse>;
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SecdefSearchResponseSecdefSearchResponse {
/// applicable for bonds
pub bondid: Option<i32>,
/// Company Name - Exchange
#[serde(rename = "companyHeader")]
pub company_header: Option<String>,
/// Formal name of the company.
#[serde(rename = "companyName")]
pub company_name: Option<String>,
/// Contract identifier for the unique contract.
pub conid: Option<String>,
/// Primary exchange of the contract
pub description: Option<String>,
/// Returns a string of dates, separated by semicolons.
pub fop: Option<String>,
pub issuers: Option<Vec<SecdefSearchResponseSecdefSearchResponseIssuer>>,
/// Returns a string of dates, separated by semicolons.
pub opt: Option<String>,
/// Returns if the contract is available for trading.
pub restricted: Option<bool>,
pub sections: Option<Vec<SecdefSearchResponseSecdefSearchResponseSection>>,
/// Underlying ticker symbol.
pub symbol: Option<String>,
/// Returns a string of dates, separated by semicolons.
pub war: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SecdefSearchResponseSecdefSearchResponseIssuer {
pub id: Option<String>,
pub name: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SecdefSearchResponseSecdefSearchResponseSection {
/// semicolon separated list of exchanges
pub exchange: Option<String>,
/// semicolon separated list of months
pub months: Option<String>,
#[serde(rename = "secType")]
pub sec_type: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SetAccountResponse {
/// Confirms the account switched to.
#[serde(rename = "acctId")]
pub acct_id: Option<String>,
/// Confirms that the account change was set
pub set: Option<bool>,
}
/// Assign an account and the amount of cash to allocate into a model.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct SetAccountinvestmentInModelRequest {
pub body: InvestDivestRequestBody,
}
impl SetAccountinvestmentInModelRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<SetAccountinvestmentInModelResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<InvestDivest200Response>::json_with_diagnostics(
req,
)
.await?;
return Ok(SetAccountinvestmentInModelResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(SetAccountinvestmentInModelResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(SetAccountinvestmentInModelResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(SetAccountinvestmentInModelResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(SetAccountinvestmentInModelResponse::Unknown);
}
}
/// Response types for setAccountinvestmentInModel
#[derive(Debug, Clone)]
pub enum SetAccountinvestmentInModelResponse {
///200: Successfully submitted model investment.
Ok(InvestDivest200Response),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Switch the active account for how you request data. Only available for financial advisors and multi-account structures.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct SetActiveAccountRequest {
pub body: AcctIdRequestBody,
}
impl SetActiveAccountRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<SetActiveAccountResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<SetAccountResponse>::json_with_diagnostics(req)
.await?;
return Ok(SetActiveAccountResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(SetActiveAccountResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(SetActiveAccountResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(SetActiveAccountResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(SetActiveAccountResponse::Unknown);
}
}
/// Response types for setActiveAccount
#[derive(Debug, Clone)]
pub enum SetActiveAccountResponse {
///200: Validates the account swapped to.
Ok(SetAccountResponse),
///401: Invalid or expired access token
Unauthorized,
/**500: Internal Server Error. Unable to process request if incoming values are not valid. For example accountId is not correct
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Set the preset behavior for new allocation groups for specific events.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct SetAllocationPresetRequest {
pub body: Presets,
}
impl SetAllocationPresetRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<SetAllocationPresetResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<SuccessResponse2>::json_with_diagnostics(req)
.await?;
return Ok(SetAllocationPresetResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(SetAllocationPresetResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(SetAllocationPresetResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(SetAllocationPresetResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(SetAllocationPresetResponse::Unknown);
}
}
/// Response types for setAllocationPreset
#[derive(Debug, Clone)]
pub enum SetAllocationPresetResponse {
///200: Successfully retrieve preset details
Ok(SuccessResponse2),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Set the active dynamic account.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct SetDynamicAccountRequest {
#[validate(nested)]
pub body: AcctIdRequestBody2,
}
impl SetDynamicAccountRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<SetActiveAccountResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<SetAccountResponse>::json_with_diagnostics(req)
.await?;
return Ok(SetActiveAccountResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(SetActiveAccountResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(SetActiveAccountResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(SetActiveAccountResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(SetActiveAccountResponse::Unknown);
}
}
/// Set the preset behavior for models.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct SetModelPresetsRequest {
pub body: ModelPresetsResponse,
}
impl SetModelPresetsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<SetModelPresetsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<Save200Response>::json_with_diagnostics(req)
.await?;
return Ok(SetModelPresetsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(SetModelPresetsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(SetModelPresetsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(SetModelPresetsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(SetModelPresetsResponse::Unknown);
}
}
/// Response types for setModelPresets
#[derive(Debug, Clone)]
pub enum SetModelPresetsResponse {
///200: Successfully retrieve preset details
Ok(Save200Response),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Create or Modify a model's target positions.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct SetModelTargetPositionsRequest {
#[validate(nested)]
pub body: SaveRequestBody,
}
impl SetModelTargetPositionsRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<SetModelTargetPositionsResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Save200Response2>::json_with_diagnostics(req)
.await?;
return Ok(SetModelTargetPositionsResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(SetModelTargetPositionsResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(SetModelTargetPositionsResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(SetModelTargetPositionsResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(SetModelTargetPositionsResponse::Unknown);
}
}
/// Response types for setModelTargetPositions
#[derive(Debug, Clone)]
pub enum SetModelTargetPositionsResponse {
///200: Successfully saved a model
Ok(Save200Response2),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Side of the order ticket.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
pub enum Side {
#[serde(rename = "BUY")]
#[default]
Buy,
#[serde(rename = "SELL")]
Sell,
}
impl core::fmt::Display for Side {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Buy => write!(f, "BUY"),
Self::Sell => write!(f, "SELL"),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SignatureAndOwners {
/// Account identifier
#[serde(rename = "accountId")]
pub account_id: Option<String>,
pub applicant: Option<SignatureAndOwnersApplicant>,
pub users: Option<Vec<User>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SignatureAndOwnersApplicant {
/// All names attached to the account
pub signatures: Option<Vec<String>>,
}
/// Object containing Bid and Ask data for a single OHLC bar.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SingleHistoricalBarBidAsk {
/// Closing value of the bar. Indicates the time average ask during the bar.
pub c: Option<f64>,
/// High value of the bar. Indicates the highest ask price during the bar.
pub h: Option<f64>,
/// Low value of the bar. Indicates the lowest bid price during the bar.
pub l: Option<f64>,
/// Opening value of the bar. Indicates the time average bid during the bar.
pub o: Option<f64>,
/// Unix timestamp of the start (chronologically earlier) of the bar.
pub t: Option<i32>,
/// Volume value of the bar. Always returns 0.
pub v: Option<f64>,
}
/// Object containing Last or Trades data for a single OHLC bar.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SingleHistoricalBarLast {
/// Closing value of the bar. Indicates the final traded price of the bar.
pub c: Option<f64>,
/// High value of the bar. Indicates the highest traded price of the bar.
pub h: Option<f64>,
/// Low value of the bar. Indicates the lowest traded price of the bar.
pub l: Option<f64>,
/// Opening value of the bar. Indicates first traded price of the bar.
pub o: Option<f64>,
/// Unix timestamp of the start (chronologically earlier) of the bar.
pub t: Option<i32>,
/// Volume value of the bar, returned only for "Last" barType.
pub v: Option<f64>,
}
/// Object containing Midpoint data for a single OHLC bar.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SingleHistoricalBarMidpoint {
/// Closing value of the bar. Indicates the last midpoint price traded price during the bar.
pub c: Option<f64>,
/// High value of the bar. Indicates the highest midpoint price traded price during the bar.
pub h: Option<f64>,
/// Low value of the bar. Indicates the lowest midpoint price traded price during the bar.
pub l: Option<f64>,
/// Opening value of the bar. Indicates the starting midpoint price traded price during the bar.
pub o: Option<f64>,
/// Unix timestamp of the start (chronologically earlier) of the bar.
pub t: Option<i32>,
/// Volume value of the bar. Always returns 0.
pub v: Option<f64>,
}
/// A single order ticket.
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct SingleOrderSubmissionRequest {
/// Receiving account of the order ticket.
#[serde(rename = "acctId")]
pub acct_id: Option<String>,
/// Instructs IB to execute the order entirely or not execute at all.
#[serde(rename = "allOrNone")]
pub all_or_none: Option<bool>,
/// Additional price value used in certain order types, such as stop orders.
#[serde(rename = "auxPrice")]
pub aux_price: Option<f64>,
/// Client-configurable order identifier.
#[serde(rename = "cOID")]
pub c_oid: Option<String>,
/// Quantity of currency used with cash quantity orders.
#[serde(rename = "cashQty")]
pub cash_qty: Option<f64>,
/// IB contract ID of the instrument.
pub conid: i32,
/// Contract ID and routing destination together in format 123456@EXCHANGE.
pub conidex: Option<String>,
/// ExtOperator is used to identify external operator
#[serde(rename = "extOperator")]
pub ext_operator: Option<String>,
/// Indicates that a forex order is for currency conversion and should not entail a virtual forex position in the account, where applicable.
#[serde(rename = "isCcyConv")]
pub is_ccy_conv: Option<bool>,
/// Indicates that all orders in the containing array are to be treated as an OCA group.
#[serde(rename = "isSingleGroup")]
pub is_single_group: Option<bool>,
#[serde(rename = "jsonPayload")]
pub json_payload: Option<SingleOrderSubmissionRequestJsonPayload>,
/// The listing exchange of the instrument.
#[serde(rename = "listingExchange")]
pub listing_exchange: Option<String>,
/// For all orders for US Futures products, clients must submit this flag to indicate whether the order was originated manually (by a natural person) or automatically (by an automated trading system transmitting orders without human intervention). Submit a True value to indicate a manually originated order, and submit a False value to indicate an automated order. Orders for USFUT products that do not include this field will be rejected.
#[serde(rename = "manualIndicator")]
pub manual_indicator: Option<bool>,
/// IB order type identifier.
#[serde(rename = "orderType")]
#[validate(length(min = 1u64))]
pub order_type: String,
/// Instructs IB to permit the order to execute outside of regular trading hours.
#[serde(rename = "outsideRTH")]
pub outside_rth: Option<bool>,
/// If the order ticket is a child order in a bracket, the parentId field must be set equal to the cOID provided for the parent order.
#[serde(rename = "parentId")]
pub parent_id: Option<String>,
/// Price of the order ticket, where applicable.
pub price: Option<f64>,
/// Quantity of the order ticket in units of the instrument.
pub quantity: f64,
/// IB internal identifier for order entry UI element.
pub referrer: Option<String>,
/// IB asset class identifier.
#[serde(rename = "secType")]
pub sec_type: Option<String>,
/// Side of the order ticket.
pub side: Side,
/// The name of an execution algorithm.
pub strategy: Option<String>,
/// Parameters governing the selected algorithm, if applicable.
#[serde(rename = "strategyParameters")]
pub strategy_parameters: Option<SingleOrderSubmissionRequestStrategyParameters>,
/// Identifies set of tax lots selected, for gains and losses management.
#[serde(rename = "taxOptimizerId")]
pub tax_optimizer_id: Option<String>,
/// Ticker symbol of the instrument.
pub ticker: Option<String>,
/// Time in force of the order ticket.
pub tif: OrderStatusTif,
/// Offset used with Trailing orders.
#[serde(rename = "trailingAmt")]
pub trailing_amt: Option<f64>,
/// Specifies the type of trailing used with a Trailing order.
#[serde(rename = "trailingType")]
pub trailing_type: Option<SingleOrderSubmissionRequestTrailingType>,
/// Instructs IB to apply the Price Management Algo.
#[serde(rename = "useAdaptive")]
pub use_adaptive: Option<bool>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct SingleOrderSubmissionRequestJsonPayload {
/// The assigned contents for how the order should be allocated amongst subaccount(s).
pub allocation_profile: Option<SingleOrderSubmissionRequestJsonPayloadAllocationProfile>,
}
/// The assigned contents for how the order should be allocated amongst subaccount(s).
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct SingleOrderSubmissionRequestJsonPayloadAllocationProfile {
/// The allocation type to define how shares should be distributed. A warning message to be pre-approved.
/// * `SHARE` - Designate the allocation amounts as a quantity of shares.
/// * `CASH` - Designate the allocation amounts as a quantity of a cash quantity to allocate.
pub alloc_type: Option<SingleOrderSubmissionRequestJsonPayloadAllocationProfileAllocType>,
/// List of accounts to allocate a trade and the affiliated quantity.
pub allocations:
Option<Vec<SingleOrderSubmissionRequestJsonPayloadAllocationProfileAllocation>>,
}
/// The allocation type to define how shares should be distributed. A warning message to be pre-approved.
/// * `SHARE` - Designate the allocation amounts as a quantity of shares.
/// * `CASH` - Designate the allocation amounts as a quantity of a cash quantity to allocate.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum SingleOrderSubmissionRequestJsonPayloadAllocationProfileAllocType {
#[serde(rename = "SHARE")]
#[default]
Share,
#[serde(rename = "CASH")]
Cash,
}
impl core::fmt::Display for SingleOrderSubmissionRequestJsonPayloadAllocationProfileAllocType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Share => write!(f, "SHARE"),
Self::Cash => write!(f, "CASH"),
}
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct SingleOrderSubmissionRequestJsonPayloadAllocationProfileAllocation {
/// Account to allocate trades to.
pub account: Option<String>,
/// Allocation to the given account based on the alloc_type.
pub amount: Option<f64>,
}
/// Parameters governing the selected algorithm, if applicable.
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct SingleOrderSubmissionRequestStrategyParameters {
/// Placeholder -- these vary by algo (and not always type string, sometimes bool)
#[serde(rename = "PLACEHOLDER")]
pub placeholder: Option<String>,
}
/// Specifies the type of trailing used with a Trailing order.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum SingleOrderSubmissionRequestTrailingType {
#[serde(rename = "amt")]
#[default]
Amt,
#[serde(rename = "%")]
Unnamed,
}
impl core::fmt::Display for SingleOrderSubmissionRequestTrailingType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Amt => write!(f, "amt"),
Self::Unnamed => write!(f, "%"),
}
}
}
/// Object detailing a single watchlist.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SingleWatchlist {
/// Internal use. Unique hash of the watchlist.
pub hash: Option<String>,
/// Identifier of the watchlist.
pub id: Option<String>,
/// Array of instruments contained in the watchlist.
pub instruments: Option<Vec<SingleWatchlistEntry>>,
/// Human-readable display name of the watchlist.
pub name: Option<String>,
/// Indicates whether the watchlist can be edited.
#[serde(rename = "readOnly")]
pub read_only: Option<bool>,
}
/// Object containing watchlist entry for a single instrument.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SingleWatchlistEntry {
/// Instrument conid as a string.
#[serde(rename = "C")]
pub c: Option<String>,
/// All-capital, shorthand security type identifier of the instrument.
#[serde(rename = "ST")]
pub st: Option<SingleWatchlistEntryAssetClass>,
/// All-capital, shorthand security type identifier of the instrument.
#[serde(rename = "assetClass")]
pub asset_class: Option<SingleWatchlistEntryAssetClass>,
/// Rendering of the instrument name in Chinese.
#[serde(rename = "chineseName")]
pub chinese_name: Option<String>,
/// IB contract ID of the instrument.
pub conid: Option<i32>,
/// Full display presentation of the instrument symbol.
#[serde(rename = "fullName")]
pub full_name: Option<String>,
/// Complete display name of the instrument.
pub name: Option<String>,
/// Symbol of the instrument.
pub ticker: Option<String>,
}
/// All-capital, shorthand security type identifier of the instrument.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
pub enum SingleWatchlistEntryAssetClass {
#[serde(rename = "STK")]
#[default]
Stk,
#[serde(rename = "OPT")]
Opt,
#[serde(rename = "FUT")]
Fut,
#[serde(rename = "BOND")]
Bond,
#[serde(rename = "FUND")]
Fund,
#[serde(rename = "WAR")]
War,
#[serde(rename = "CASH")]
Cash,
#[serde(rename = "CRYPTO")]
Crypto,
}
impl core::fmt::Display for SingleWatchlistEntryAssetClass {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Stk => write!(f, "STK"),
Self::Opt => write!(f, "OPT"),
Self::Fut => write!(f, "FUT"),
Self::Bond => write!(f, "BOND"),
Self::Fund => write!(f, "FUND"),
Self::War => write!(f, "WAR"),
Self::Cash => write!(f, "CASH"),
Self::Crypto => write!(f, "CRYPTO"),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SsoValidateResponse {
/// Returns the time of authentication in epoch time.
#[serde(rename = "AUTH_TIME")]
pub auth_time: Option<i32>,
/// Returns the underlying username of the account.
#[serde(rename = "CREDENTIAL")]
pub credential: Option<String>,
/// Returns the time until SSO session expiration in milliseconds.
#[serde(rename = "EXPIRES")]
pub expires: Option<i32>,
/// Internal use only. Does not reflect the IP address of the user.
#[serde(rename = "IP")]
pub ip: Option<String>,
/// Returns if the account is a trial account or a funded account.
#[serde(rename = "IS_FREE_TRIAL")]
pub is_free_trial: Option<bool>,
/// Returns whether the account is a master account (true) or subaccount (false).
#[serde(rename = "IS_MASTER")]
pub is_master: Option<bool>,
/// Used for Client Portal (Internal use only)
#[serde(rename = "LANDING_APP")]
pub landing_app: Option<String>,
/// Returns the paper username for the account.
#[serde(rename = "PAPER_USER_NAME")]
pub paper_user_name: Option<String>,
/// Returns if the customer requires two factor authentication.
#[serde(rename = "QUALIFIED_FOR_MOBILE_AUTH")]
pub qualified_for_mobile_auth: Option<bool>,
/// Confirms if validation was successful. True if session was validated; false if not.
#[serde(rename = "RESULT")]
pub result: Option<bool>,
/// (Internal use only)
#[serde(rename = "SF_ENABLED")]
pub sf_enabled: Option<bool>,
/// Internal user identifier.
#[serde(rename = "USER_ID")]
pub user_id: Option<i32>,
/// current username logged in for the session.
#[serde(rename = "USER_NAME")]
pub user_name: Option<String>,
/// Returns supported features such as bonds and option trading.
pub features: Option<SsoValidateResponseFeatures>,
/// Returns the last time the user was accessed in epoch time.
#[serde(rename = "lastAccessed")]
pub last_accessed: Option<i32>,
/// Returns the login type. 1 for Live, 2 for Paper
#[serde(rename = "loginType")]
pub login_type: Option<i32>,
/// Returns the region connected to internally.
pub region: Option<String>,
}
/// Returns supported features such as bonds and option trading.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SsoValidateResponseFeatures {
/// Returns if bonds can be traded.
pub bond: Option<bool>,
/// Returns if trading calendars are enabled
pub calendar: Option<bool>,
/// Returns the connecting environment to distinguish production or paper.
pub envs: Option<String>,
/// Internal Use Only
#[serde(rename = "newMf")]
pub new_mf: Option<bool>,
/// Returns if option chains can be retrieved in the account.
#[serde(rename = "optionChains")]
pub option_chains: Option<bool>,
/// Returns if realtime market data is available
pub realtime: Option<bool>,
/// Internal Use Only
pub wlms: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct StatusResponse {
#[serde(rename = "dateSubmitted")]
pub date_submitted: Option<chrono::DateTime<chrono::Utc>>,
#[serde(rename = "fileData")]
pub file_data: Option<FileData>,
#[serde(rename = "requestId")]
pub request_id: Option<i64>,
}
/// Confirms successful reply to the server prompt.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct StatusResponse2 {
/// Confirms the successful suppression of specified messageIds. Always returns "Submitted".
pub status: Option<String>,
}
/// Confirms successful removal of suppression.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct StatusResponse3 {
/// Confirms the successful removal of suppression. Always returns "Submitted".
pub status: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct StatusResponse4 {
/// Confirms that the logout action was performed successfully.
pub status: Option<bool>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
#[serde(default)]
pub struct StmtRequest {
/// account id
#[serde(rename = "accountId")]
#[validate(length(min = 1u64))]
pub account_id: String,
/// array of account id's
/// - Example: `Some(vec!["U123", "U456"].to_string())`
#[serde(rename = "accountIds")]
pub account_ids: Option<Vec<String>>,
/// crypto consolidate flag, If request contains any accounts with crypto segment, will turn request into Crypto Consolidated
#[serde(rename = "cryptoConsolIfAvailable")]
#[default(Some(false))]
pub crypto_consol_if_available: Option<bool>,
/// to date
#[serde(rename = "endDate")]
#[validate(length(min = 1u64))]
pub end_date: String,
/// to gzip the whole response pass true
#[default(Some(false))]
pub gzip: Option<bool>,
/// two character ISO language code
/// - Example: `Some("en, fr defaults to en (english)".to_string())`
#[default(Some("en".to_string()))]
pub language: Option<String>,
/// output format
/// - Example: `Some("application/pdf, text/html, or text/csv".to_string())`
#[serde(rename = "mimeType")]
pub mime_type: Option<String>,
/// possible values are consolidate, concatenate, or customConsolidate
#[serde(rename = "multiAccountFormat")]
pub multi_account_format: Option<String>,
/// from date
#[serde(rename = "startDate")]
#[validate(length(min = 1u64))]
pub start_date: String,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct Stocks {
/// Additional properties not defined in the schema.
#[serde(flatten)]
pub additional_properties: std::collections::HashMap<String, Vec<serde_json::Value>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct Strike200Response {
/// Array containing a series of comma separated values representing potential call strikes for the instrument.
pub call: Option<Vec<f64>>,
/// Array containing a series of comma separated values representing potential put strikes for the instrument.
pub put: Option<Vec<f64>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SubAccounts {
/// An array containing all sub-accounts held by the advisor.
pub accounts: Option<Vec<SubAccountsAccount>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SubAccountsAccount {
/// Contains Net liquidation and available equity of the given account Id.
pub data: Option<Vec<SubAccountsAccountDatum>>,
/// Returns the account ID affiliated with the balance data.
pub name: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SubAccountsAccountDatum {
/// Defines the value of the object
/// * `AvailableEquity` - Indicates the value relates to the Available Equity held within the account
/// * `NetLiquidation` - Indicates the value relates to the Net Liquidation held within the account
pub key: Option<SubAccountsAccountDatumKey>,
/// Contains the price value affiliated with the key.
pub value: Option<String>,
}
/// Defines the value of the object
/// * `AvailableEquity` - Indicates the value relates to the Available Equity held within the account
/// * `NetLiquidation` - Indicates the value relates to the Net Liquidation held within the account
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
pub enum SubAccountsAccountDatumKey {
#[default]
AvailableEquity,
NetLiquidation,
}
impl core::fmt::Display for SubAccountsAccountDatumKey {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::AvailableEquity => write!(f, "AvailableEquity"),
Self::NetLiquidation => write!(f, "NetLiquidation"),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum SubType {
#[serde(rename = "ACATS")]
#[default]
Acats,
#[serde(rename = "ATON")]
Aton,
}
impl core::fmt::Display for SubType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Acats => write!(f, "ACATS"),
Self::Aton => write!(f, "ATON"),
}
}
}
pub type Subaccount200Response = Vec<AccountAttributes>;
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct Subaccounts2Response {
/// Metadata container describing the subaccounts.
pub metadata: Option<Subaccounts2ResponseMetadata>,
/// List containing all subaccounts of the account structure.
pub subaccounts: Option<Vec<AccountAttributes>>,
}
/// Metadata container describing the subaccounts.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct Subaccounts2ResponseMetadata {
/// The active page number.
#[serde(rename = "pageNum")]
pub page_num: Option<i32>,
/// Items contained in the returning page.
#[serde(rename = "pageSize")]
pub page_size: Option<i32>,
/// The total number of accounts returned for the page.
pub total: Option<i32>,
}
/// Submit all pending orders to the models. This is similar to the Model page's Submit All Orders selection.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct SubmitModelOrdersRequest {
pub body: TransferRequestBody,
}
impl SubmitModelOrdersRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<SubmitModelOrdersResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Transfer200Response>::json_with_diagnostics(req)
.await?;
return Ok(SubmitModelOrdersResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(SubmitModelOrdersResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(SubmitModelOrdersResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(SubmitModelOrdersResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(SubmitModelOrdersResponse::Unknown);
}
}
/// Response types for submitModelOrders
#[derive(Debug, Clone)]
pub enum SubmitModelOrdersResponse {
///200: Successfully transmit all orders.
Ok(Transfer200Response),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
/// Submit a new order(s) ticket, bracket, or OCA group.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct SubmitNewOrderRequest {
#[validate(nested)]
pub path: SubmitNewOrderRequestPath,
#[validate(nested)]
pub body: OrdersSubmissionRequest,
}
impl SubmitNewOrderRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<SubmitNewOrderResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<Order200Response3>::json_with_diagnostics(req)
.await?;
return Ok(SubmitNewOrderResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(SubmitNewOrderResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(SubmitNewOrderResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(SubmitNewOrderResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(SubmitNewOrderResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct SubmitNewOrderRequestPath {
/// The account to which the order will clear.
/// - Example: `"DU123456".to_string()`
#[validate(length(min = 1u64))]
pub account_id: String,
}
/// Response types for submitNewOrder
#[derive(Debug, Clone)]
pub enum SubmitNewOrderResponse {
///200: Order submission response (success, error, reply is required or order reject)
Ok(Order200Response3),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SuccessResponse {
pub success: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SuccessResponse2 {
/// Signifies that the request was successfully submitted.
pub success: Option<bool>,
}
/// Acknowledges a successful request.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SuccessResponse3 {
/// The sole key 'success' will have boolean value true.
pub success: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SuccessfulTickleResponse {
/// (Internal Use Only)
pub collission: Option<bool>,
/// Returns connection details for the historical market data server.
pub hmds: Option<SuccessfulTickleResponseHmds>,
pub iserver: Option<SuccessfulTickleResponseIserver>,
/// Returns the session token of the contract.
pub session: Option<String>,
/// Returns the number of milliseconds until the current sso session expires.
#[serde(rename = "ssoExpires")]
pub sso_expires: Option<i32>,
/// (Internal Use Only)
#[serde(rename = "userId")]
pub user_id: Option<i32>,
}
/// Returns connection details for the historical market data server.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SuccessfulTickleResponseHmds {
/// Returns authentication details.
#[serde(rename = "authStatus")]
pub auth_status: Option<Vec<serde_json::Value>>,
/// Relays any internal connection errors.
pub error: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SuccessfulTickleResponseIserver {
#[serde(rename = "authStatus")]
pub auth_status: Option<BrokerageSessionStatus>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SummaryMarketValueResponse {
/// Returns an object containing market value details of the currency and positions held using that currency.
pub currency: Option<SummaryMarketValueResponseCurrency>,
}
/// Returns an object containing market value details of the currency and positions held using that currency.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SummaryMarketValueResponseCurrency {
/// Total cash value of Cryptocurrencies held.
#[serde(rename = "Cryptocurrency")]
pub cryptocurrency: Option<String>,
/// Exchange rate of the labeled currency to the base currency.
#[serde(rename = "Exchange Rate")]
pub exchange_rate: Option<String>,
/// Total cash value of goverment bonds held.
#[serde(rename = "Govt Bonds")]
pub govt_bonds: Option<String>,
/// Total Month-to-date interest.
#[serde(rename = "MTD Interest")]
pub mtd_interest: Option<String>,
/// Total cash value of notional CFDs held.
#[serde(rename = "Notional CFD")]
pub notional_cfd: Option<String>,
/// Total cash value of bonds held.
pub bonds: Option<String>,
/// Total cash value of CFDs held.
pub cfd: Option<String>,
/// Total cash value of commodities held.
pub commodity: Option<String>,
/// Total cash value of receivable dividends.
pub dividends_receivable: Option<String>,
/// Total cash value of funds held.
pub funds: Option<String>,
/// Total cash value of future options held.
pub future_options: Option<String>,
/// Total cash value of futures held.
pub futures: Option<String>,
/// Total cash value of issuer options held.
pub issuer_option: Option<String>,
/// Total cash value of money market securities held.
pub money_market: Option<String>,
/// Total cash value of mutual funds held.
pub mutual_funds: Option<String>,
/// Total cash value of your net liquidty.
pub net_liquidation: Option<String>,
/// Total cash value of options held.
pub options: Option<String>,
/// Total daily realized profit and loss.
pub realized_pnl: Option<String>,
/// Cash recognized at the time of settlement minus the purchases at time of trade, commissions, taxes, and fees.
pub settled_cash: Option<String>,
/// Total cash value of stocks held.
pub stock: Option<String>,
/// Total cash value of t-bill bonds held.
pub t_bills: Option<String>,
/// Lists the total cash held for the given currency.
pub total_cash: Option<String>,
/// Total daily unrealized profit and loss.
pub unrealized_pnl: Option<String>,
/// Total cash value of warrants held.
pub warrants: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SummaryOfAccountBalancesResponse {
/// Contains Commodity-specific balance details.
pub commodities: Option<SummaryOfAccountBalancesResponseCommodities>,
/// Contains Security-specific balance details.
pub securities: Option<SummaryOfAccountBalancesResponseSecurities>,
/// Contains total balance details for the account.
pub total: Option<SummaryOfAccountBalancesResponseTotal>,
}
/// Contains Commodity-specific balance details.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SummaryOfAccountBalancesResponseCommodities {
/// Total Month-to-date interest.
#[serde(rename = "MTD Interest")]
pub mtd_interest: Option<String>,
/// Any pending charges for the IBKR debit account.
#[serde(rename = "Pndng Dbt Crd Chrgs")]
pub pndng_dbt_crd_chrgs: Option<String>,
/// Total cash balance in the account
pub cash: Option<String>,
/// * `Cash Accounts` Settled cash
/// * `Margin Accounts` Total cash value + stock value + bond value + fund value + European & Asian options value.
pub equity_with_loan: Option<String>,
/// The basis for determining the price of the assets in your account.
pub net_liquidation: Option<String>,
}
/// Contains Security-specific balance details.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SummaryOfAccountBalancesResponseSecurities {
/// Total Month-to-date interest.
#[serde(rename = "MTD Interest")]
pub mtd_interest: Option<String>,
/// Any pending charges for the IBKR debit account.
#[serde(rename = "Pndng Dbt Crd Chrgs")]
pub pndng_dbt_crd_chrgs: Option<String>,
/// The accounts equity balance including loan value.
#[serde(rename = "Prvs Dy Eqty Wth Ln Vl")]
pub prvs_dy_eqty_wth_ln_vl: Option<String>,
/// Total cash balance in the account
pub cash: Option<String>,
/// * `Cash Accounts` Settled cash
/// * `Margin Accounts` Total cash value + stock value + bond value + fund value + European & Asian options value.
pub equity_with_loan: Option<String>,
/// The basis for determining the price of the assets in your account.
pub net_liquidation: Option<String>,
/// Equals the sum of the absolute value of all positions except cash, index futures and US treasuries.
pub sec_gross_pos_val: Option<String>,
}
/// Contains total balance details for the account.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SummaryOfAccountBalancesResponseTotal {
/// Total Month-to-date interest.
#[serde(rename = "MTD Interest")]
pub mtd_interest: Option<String>,
/// Displays the uncertainty of the Net Liquidating Value associated with after-hours price changes.
#[serde(rename = "Nt Lqdtn Uncrtnty")]
pub nt_lqdtn_uncrtnty: Option<String>,
/// Any pending charges for the IBKR debit account.
#[serde(rename = "Pndng Dbt Crd Chrgs")]
pub pndng_dbt_crd_chrgs: Option<String>,
/// The accounts equity balance including loan value.
#[serde(rename = "Prvs Dy Eqty Wth Ln Vl")]
pub prvs_dy_eqty_wth_ln_vl: Option<String>,
/// Total cash balance in the account
pub cash: Option<String>,
/// * `Cash Accounts` Settled cash
/// * `Margin Accounts` Total cash value + stock value + bond value + fund value + European & Asian options value.
pub equity_with_loan: Option<String>,
/// The basis for determining the price of the assets in your account.
pub net_liquidation: Option<String>,
/// Equals the sum of the absolute value of all positions except cash, index futures and US treasuries.
pub sec_gross_pos_val: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SummaryOfAccountMarginResponse {
#[serde(rename = "Crypto at Paxos")]
pub crypto_at_paxos: Option<SummaryOfAccountMarginResponseCryptoAtPaxos>,
pub commodities: Option<SummaryOfAccountMarginResponseCommodities>,
pub securities: Option<SummaryOfAccountMarginResponseSecurities>,
pub total: Option<SummaryOfAccountMarginResponseCryptoAtPaxos>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SummaryOfAccountMarginResponseCommodities {
/// Provides a projected "at expiration" margin value based on the soon-to-expire contracts in your portfolio.
#[serde(rename = "Prdctd Pst-xpry Mrgn @ Opn")]
pub prdctd_pst_xpry_mrgn_opn: Option<String>,
/// If it is 3:00 pm ET, the next calculation you're looking ahead to is after the close, or the Overnight Initial Margin. If it's 3:00 am ET, the next calculation will be at the market's open.
/// * `Securities` – Projected maintenance margin requirement as of next period's margin change, in the base currency of the account.
/// * `Commodities` – Maintenance margin requirement as of next period's margin change in the base currency of the account based on current margin requirements, which are subject to change. This value depends on when you are viewing your margin requirements.
#[serde(rename = "Prjctd Lk Ahd Mntnnc Mrgn")]
pub prjctd_lk_ahd_mntnnc_mrgn: Option<String>,
/// Overnight refers to the window of time after the local market trading day is closed.
/// * `Securities` – Projected overnight maintenance margin requirement in the base currency of the account.
/// * `Commodities` – Overnight maintenance margin requirement in the base currency of the account based on current margin requirements, which are subject to change.
#[serde(rename = "Prjctd Ovrnght Mntnnc Mrgn")]
pub prjctd_ovrnght_mntnnc_mrgn: Option<String>,
/// The current RegT margin in use.
#[serde(rename = "RegT Margin")]
pub reg_t_margin: Option<String>,
/// The minimum amount required to open a new position.
pub current_initial: Option<String>,
/// The amount of equity required to maintain your positions.
pub current_maint: Option<String>,
/// Provides a projected "liquid" initial margin value based on account liquidation value.
pub projected_liquidity_inital_margin: Option<String>,
/// Overnight refers to the window of time after the local market trading day is closed.
/// * Securities – Projected overnight initial margin requirement in the base currency of the account.
/// * Commodities – Overnight initial margin requirement in the base currency of the account based on current margin requirements, which are subject to change.
pub projected_overnight_initial_margin: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SummaryOfAccountMarginResponseCryptoAtPaxos {
/// Provides a projected "at expiration" margin value based on the soon-to-expire contracts in your portfolio.
#[serde(rename = "Prdctd Pst-xpry Mrgn @ Opn")]
pub prdctd_pst_xpry_mrgn_opn: Option<String>,
/// If it is 3:00 pm ET, the next calculation you're looking ahead to is after the close, or the Overnight Initial Margin. If it's 3:00 am ET, the next calculation will be at the market's open.
/// * `Securities` – Projected maintenance margin requirement as of next period's margin change, in the base currency of the account.
/// * `Commodities` – Maintenance margin requirement as of next period's margin change in the base currency of the account based on current margin requirements, which are subject to change. This value depends on when you are viewing your margin requirements.
#[serde(rename = "Prjctd Lk Ahd Mntnnc Mrgn")]
pub prjctd_lk_ahd_mntnnc_mrgn: Option<String>,
/// Overnight refers to the window of time after the local market trading day is closed.
/// * `Securities` – Projected overnight maintenance margin requirement in the base currency of the account.
/// * `Commodities` – Overnight maintenance margin requirement in the base currency of the account based on current margin requirements, which are subject to change.
#[serde(rename = "Prjctd Ovrnght Mntnnc Mrgn")]
pub prjctd_ovrnght_mntnnc_mrgn: Option<String>,
/// The minimum amount required to open a new position.
pub current_initial: Option<String>,
/// The amount of equity required to maintain your positions.
pub current_maint: Option<String>,
/// Provides a projected "liquid" initial margin value based on account liquidation value.
pub projected_liquidity_inital_margin: Option<String>,
/// Overnight refers to the window of time after the local market trading day is closed.
/// * Securities – Projected overnight initial margin requirement in the base currency of the account.
/// * Commodities – Overnight initial margin requirement in the base currency of the account based on current margin requirements, which are subject to change.
pub projected_overnight_initial_margin: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SummaryOfAccountMarginResponseSecurities {
/// Provides a projected "at expiration" margin value based on the soon-to-expire contracts in your portfolio.
#[serde(rename = "Prdctd Pst-xpry Mrgn @ Opn")]
pub prdctd_pst_xpry_mrgn_opn: Option<String>,
/// If it is 3:00 pm ET, the next calculation you're looking ahead to is after the close, or the Overnight Initial Margin. If it's 3:00 am ET, the next calculation will be at the market's open.
/// * `Securities` – Projected maintenance margin requirement as of next period's margin change, in the base currency of the account.
/// * `Commodities` – Maintenance margin requirement as of next period's margin change in the base currency of the account based on current margin requirements, which are subject to change. This value depends on when you are viewing your margin requirements.
#[serde(rename = "Prjctd Lk Ahd Mntnnc Mrgn")]
pub prjctd_lk_ahd_mntnnc_mrgn: Option<String>,
/// Overnight refers to the window of time after the local market trading day is closed.
/// * `Securities` – Projected overnight maintenance margin requirement in the base currency of the account.
/// * `Commodities` – Overnight maintenance margin requirement in the base currency of the account based on current margin requirements, which are subject to change.
#[serde(rename = "Prjctd Ovrnght Mntnnc Mrgn")]
pub prjctd_ovrnght_mntnnc_mrgn: Option<String>,
/// The minimum amount required to open a new position.
pub current_initial: Option<String>,
/// The amount of equity required to maintain your positions.
pub current_maint: Option<String>,
/// Provides a projected "liquid" initial margin value based on account liquidation value.
pub projected_liquidity_inital_margin: Option<String>,
/// Overnight refers to the window of time after the local market trading day is closed.
/// * Securities – Projected overnight initial margin requirement in the base currency of the account.
/// * Commodities – Overnight initial margin requirement in the base currency of the account based on current margin requirements, which are subject to change.
pub projected_overnight_initial_margin: Option<String>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct SummaryRequestBody {
/// Name of your model.
/// - Example: `Some("Sample-Model".to_string())`
pub model: Option<String>,
/// Request identifier to uniquely track a request.
/// - Example: `Some(540_609i32)`
#[serde(rename = "reqID")]
pub req_id: Option<i32>,
}
/// Suppress the specified order reply messages for the duration of the brokerage session.
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct SuppressOrderRepliesRequest {
pub body: MessageIdRequestBody,
}
impl SuppressOrderRepliesRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(
req: reqwest::Response,
) -> anyhow::Result<SuppressOrderRepliesResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data = oas3_gen_support::Diagnostics::<StatusResponse2>::json_with_diagnostics(req)
.await?;
return Ok(SuppressOrderRepliesResponse::Ok(data));
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(SuppressOrderRepliesResponse::Unauthorized);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(SuppressOrderRepliesResponse::InternalServerError);
}
if status == http::StatusCode::SERVICE_UNAVAILABLE {
let _ = req.bytes().await?;
return Ok(SuppressOrderRepliesResponse::ServiceUnavailable);
}
let _ = req.bytes().await?;
return Ok(SuppressOrderRepliesResponse::Unknown);
}
}
/// Response types for suppressOrderReplies
#[derive(Debug, Clone)]
pub enum SuppressOrderRepliesResponse {
///200: Request's status
Ok(StatusResponse2),
///401: Invalid or expired access token
Unauthorized,
/**500: internal server error, returned when incoming request cannot be processed. It can sometimes include subset of bad requests. For example, wrong accountId passed and it can only be detected later in handling request. Error contains reason of the problem.
*/
InternalServerError,
/**503: service is unavailable. For example if request takes more than 10s due to some internal service unavailability, request aborted and this status returned
*/
ServiceUnavailable,
///default: Unknown response
Unknown,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct SynchronousInstructionResponse {
#[serde(rename = "instructionResult")]
pub instruction_result: Option<InstructionResult>,
/// - Example: `-1988905739.0`
#[serde(rename = "instructionSetId")]
pub instruction_set_id: f64,
/// - Example: `202.0`
pub status: f64,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum Task200Response {
#[default]
Registration(RegistrationTasksResponse),
Pending(PendingTasksResponse),
}
impl Task200Response {
pub fn registration() -> Self {
Self::Registration(RegistrationTasksResponse::default())
}
pub fn pending() -> Self {
Self::Pending(PendingTasksResponse::default())
}
}
pub type Task200Response2 = Vec<TaskActionResponse>;
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct TaskActionResponse {
#[serde(rename = "accountId")]
pub account_id: Option<String>,
#[serde(rename = "formNumber")]
pub form_number: Option<i32>,
pub message: Option<String>,
pub status: Option<String>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
#[serde(default)]
pub struct TaxFormRequest {
/// Account id
/// - Example: `"UXXXX".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64))]
pub account_id: String,
/// format
/// - Example: `"HTML,CSV,PDF".to_string()`
#[validate(length(min = 1u64))]
pub format: String,
/// to gzip the whole response pass true
#[default(Some(false))]
pub gzip: Option<bool>,
/// Tax Form Type (can retrieve available tax documents via /api/v1/tax-documents/available)
/// - Example: `"ALL,1099,1099R,1042S,8949".to_string()`
#[serde(rename = "type")]
#[validate(length(min = 1u64))]
pub r#type: String,
/// Tax Year
/// - Example: `2_023i32`
pub year: i32,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct TaxFormResponse {
pub data: Option<ResponseData>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct TaxFormType {
/// available tax form formats
pub formats: Option<Vec<String>>,
#[serde(rename = "isForm")]
pub is_form: Option<bool>,
/// - Example: `Some("1099".to_string())`
#[serde(rename = "taxFormName")]
pub tax_form_name: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum TickleResponse {
#[default]
Successful(SuccessfulTickleResponse),
Failed(FailedTickleResponse),
}
impl TickleResponse {
pub fn successful() -> Self {
Self::Successful(SuccessfulTickleResponse::default())
}
pub fn failed(error: Option<String>) -> Self {
Self::Failed(FailedTickleResponse {
error,
..Default::default()
})
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct TokenRequest {
#[serde(rename = "clientAssertion")]
pub client_assertion: Option<String>,
#[serde(rename = "clientAssertionType")]
pub client_assertion_type: Option<String>,
#[serde(rename = "clientAuthenticationMethod")]
pub client_authentication_method: Option<TokenRequestClientAuthenticationMethod>,
#[serde(rename = "clientId")]
pub client_id: Option<String>,
#[serde(rename = "clientSecret")]
pub client_secret: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum TokenRequestClientAuthenticationMethod {
#[serde(rename = "private_key_jwt")]
#[default]
PrivateKeyJwt,
#[serde(rename = "client_secret_basic")]
ClientSecretBasic,
#[serde(rename = "client_secret_post")]
ClientSecretPost,
}
impl core::fmt::Display for TokenRequestClientAuthenticationMethod {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::PrivateKeyJwt => write!(f, "private_key_jwt"),
Self::ClientSecretBasic => write!(f, "client_secret_basic"),
Self::ClientSecretPost => write!(f, "client_secret_post"),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct TokenResponse {
/// The serialized access token
pub access_token: Option<String>,
/// The number of seconds from now until the access token expires
pub expires_in: Option<i64>,
/// The serialized ID token if applicable
pub id_token: Option<String>,
/// The serialized refresh token if applicable
pub refresh_token: Option<String>,
/// The space-delimited list of granted scopes
pub scope: Option<String>,
/// The token type (e.g., Bearer)
pub token_type: Option<String>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct TradeConfirmationRequest {
/// accound id
/// - Example: `"UXXXX".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64))]
pub account_id: String,
/// to date
/// - Example: `"20230115".to_string()`
#[serde(rename = "endDate")]
#[validate(length(min = 1u64))]
pub end_date: String,
/// output format
/// - Example: `Some("application/pdf".to_string())`
#[serde(rename = "mimeType")]
pub mime_type: Option<String>,
/// from date
/// - Example: `"20230102".to_string()`
#[serde(rename = "startDate")]
#[validate(length(min = 1u64))]
pub start_date: String,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct TradeConfirmationResponse {
pub data: Option<ResponseData>,
}
/// Array of objects representing executions.
pub type TradesResponse = Vec<TradesResponseTradesResponse>;
/// Object containing details of a single execution.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct TradesResponseTradesResponse {
/// The IB account ID of the account that received the execution.
pub account: Option<String>,
/// The IB account ID of the account that received the execution.
#[serde(rename = "accountCode")]
pub account_code: Option<String>,
/// The IB account ID of the account that received the execution.
pub account_allocation_name: Option<String>,
/// Identifier of the firm clearing the trade. Value is "IB" if account is cleared by Interactive Brokers.
pub clearing_id: Option<String>,
/// Name of the firm clearing the trade. Value is "IB" if account is cleared by Interactive Brokers.
pub clearing_name: Option<String>,
/// Commissions incurred by the execution. May also include
pub commission: Option<String>,
/// Name of business associated with instrument, or otherwise description of instrument.
pub company_name: Option<String>,
/// Contract ID of the order's instrument.
pub conid: Option<String>,
/// Contract ID and routing destination in format 123456@EXCHANGE.
#[serde(rename = "conidEx")]
pub conid_ex: Option<String>,
/// Human-readable description of the order's instrument.
pub contract_description_1: Option<String>,
/// The exchange or other venue on which the execution occurred.
pub exchange: Option<String>,
/// IB-assigned execution identifier.
pub execution_id: Option<String>,
/// Indicates whether the order ticket is an Event Trading order.
pub is_event_trading: Option<AlertActivationRequestAlertActive>,
/// Indicates whether the trade is the result of a liquidiation by IB.
pub liquidation_trade: Option<AlertActivationRequestAlertActive>,
/// The primary exchange on which the instrument is listed.
pub listing_exchange: Option<String>,
/// net_amount
pub net_amount: Option<f64>,
/// Human-readable description of the outcome of the execution.
pub order_description: Option<String>,
/// Order ID
pub order_id: Option<f64>,
/// The client-provided customer order identifier. Specified via cOID during order submission in the Web API.
pub order_ref: Option<String>,
/// The price at which the execution occurred.
pub price: Option<String>,
/// IB asset class identifier.
pub sec_type: Option<OrderStatusSecType>,
/// Side of the execution.
pub side: Option<TradesResponseTradesResponseSide>,
/// The size of the execution in units of the instrument.
pub size: Option<f64>,
/// The IB username that originated the order ticket against which the execution occurred.
pub submitter: Option<String>,
/// Indicates whether the order is supported by IB's Tax Optimization tool.
pub supports_tax_opt: Option<AlertActivationRequestAlertActive>,
/// Symbol of the instrument involved in the execution.
pub symbol: Option<String>,
/// UTC date and time of the execution in format YYYYMMDD-hh:mm:ss.
pub trade_time: Option<String>,
/// Unix timestamp of the execution time in milliseconds.
pub trade_time_r: Option<i64>,
}
/// Side of the execution.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
pub enum TradesResponseTradesResponseSide {
#[default]
B,
S,
}
impl core::fmt::Display for TradesResponseTradesResponseSide {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::B => write!(f, "B"),
Self::S => write!(f, "S"),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum TradingInstrument {
#[default]
Variant0(TradingInstrumentVariant0),
TradingInstrumentDescription(TradingInstrumentTradingInstrumentDescription),
}
impl TradingInstrument {
pub fn variant0(conid: f64) -> Self {
Self::Variant0(TradingInstrumentVariant0 {
conid,
..Default::default()
})
}
pub fn description(
trading_instrument_description: TradingInstrumentTradingInstrumentDescriptionDescription,
) -> Self {
Self::TradingInstrumentDescription(TradingInstrumentTradingInstrumentDescription {
trading_instrument_description,
..Default::default()
})
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct TradingInstrumentTradingInstrumentDescription {
#[serde(rename = "tradingInstrumentDescription")]
#[validate(nested)]
pub trading_instrument_description: TradingInstrumentTradingInstrumentDescriptionDescription,
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct TradingInstrumentTradingInstrumentDescriptionDescription {
/// - Example: `"STK"`
#[serde(rename = "assetType")]
pub asset_type: TradingInstrumentTradingInstrumentDescriptionDescriptionAssetType,
/// - Example: `"459200101".to_string()`
#[serde(rename = "securityId")]
#[validate(length(min = 1u64))]
pub security_id: String,
/// - Example: `"ISIN"`
#[serde(rename = "securityIdType")]
pub security_id_type: TradingInstrumentTradingInstrumentDescriptionDescriptionSecurityIdType,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum TradingInstrumentTradingInstrumentDescriptionDescriptionAssetType {
#[serde(rename = "STK")]
#[default]
Stk,
#[serde(rename = "CASH")]
Cash,
#[serde(rename = "UNKNOWN")]
Unknown,
#[serde(rename = "BILL")]
Bill,
#[serde(rename = "BOND")]
Bond,
#[serde(rename = "FUND")]
Fund,
#[serde(rename = "OPT")]
Opt,
#[serde(rename = "WAR")]
War,
}
impl core::fmt::Display for TradingInstrumentTradingInstrumentDescriptionDescriptionAssetType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Stk => write!(f, "STK"),
Self::Cash => write!(f, "CASH"),
Self::Unknown => write!(f, "UNKNOWN"),
Self::Bill => write!(f, "BILL"),
Self::Bond => write!(f, "BOND"),
Self::Fund => write!(f, "FUND"),
Self::Opt => write!(f, "OPT"),
Self::War => write!(f, "WAR"),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum TradingInstrumentTradingInstrumentDescriptionDescriptionSecurityIdType {
#[serde(rename = "CUSIP")]
#[default]
Cusip,
#[serde(rename = "ISIN")]
Isin,
#[serde(rename = "CASH")]
Cash,
}
impl core::fmt::Display for TradingInstrumentTradingInstrumentDescriptionDescriptionSecurityIdType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Cusip => write!(f, "CUSIP"),
Self::Isin => write!(f, "ISIN"),
Self::Cash => write!(f, "CASH"),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct TradingInstrumentVariant0 {
/// - Example: `459200101.0`
pub conid: f64,
}
/// trading's schedules
pub type TradingSchedule = Vec<TradingScheduleTradingSchedule>;
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct TradingScheduleTradingSchedule {
/// exchange description
pub description: Option<String>,
/// short exchange name
pub exchange: Option<String>,
/// Exchange parameter id
pub id: Option<String>,
/// Always contains at least one 'tradingTime' and zero or more 'sessionTime' tags
pub schedules: Option<Vec<TradingScheduleTradingScheduleSchedule>>,
/// References the time zone corresponding to the listed dates and times.
pub timezone: Option<String>,
/// Reference on a trade venue of given exchange parameter
#[serde(rename = "tradeVenueId")]
pub trade_venue_id: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct TradingScheduleTradingScheduleSchedule {
/// End time of clearing cycle.
#[serde(rename = "clearingCycleEndTime")]
pub clearing_cycle_end_time: Option<String>,
/// Lists the avialble trading sessions. This displays the regular trading hours. If the LIQUID hours differs from the total trading day then a separate 'session' tag is returned.
pub sessions: Option<Vec<TradingScheduleTradingScheduleScheduleSession>>,
/// Date of the clearing schedule. 20000101 stands for any Sat, 20000102 stands for any Sun, … 20000107 stands for any Fri. Any other date stands for itself.
#[serde(rename = "tradingScheduleDate")]
pub trading_schedule_date: Option<String>,
/// Object containing trading times.
#[serde(rename = "tradingTimes")]
pub trading_times: Option<Vec<TradingScheduleTradingScheduleScheduleTime>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct TradingScheduleTradingScheduleScheduleSession {
/// Closing date time of the sesion.
#[serde(rename = "closingTime")]
pub closing_time: Option<String>,
/// Opening date time of the session.
#[serde(rename = "openingTime")]
pub opening_time: Option<String>,
/// If the whole trading day is considered LIQUID then the value 'LIQUID' is returned.
/// - Example: `Some("LIQUID".to_string())`
pub prop: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct TradingScheduleTradingScheduleScheduleTime {
/// Cancel time for day orders.
/// - Example: `Some("Y".to_string())`
#[serde(rename = "cancelDayOrders")]
pub cancel_day_orders: Option<String>,
/// Closing time of the trading day.
#[serde(rename = "closingTime")]
pub closing_time: Option<String>,
/// Opening time of the trading day.
#[serde(rename = "openingTime")]
pub opening_time: Option<String>,
/// - Example: `Some("LIQUID".to_string())`
pub prop: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct TraditionalBankInstructionVerification {
/// - Example: `"U453454".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64, max = 32u64))]
pub account_id: String,
/// - Example: `"ACHUS"`
#[serde(rename = "bankInstructionCode")]
pub bank_instruction_code: TraditionalBankInstructionVerificationBankInstructionCode,
/// - Example: `"TestInstr".to_string()`
#[serde(rename = "bankInstructionName")]
#[validate(length(min = 1u64, max = 100u64))]
pub bank_instruction_name: String,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `1.0`
#[serde(rename = "creditAmount1")]
pub credit_amount1: f64,
/// - Example: `2.0`
#[serde(rename = "creditAmount2")]
pub credit_amount2: f64,
/// - Example: `35354345.0`
#[serde(rename = "pendingInstructionId")]
pub pending_instruction_id: f64,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum TraditionalBankInstructionVerificationBankInstructionCode {
#[serde(rename = "USACH")]
#[default]
Usach,
#[serde(rename = "CAACH")]
Caach,
#[serde(rename = "ACHUS")]
Achus,
#[serde(rename = "WIRE")]
Wire,
}
impl core::fmt::Display for TraditionalBankInstructionVerificationBankInstructionCode {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Usach => write!(f, "USACH"),
Self::Caach => write!(f, "CAACH"),
Self::Achus => write!(f, "ACHUS"),
Self::Wire => write!(f, "WIRE"),
}
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
#[serde(default)]
pub struct TransactionRequestBody {
#[serde(rename = "acctIds")]
pub acct_ids: Option<Vec<String>>,
pub conids: Option<Vec<i32>>,
/// Define the currency to display price amounts with.
#[default(Some("USD".to_string()))]
pub currency: Option<String>,
/// Specify the number of days to receive transaction data for.
#[default(Some(90i32))]
pub days: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct TransactionsResponse {
/// Returns the currency the account is traded in.
pub currency: Option<String>,
/// Returns the epoch time for the start of requests.
pub from: Option<i32>,
/// Returns the request identifier, getTransactions.
pub id: Option<String>,
/// Returns if the trades are up to date or not.
#[serde(rename = "includesRealTime")]
pub includes_real_time: Option<bool>,
/// Client portal use only
pub nd: Option<i32>,
/// Client portal use only
pub rc: Option<i32>,
/// Returns the object containing the realized pnl for the contract on the date.
pub rpnl: Option<TransactionsResponseRpnl>,
/// Returns the epoch time for the end of requests.
pub to: Option<i32>,
/// Lists all supported transaction values.
pub transactions: Option<Vec<TransactionsResponseTransaction>>,
}
/// Returns the object containing the realized pnl for the contract on the date.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct TransactionsResponseRpnl {
/// Provides the total amount gained or lost from all days returned
pub amt: Option<String>,
/// Returns an array of realized pnl objects.
pub data: Option<Vec<serde_json::Value>>,
pub items: Option<TransactionsResponseRpnlItems>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct TransactionsResponseRpnlItems {
/// Returns the account ID the trade transacted on.
pub acctid: Option<String>,
/// Returns the amount gained or lost on the day.
pub amt: Option<String>,
/// Returns the contract ID of the transaction.
pub conid: Option<String>,
/// Specifies the currency of the realized value.
pub cur: Option<String>,
/// Specifies the date for the transaction.
pub date: Option<String>,
/// Returns the foreign exchnage rate.
#[serde(rename = "fxRate")]
pub fx_rate: Option<i32>,
/// Determines if the day was a loss or gain * `L` - LOSS * `G` - GAIN
pub side: Option<TransactionsResponseRpnlItemsSide>,
}
/// Determines if the day was a loss or gain * `L` - LOSS * `G` - GAIN
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
pub enum TransactionsResponseRpnlItemsSide {
#[default]
L,
G,
}
impl core::fmt::Display for TransactionsResponseRpnlItemsSide {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::L => write!(f, "L"),
Self::G => write!(f, "G"),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct TransactionsResponseTransaction {
/// Returns the account which made the transaction.
pub acctid: Option<String>,
/// Returns the total value of the trade.
pub amt: Option<f64>,
/// Returns the contract identifier.
pub conid: Option<i32>,
/// Returns the currency of the traded insturment.
pub cur: Option<String>,
/// Reutrns the human-readable datetime of the transaction.
pub date: Option<String>,
/// Returns the long name for the company.
pub desc: Option<String>,
/// Returns the forex conversion rate.
#[serde(rename = "fxRate")]
pub fx_rate: Option<i32>,
/// Returns the price per share of the transaction.
pub pr: Option<f64>,
/// Returns the total quantity traded. Will display a negative value for sell orders, and a positive value for buy orders.
pub qty: Option<i32>,
/// Returns the order side.
#[serde(rename = "type")]
pub r#type: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct Transfer200Response {
/// Request identifier to uniquely track a request.
/// - Example: `Some(540_608i32)`
#[serde(rename = "reqID")]
pub req_id: Option<i32>,
/// Signifies that the request was successfully submitted.
pub success: Option<bool>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct TransferRequestBody {
/// Order identifier to monitor the order transmissions. Will be set to a valid id if and only if any transfers are present in the response. Otherwise, -1 is returned.
#[serde(rename = "fpOrderId")]
pub fp_order_id: Option<i32>,
/// Request identifier to uniquely track a request.
#[serde(rename = "reqID")]
pub req_id: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct TransferRequestBody2 {
pub instruction: TransferRequestBody2Instruction,
#[serde(rename = "instructionType")]
pub instruction_type: TransferRequestBody2InstructionType,
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum TransferRequestBody2Instruction {
#[default]
FopInstruction(FopInstruction),
DwacInstruction(DwacInstruction),
ComplexAssetTransferInstruction(ComplexAssetTransferInstruction),
ExternalPositionTransfer(ExternalPositionTransfer),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum TransferRequestBody2InstructionType {
#[serde(rename = "DWAC")]
#[default]
Dwac,
#[serde(rename = "FOP")]
Fop,
#[serde(rename = "COMPLEX_ASSET_TRANSFER")]
ComplexAssetTransfer,
#[serde(rename = "EXTERNAL_POSITION_TRANSFER")]
ExternalPositionTransfer,
}
impl core::fmt::Display for TransferRequestBody2InstructionType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Dwac => write!(f, "DWAC"),
Self::Fop => write!(f, "FOP"),
Self::ComplexAssetTransfer => write!(f, "COMPLEX_ASSET_TRANSFER"),
Self::ExternalPositionTransfer => write!(f, "EXTERNAL_POSITION_TRANSFER"),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct TransferRequestBody3 {
pub instruction: TransferRequestBody3Instruction,
#[serde(rename = "instructionType")]
pub instruction_type: TransferRequestBody3InstructionType,
}
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
#[serde(untagged)]
pub enum TransferRequestBody3Instruction {
#[default]
Deposit(DepositFundsInstruction),
Withdraw(WithdrawFundsInstruction),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum TransferRequestBody3InstructionType {
#[serde(rename = "DEPOSIT")]
#[default]
Deposit,
#[serde(rename = "WITHDRAWAL")]
Withdrawal,
}
impl core::fmt::Display for TransferRequestBody3InstructionType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Deposit => write!(f, "DEPOSIT"),
Self::Withdrawal => write!(f, "WITHDRAWAL"),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
#[serde(default)]
pub struct TransferRequestBody4 {
#[validate(nested)]
pub instruction: InternalPositionTransferInstruction,
#[serde(rename = "instructionType")]
#[default("INTERNAL_POSITION_TRANSFER".to_string())]
pub instruction_type: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
#[serde(default)]
pub struct TransferRequestBody5 {
#[validate(nested)]
pub instruction: InternalCashTransferInstruction,
#[serde(rename = "instructionType")]
#[default("INTERNAL_CASH_TRANSFER".to_string())]
pub instruction_type: String,
}
/// a contract's security definition
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct TrsrvSecDefResponse {
pub secdef: Option<Vec<TrsrvSecDefResponseSecdef>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct TrsrvSecDefResponseSecdef {
/// A series of exchanges the given symbol can trade on.
#[serde(rename = "allExchanges")]
pub all_exchanges: Option<String>,
/// The asset class or security type of the contract.
#[serde(rename = "assetClass")]
pub asset_class: Option<String>,
/// The Chinese characters for the symbol.
#[serde(rename = "chineseName")]
pub chinese_name: Option<String>,
/// The conID
pub conid: Option<i32>,
/// The country code the contract is traded on.
#[serde(rename = "countryCode")]
pub country_code: Option<String>,
/// The traded currency for the contract.
pub currency: Option<String>,
/// Returns rules regarding incrementation for order placement. Not functional for all exchanges. Please see /iserver/contract/rules for more accurate rule details.
#[serde(rename = "displayRule")]
pub display_rule: Option<Vec<TrsrvSecDefResponseSecdefDisplayRule>>,
/// The expiry of the contract. Returns null for non-expiry instruments.
pub expiry: Option<String>,
/// Returns symbol name for requested contract.
#[serde(rename = "fullName")]
pub full_name: Option<String>,
/// The group or industry the contract is affilated with.
pub group: Option<String>,
/// contract has tradable options contracts.
#[serde(rename = "hasOptions")]
pub has_options: Option<bool>,
/// Indicates increment rule values including lowerEdge and increment value.
#[serde(rename = "incrementRules")]
pub increment_rules: Option<Vec<TrsrvSecDefResponseSecdefIncrementRule>>,
/// The contract is an event contract or not.
#[serde(rename = "isEventContract")]
pub is_event_contract: Option<bool>,
/// The contract is US based or not.
#[serde(rename = "isUS")]
pub is_us: Option<bool>,
/// The last trading day of the contract.
#[serde(rename = "lastTradingDay")]
pub last_trading_day: Option<String>,
/// The primary or listing exchange the contract is hosted on.
#[serde(rename = "listingExchange")]
pub listing_exchange: Option<String>,
/// The contract multiplier.
pub multiplier: Option<f64>,
/// The company name.
pub name: Option<String>,
/// Returns the content size of the request.
#[serde(rename = "pageSize")]
pub page_size: Option<i32>,
/// a Put or Call option.
#[serde(rename = "putOrCall")]
pub put_or_call: Option<String>,
/// The contract's sector.
pub sector: Option<String>,
/// The sector's group.
#[serde(rename = "sectorGroup")]
pub sector_group: Option<String>,
/// The strike of the contract.
pub strike: Option<String>,
/// The ticker symbol of the traded contract.
pub ticker: Option<String>,
/// Amount of time in ms to generate the data.
pub time: Option<i32>,
/// Stock type.
#[serde(rename = "type")]
pub r#type: Option<String>,
/// The contract's underlyer.
#[serde(rename = "undConid")]
pub und_conid: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct TrsrvSecDefResponseSecdefDisplayRule {
#[serde(rename = "displayRuleStep")]
pub display_rule_step: Option<Vec<TrsrvSecDefResponseSecdefDisplayRuleDisplayRuleStep>>,
/// If the displayed contract information is multiplied based on a given magnitude, the value will be reflected here.
pub magnification: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct TrsrvSecDefResponseSecdefDisplayRuleDisplayRuleStep {
/// Displays the total number of digits used after the decimal value.
#[serde(rename = "decimalDigits")]
pub decimal_digits: Option<i32>,
/// The lowerEdge display value to correspond to increment rules.
#[serde(rename = "lowerEdge")]
pub lower_edge: Option<f64>,
/// Displays valid display prices for before and after the decimal value.
#[serde(rename = "wholeDigits")]
pub whole_digits: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct TrsrvSecDefResponseSecdefIncrementRule {
/// The price of the instrument must be submitted as a mulitple of the increment value.
/// - Example: `Some(0.0)`
pub increment: Option<f64>,
/// If the current mark price of the instrument is at or above the lower edge, the given increment value is used for order prices.
/// - Example: `Some(0.0)`
#[serde(rename = "lowerEdge")]
pub lower_edge: Option<f64>,
}
/// Many FYI endpoints reference a "typecode" value. The table below lists the available codes and what they correspond to.
/// * `BA` - Borrow Availability
/// * `CA` - Comparable Algo
/// * `DA` - Dividends Advisory
/// * `EA` - Upcoming Earnings
/// * `MF` - Mutual Fund Advisory
/// * `OE` - Option Expiration
/// * `PR` - Portfolio Builder Rebalance
/// * `SE` - Suspend Order on Economic Event
/// * `SG` - Short Term Gain turning Long Term
/// * `SM` - System Messages
/// * `T2` - Assignment Realizing Long-Term Gains
/// * `TO` - Takeover
/// * `UA` - User Alert
/// * `M8` - M871 Trades
/// * `PS` - Platform Use Suggestions
/// * `DL` - Unexercised Option Loss Prevention Reminder
/// * `PT` - Position Transfer
/// * `CB` - Missing Cost Basis
/// * `MS` - Milestones
/// * `TD` - MiFID || 10% Deprecation Notice
/// * `ST` - Save Taxes
/// * `TI` - Trade Idea
/// * `CT` - Cash Transfer
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum Typecodes {
#[serde(rename = "BA")]
#[default]
Ba,
#[serde(rename = "CA")]
Ca,
#[serde(rename = "DA")]
Da,
#[serde(rename = "EA")]
Ea,
#[serde(rename = "MF")]
Mf,
#[serde(rename = "OE")]
Oe,
#[serde(rename = "PR")]
Pr,
#[serde(rename = "SE")]
Se,
#[serde(rename = "SG")]
Sg,
#[serde(rename = "SM")]
Sm,
T2,
#[serde(rename = "TO")]
To,
#[serde(rename = "UA")]
Ua,
M8,
#[serde(rename = "PS")]
Ps,
#[serde(rename = "DL")]
Dl,
#[serde(rename = "PT")]
Pt,
#[serde(rename = "CB")]
Cb,
#[serde(rename = "MS")]
Ms,
#[serde(rename = "TD")]
Td,
#[serde(rename = "ST")]
St,
#[serde(rename = "TI")]
Ti,
#[serde(rename = "CT")]
Ct,
}
impl core::fmt::Display for Typecodes {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Ba => write!(f, "BA"),
Self::Ca => write!(f, "CA"),
Self::Da => write!(f, "DA"),
Self::Ea => write!(f, "EA"),
Self::Mf => write!(f, "MF"),
Self::Oe => write!(f, "OE"),
Self::Pr => write!(f, "PR"),
Self::Se => write!(f, "SE"),
Self::Sg => write!(f, "SG"),
Self::Sm => write!(f, "SM"),
Self::T2 => write!(f, "T2"),
Self::To => write!(f, "TO"),
Self::Ua => write!(f, "UA"),
Self::M8 => write!(f, "M8"),
Self::Ps => write!(f, "PS"),
Self::Dl => write!(f, "DL"),
Self::Pt => write!(f, "PT"),
Self::Cb => write!(f, "CB"),
Self::Ms => write!(f, "MS"),
Self::Td => write!(f, "TD"),
Self::St => write!(f, "ST"),
Self::Ti => write!(f, "TI"),
Self::Ct => write!(f, "CT"),
}
}
}
/// Indicates a successful request to unsubscribe all streams.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct UnsubscribedResponse {
/// The sole key 'unsubscribed' will have boolean value true.
pub unsubscribed: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct User {
/// Provide information about the particular entity
pub entity: Option<UserEntity>,
/// Internally used
#[serde(rename = "hasRightCodeInd")]
pub has_right_code_ind: Option<bool>,
/// The role of the username as it relates to the account
#[serde(rename = "roleId")]
pub role_id: Option<String>,
/// Identifies the username for the designated entity.
#[serde(rename = "userName")]
pub user_name: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct UserAccountsResponse {
/// Returns an array of all accessible accountIds.
pub accounts: Option<Vec<String>>,
/// Returns an json object for each accessible account's properties.
#[serde(rename = "acctProps")]
pub acct_props: Option<UserAccountsResponseAcctProps>,
pub aliases: Option<UserAccountsResponseAliases>,
#[serde(rename = "allowFeatures")]
pub allow_features: Option<UserAccountsResponseAllowFeatures>,
#[serde(rename = "chartPeriods")]
pub chart_periods: Option<UserAccountsResponseChartPeriods>,
pub groups: Option<Vec<String>>,
#[serde(rename = "isFt")]
pub is_ft: Option<bool>,
#[serde(rename = "isPaper")]
pub is_paper: Option<bool>,
pub profiles: Option<Vec<String>>,
#[serde(rename = "selectedAccount")]
pub selected_account: Option<String>,
#[serde(rename = "serverInfo")]
pub server_info: Option<UserAccountsResponseServerInfo>,
#[serde(rename = "sessionId")]
pub session_id: Option<String>,
}
/// Returns an json object for each accessible account's properties.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct UserAccountsResponseAcctProps {
#[serde(rename = "U1234567")]
pub u1234567: Option<UserAccountsResponseAcctPropsU1234567>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct UserAccountsResponseAcctPropsU1234567 {
#[serde(rename = "allowCustomerTime")]
pub allow_customer_time: Option<bool>,
#[serde(rename = "autoFx")]
pub auto_fx: Option<bool>,
#[serde(rename = "hasChildAccounts")]
pub has_child_accounts: Option<bool>,
#[serde(rename = "isProp")]
pub is_prop: Option<bool>,
#[serde(rename = "liteUnderPro")]
pub lite_under_pro: Option<bool>,
#[serde(rename = "noFXConv")]
pub no_fxconv: Option<bool>,
#[serde(rename = "supportsCashQty")]
pub supports_cash_qty: Option<bool>,
#[serde(rename = "supportsFractions")]
pub supports_fractions: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct UserAccountsResponseAliases {
#[serde(rename = "U1234567")]
pub u1234567: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct UserAccountsResponseAllowFeatures {
#[serde(rename = "allowCrypto")]
pub allow_crypto: Option<bool>,
#[serde(rename = "allowDynAccount")]
pub allow_dyn_account: Option<bool>,
#[serde(rename = "allowEventContract")]
pub allow_event_contract: Option<bool>,
#[serde(rename = "allowEventTrading")]
pub allow_event_trading: Option<bool>,
#[serde(rename = "allowFXConv")]
pub allow_fxconv: Option<bool>,
#[serde(rename = "allowFinancialLens")]
pub allow_financial_lens: Option<bool>,
#[serde(rename = "allowMTA")]
pub allow_mta: Option<bool>,
#[serde(rename = "allowTypeAhead")]
pub allow_type_ahead: Option<bool>,
#[serde(rename = "allowedAssetTypes")]
pub allowed_asset_types: Option<String>,
#[serde(rename = "debugPnl")]
pub debug_pnl: Option<bool>,
#[serde(rename = "liteUser")]
pub lite_user: Option<bool>,
pub research: Option<bool>,
#[serde(rename = "restrictTradeSubscription")]
pub restrict_trade_subscription: Option<bool>,
#[serde(rename = "showEUCostReport")]
pub show_eucost_report: Option<bool>,
#[serde(rename = "showGFIS")]
pub show_gfis: Option<bool>,
#[serde(rename = "showImpactDashboard")]
pub show_impact_dashboard: Option<bool>,
#[serde(rename = "showTaxOpt")]
pub show_tax_opt: Option<bool>,
#[serde(rename = "showUkUserLabels")]
pub show_uk_user_labels: Option<bool>,
#[serde(rename = "showWebNews")]
pub show_web_news: Option<bool>,
#[serde(rename = "sideBySide")]
pub side_by_side: Option<bool>,
/// - Example: `Some(30i64)`
#[serde(rename = "snapshotRefreshTimeout")]
pub snapshot_refresh_timeout: Option<i64>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct UserAccountsResponseChartPeriods {
#[serde(rename = "BOND")]
pub bond: Option<Vec<String>>,
#[serde(rename = "CASH")]
pub cash: Option<Vec<String>>,
#[serde(rename = "CFD")]
pub cfd: Option<Vec<String>>,
#[serde(rename = "CMDTY")]
pub cmdty: Option<Vec<String>>,
#[serde(rename = "CRYPTO")]
pub crypto: Option<Vec<String>>,
#[serde(rename = "FOP")]
pub fop: Option<Vec<String>>,
#[serde(rename = "FUND")]
pub fund: Option<Vec<String>>,
#[serde(rename = "FUT")]
pub fut: Option<Vec<String>>,
#[serde(rename = "IND")]
pub ind: Option<Vec<String>>,
#[serde(rename = "IOPT")]
pub iopt: Option<Vec<String>>,
#[serde(rename = "OPT")]
pub opt: Option<Vec<String>>,
#[serde(rename = "PHYSS")]
pub physs: Option<Vec<String>>,
#[serde(rename = "STK")]
pub stk: Option<Vec<String>>,
#[serde(rename = "WAR")]
pub war: Option<Vec<String>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct UserAccountsResponseServerInfo {
#[serde(rename = "serverName")]
pub server_name: Option<String>,
#[serde(rename = "serverVersion")]
pub server_version: Option<String>,
}
/// Provide information about the particular entity
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct UserEntity {
/// The full entity's name, concatenating the first and last name fields
#[serde(rename = "entityName")]
pub entity_name: Option<String>,
/// The type of entity assigned to the user
#[serde(rename = "entityType")]
pub entity_type: Option<UserEntityEntityType>,
/// The first name of the user
#[serde(rename = "firstName")]
pub first_name: Option<String>,
/// The last name of the user
#[serde(rename = "lastName")]
pub last_name: Option<String>,
}
/// The type of entity assigned to the user
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
pub enum UserEntityEntityType {
#[serde(rename = "INDIVIDUAL")]
#[default]
Individual,
Joint,
#[serde(rename = "ORG")]
Org,
}
impl core::fmt::Display for UserEntityEntityType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Individual => write!(f, "INDIVIDUAL"),
Self::Joint => write!(f, "Joint"),
Self::Org => write!(f, "ORG"),
}
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct UserNameAvailableResponse {
pub error: Option<Box<ErrorResponse>>,
#[serde(rename = "errorDescription")]
pub error_description: Option<String>,
#[serde(rename = "hasError")]
pub has_error: Option<bool>,
#[serde(rename = "isAvailable")]
pub is_available: Option<bool>,
#[serde(rename = "isValid")]
pub is_valid: Option<bool>,
#[serde(rename = "suggestedUserName")]
pub suggested_user_name: Option<Vec<String>>,
}
/// UTC datetime string in format YYYYMMDD-hh:mm:ss.
pub type UtcDateTime = String;
/// Validates CSV structure, restriction names, and rule parameters without applying changes. Must be called before /csv/v2/apply with the same requestId.<br><br>**Scope**: `restrictions.write`<br>**Security Policy**: `Signed JWT`
#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
pub struct VerifyCsvRequest {
#[validate(nested)]
pub header: VerifyCsvRequestHeader,
/// JSON with userName, requestId, and Base64-encoded CSV payload
#[validate(nested)]
pub body: VerifyRequest,
}
impl VerifyCsvRequest {
/// Parse the HTTP response into the response enum.
pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<ApplyCsvResponse> {
let status = req.status();
if status == http::StatusCode::OK {
let data =
oas3_gen_support::Diagnostics::<CSVResponse>::json_with_diagnostics(req).await?;
return Ok(ApplyCsvResponse::Ok(data));
}
if status == http::StatusCode::BAD_REQUEST {
let _ = req.bytes().await?;
return Ok(ApplyCsvResponse::BadRequest);
}
if status == http::StatusCode::UNAUTHORIZED {
let _ = req.bytes().await?;
return Ok(ApplyCsvResponse::Unauthorized);
}
if status == http::StatusCode::FORBIDDEN {
let _ = req.bytes().await?;
return Ok(ApplyCsvResponse::Forbidden);
}
if status == http::StatusCode::INTERNAL_SERVER_ERROR {
let _ = req.bytes().await?;
return Ok(ApplyCsvResponse::InternalServerError);
}
let _ = req.bytes().await?;
return Ok(ApplyCsvResponse::Unknown);
}
}
#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
pub struct VerifyCsvRequestHeader {
/// OAuth 2.0 Bearer token. Format: Bearer {access_token}. Token contains accountId claim. Validity: ~50 minutes.
/// - Example: `"Bearer eyJ0eXAiOiJhdCtKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjFkOTEx...".to_string()`
#[validate(length(min = 1u64))]
pub authorization: String,
}
impl core::convert::TryFrom<&VerifyCsvRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(headers: &VerifyCsvRequestHeader) -> core::result::Result<Self, Self::Error> {
let mut map = http::HeaderMap::with_capacity(1usize);
let header_value = http::HeaderValue::try_from(&headers.authorization)?;
map.insert(AUTHORIZATION, header_value);
Ok(map)
}
}
impl core::convert::TryFrom<VerifyCsvRequestHeader> for http::HeaderMap {
type Error = http::header::InvalidHeaderValue;
fn try_from(headers: VerifyCsvRequestHeader) -> core::result::Result<Self, Self::Error> {
http::HeaderMap::try_from(&headers)
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct VerifyRequest {
/// Base64-encoded CSV content. Supported operations: RESTR_ADD, RESTR_DELETE, RESTR_ASSOC_ADD, RESTR_ASSOC_DELETE. Account ID extracted from OAuth token - do NOT include masterAcctId.
pub payload: Vec<u8>,
/// Unique request identifier
/// - Example: `127i32`
#[serde(rename = "requestId")]
#[validate(range(min = 1i32))]
pub request_id: i32,
/// IBKR username
/// - Example: `"hatty597".to_string()`
#[serde(rename = "userName")]
#[validate(length(min = 1u64, max = 64u64))]
pub user_name: String,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct Watchlist200Response {
/// IB's internal hash of the submitted watchlist.
pub hash: Option<String>,
/// The submitted watchlist ID.
pub id: Option<String>,
/// Array will always be empty. Contents can be queried via `GET /iserver/watchlist?id=`
pub instruments: Option<Vec<serde_json::Value>>,
/// The submitted human-readable watchlist name.
pub name: Option<String>,
/// Indicates whether watchlist is write-restricted. User-created watchlists will always show false.
#[serde(rename = "readOnly")]
pub read_only: Option<bool>,
}
/// Object detailing the successful deletion of a watchlist.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(default)]
pub struct WatchlistDeleteSuccess {
/// Internal use. Number of times endpoint has been visited during session.
#[serde(rename = "MID")]
pub mid: Option<String>,
/// Internal use. Always has value 'context'.
#[default(Some("context".to_string()))]
pub action: Option<String>,
pub data: Option<WatchlistDeleteSuccessData>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct WatchlistDeleteSuccessData {
/// Watchlist ID of the deleted watchlist.
pub deleted: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct WatchlistRequestBody {
/// Must be a number, digits 0-9 only. Must be unique relative to other watchlist IDs.
#[validate(length(min = 1u64))]
pub id: String,
/// Arbitrary human-readable name to be displayed in TWS and Client Portal.
#[validate(length(min = 1u64))]
pub name: String,
/// Array of JSON objects corresponding to watchlist rows, one per instruments.
pub rows: Vec<WatchlistRequestBodyRow>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
pub struct WatchlistRequestBodyRow {
/// Conid as string.
#[serde(rename = "C")]
pub c: Option<String>,
}
/// Object containing a successful query for watchlists saved for the username in use in the current Web API session.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(default)]
pub struct WatchlistsResponse {
/// Internal use. Number of times endpoint has been visited during session.
#[serde(rename = "MID")]
pub mid: Option<String>,
/// Internal use. Always has value 'content'.
#[default(Some("content".to_string()))]
pub action: Option<String>,
/// Contains the watchlist query results.
pub data: Option<WatchlistsResponseData>,
}
/// Contains the watchlist query results.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
pub struct WatchlistsResponseData {
/// Indicates if username's watchlists can be bulk-deleted.
pub bulk_delete: Option<bool>,
/// Indicates if query results contain only market scanners.
pub scanners_only: Option<bool>,
/// Indicates if market scanners are included in query results.
pub show_scanners: Option<bool>,
/// Array of objects detailing the watchlists saved for the username in use in the current Web API session.
pub user_lists: Option<Vec<WatchlistsResponseDataUserList>>,
}
/// Details of a single watchlist.
#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
#[serde(default)]
pub struct WatchlistsResponseDataUserList {
/// Watchlist ID of the watchlist.
pub id: Option<String>,
/// Internal use. Indicates if the watchlist is currently in use.
pub is_open: Option<bool>,
/// Unix timestamp in milliseconds of the last modification of the watchlist.
pub modified: Option<i32>,
/// Display name of the watchlist.
pub name: Option<String>,
/// Indicates if the watchlist can be edited.
pub read_only: Option<bool>,
/// Always has value 'watchlist'.
#[serde(rename = "type")]
#[default(Some("watchlist".to_string()))]
pub r#type: Option<String>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct WithdrawFundsInstruction {
/// - Example: `"U46377".to_string()`
#[serde(rename = "accountId")]
#[validate(length(min = 1u64, max = 32u64))]
pub account_id: String,
/// - Example: `100.0`
pub amount: f64,
/// - Example: `"WIRE"`
#[serde(rename = "bankInstructionMethod")]
pub bank_instruction_method: WithdrawFundsInstructionBankInstructionMethod,
/// - Example: `"Instruction".to_string()`
#[serde(rename = "bankInstructionName")]
#[validate(length(min = 1u64, max = 150u64))]
pub bank_instruction_name: String,
/// - Example: `1012983.0`
#[serde(rename = "clientInstructionId")]
pub client_instruction_id: f64,
/// - Example: `"USD".to_string()`
#[validate(length(min = 1u64, max = 3u64))]
pub currency: String,
#[serde(rename = "dateTimeToOccur")]
pub date_time_to_occur: Option<chrono::DateTime<chrono::Utc>>,
#[serde(rename = "iraWithdrawalDetail")]
#[validate(nested)]
pub ira_withdrawal_detail: Option<WithdrawFundsInstructionIraWithdrawalDetail>,
#[serde(rename = "recurringInstructionDetail")]
#[validate(nested)]
pub recurring_instruction_detail: Option<RecurringInstructionDetail>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum WithdrawFundsInstructionBankInstructionMethod {
#[serde(rename = "ACH")]
#[default]
Ach,
#[serde(rename = "WIRE")]
Wire,
#[serde(rename = "SEPA")]
Sepa,
}
impl core::fmt::Display for WithdrawFundsInstructionBankInstructionMethod {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Ach => write!(f, "ACH"),
Self::Wire => write!(f, "WIRE"),
Self::Sepa => write!(f, "SEPA"),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
pub struct WithdrawFundsInstructionIraWithdrawalDetail {
/// - Example: `12.0`
#[serde(rename = "fedIncomeTaxPercentage")]
pub fed_income_tax_percentage: f64,
/// - Example: `"NORMAL"`
#[serde(rename = "iraWithholdType")]
pub ira_withhold_type: WithdrawFundsInstructionIraWithdrawalDetailIraWithholdType,
/// - Example: `"TE".to_string()`
#[serde(rename = "stateCd")]
#[validate(length(min = 1u64, max = 2u64))]
pub state_cd: String,
/// - Example: `10.0`
#[serde(rename = "stateIncomeTaxPercentage")]
pub state_income_tax_percentage: f64,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
pub enum WithdrawFundsInstructionIraWithdrawalDetailIraWithholdType {
#[serde(rename = "DIRECT_ROLLOVER")]
#[default]
DirectRollover,
#[serde(rename = "ROTH_DISTRIBUTION")]
RothDistribution,
#[serde(rename = "NORMAL")]
Normal,
#[serde(rename = "EARLY")]
Early,
#[serde(rename = "DEATH")]
Death,
#[serde(rename = "EXCESS_CY")]
ExcessCy,
#[serde(rename = "EXCESS_PY")]
ExcessPy,
#[serde(rename = "EXCESS_SC")]
ExcessSc,
}
impl core::fmt::Display for WithdrawFundsInstructionIraWithdrawalDetailIraWithholdType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::DirectRollover => write!(f, "DIRECT_ROLLOVER"),
Self::RothDistribution => write!(f, "ROTH_DISTRIBUTION"),
Self::Normal => write!(f, "NORMAL"),
Self::Early => write!(f, "EARLY"),
Self::Death => write!(f, "DEATH"),
Self::ExcessCy => write!(f, "EXCESS_CY"),
Self::ExcessPy => write!(f, "EXCESS_PY"),
Self::ExcessSc => write!(f, "EXCESS_SC"),
}
}
}