initial commit

This commit is contained in:
Borodinov Ilya 2024-06-07 17:47:02 +03:00
commit 5f9ca355b0
Signed by: noth
GPG key ID: 75503B2EF596D1BD
445 changed files with 47288 additions and 0 deletions

1
.devenv/profile Symbolic link
View file

@ -0,0 +1 @@
/nix/store/ya15x5s5b8w1visadax2ffndw4fknkmb-devenv-profile

1
.devenv/run Symbolic link
View file

@ -0,0 +1 @@
/run/user/1000/devenv-503e649

19
.direnv/bin/nix-direnv-reload Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -e
if [[ ! -d "/mnt/k/minky/trading/sdk" ]]; then
echo "Cannot find source directory; Did you move it?"
echo "(Looking for "/mnt/k/minky/trading/sdk")"
echo 'Cannot force reload with this script - use "direnv reload" manually and then try again'
exit 1
fi
# rebuild the cache forcefully
_nix_direnv_force_reload=1 direnv exec "/mnt/k/minky/trading/sdk" true
# Update the mtime for .envrc.
# This will cause direnv to reload again - but without re-building.
touch "/mnt/k/minky/trading/sdk/.envrc"
# Also update the timestamp of whatever profile_rc we have.
# This makes sure that we know we are up to date.
touch -r "/mnt/k/minky/trading/sdk/.envrc" "/mnt/k/minky/trading/sdk/.direnv"/*.rc

View file

@ -0,0 +1 @@
/nix/store/27rg15w6bjjh2hkbdqajhvqd7b02v5cb-source

View file

@ -0,0 +1 @@
/nix/store/8kpx53qi52yhjai1vdw8zpa95iqa61bv-source

View file

@ -0,0 +1 @@
/nix/store/8sm7wycza5fl6lnsmw11sn4vqkvw4xyh-source

View file

@ -0,0 +1 @@
/nix/store/ah2qh833bkpxg8girwyl6vs30fkp1109-source

View file

@ -0,0 +1 @@
/nix/store/br885sqy62q1bblwi2bslcfg2193ly75-source

View file

@ -0,0 +1 @@
/nix/store/dlrwkbfzbag8f4xj2kbixalscj206j45-source

View file

@ -0,0 +1 @@
/nix/store/f2h5kmarn194yda41znm0r4ibwyg8z7i-source

View file

@ -0,0 +1 @@
/nix/store/g5v3sgqy6a0fsmas7mnapc196flrplix-source

View file

@ -0,0 +1 @@
/nix/store/gzf4zwcakda1nykn6h0avh45xhjhvsz4-source

View file

@ -0,0 +1 @@
/nix/store/hwsdv71bmaqvzbii5viryxc8slw4vr5v-source

View file

@ -0,0 +1 @@
/nix/store/i4ginw25yf2q0shnzvzjjwa58srbjhw7-source

View file

@ -0,0 +1 @@
/nix/store/i6yzq14z49ayjinw6v9v06kqz62akkay-source

View file

@ -0,0 +1 @@
/nix/store/ia8xy09wg9si4lbbxgzbyyg1n0qxg1vk-source

View file

@ -0,0 +1 @@
/nix/store/lhbcw63xdqclg2hrni4p7dc90nl996lk-source

View file

@ -0,0 +1 @@
/nix/store/lvg59dwzvw3q6l1kpf4mirnzv2fflmra-source

View file

@ -0,0 +1 @@
/nix/store/mhgnysbsr0yx44xlqvl7xymk8js22c7z-source

View file

@ -0,0 +1 @@
/nix/store/na7sykizsgkzh9i3wc8m8pz5xfqib2rv-source

View file

@ -0,0 +1 @@
/nix/store/qkig73szmrhgp0qhncxy5vb36lw2g3jj-source

View file

@ -0,0 +1 @@
/nix/store/r2ip1850igy8kciyaagw502s3c6ph1s4-source

View file

@ -0,0 +1 @@
/nix/store/s1cnnplqrk8w595dp9fb5cv84xj61lgx-source

View file

@ -0,0 +1 @@
/nix/store/v1wzqsqi3d9fhdl60n24sqhj7pr3yhin-source

View file

@ -0,0 +1 @@
/nix/store/vm4qsaala00i8q5js7i3am3w0m766k1d-source

View file

@ -0,0 +1 @@
/nix/store/vpddlysgdvzcqixkqgx49zyx2whhzpkb-source

View file

@ -0,0 +1 @@
/nix/store/vz580xz1w41n6m6x81mqgcrnp3y4cf41-source

View file

@ -0,0 +1 @@
/nix/store/y1nw9w1s0ly6442igksfq29v0cfbnmfd-source

View file

@ -0,0 +1 @@
/nix/store/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source

View file

@ -0,0 +1 @@
/nix/store/z9wkyy0bbdjfvsmkkw16bmn56502hd1k-source

View file

@ -0,0 +1 @@
/nix/store/6mjq6r4lpd0xpxg65v2nqyfh3dvb17xm-devenv-shell-env

File diff suppressed because it is too large Load diff

4
.envrc Normal file
View file

@ -0,0 +1,4 @@
if ! has nix_direnv_version || ! nix_direnv_version 3.0.4; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.4/direnvrc" "sha256-DzlYZ33mWF/Gs8DDeyjr8mnVmQGx7ASYqA5WlxwvBG4="
fi
use flake . --impure

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/target

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "crates/tinkoff_invest/investapi"]
path = crates/tinkoff_invest/investapi
url = https://github.com/tinkoff/investapi

1922
Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

20
Cargo.toml Normal file
View file

@ -0,0 +1,20 @@
[workspace]
members = ["crates/*"]
resolver = "2"
[workspace.package]
version = "0.1.0"
edition = "2021"
[workspace.dependencies]
## crates/*
sanetrade_algorithms.path = "crates/algorithms"
alpaca_openapi.path = "crates/alpaca_openapi"
tinkoff_invest.path = "crates/tinkoff_invest"
## deps
tokio = { version = "1", features = ["sync", "rt"] }
futures-core = { version = "0.3", features = ["std"], default-features = false }
tonic = "0.11"
prost = "0.12"
prost-types = "0.12"

15
README.md Normal file
View file

@ -0,0 +1,15 @@
[README на русском](./README.ru.md)
# sanetrade - a trading SDK that doesn't care what you're using
## progress
### Brokers
#### USA
- [ ] [alpaca](https://alpaca.markets/)
#### Russia
- [ ] [tinkoff](https://tinkoff.github.io/investAPI/)
- [ ] [alor](https://alor.dev/docs)
- [ ] [finam](https://finamweb.github.io/trade-api-docs/)

15
README.ru.md Normal file
View file

@ -0,0 +1,15 @@
# sanetrade - библиотека для трейдинга
sanetrade позволяет легко и быстро писать трейдинг ботов и заставить их работать с любым доступным брокером.
## прогресс
### брокеры
#### США
- [ ] [alpaca](https://alpaca.markets/)
#### Россия
- [ ] [Тинькофф](https://tinkoff.github.io/investAPI/)
- [ ] [Алор](https://alor.dev/docs)
- [ ] [Финам](https://finamweb.github.io/trade-api-docs/)

View file

@ -0,0 +1,9 @@
[package]
name = "sanetrade_algorithms"
version = "0.1.0"
edition = "2021"
[dependencies]
futures-core.workspace = true
itertools = "0.13.0"
pin-project = "1.1.5"

View file

@ -0,0 +1,48 @@
/// An f64 wrapper that is NaN by default and has a NaN-safe getter
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Nanf64(pub f64);
impl Default for Nanf64 {
fn default() -> Self {
Self::nan()
}
}
impl Nanf64 {
pub const fn nan() -> Self {
Self(f64::NAN)
}
pub const fn is_nan(&self) -> bool {
self.0.is_nan()
}
pub const fn get(&self) -> Option<f64> {
if self.is_nan() {
None
} else {
Some(self.0)
}
}
pub fn maybe_set(&mut self, value: f64) -> f64 {
if self.is_nan() {
self.0 = value;
value
} else {
self.0
}
}
pub fn update_to(&mut self, f: impl FnOnce(Option<f64>) -> f64) -> f64 {
let res = f(self.get());
self.0 = res;
res
}
pub fn update<U>(&mut self, f: impl FnOnce(Option<f64>) -> (U, f64)) -> U {
let (res, val) = f(self.get());
self.0 = val;
res
}
}

View file

@ -0,0 +1,187 @@
use std::{
ops::Range,
simd::{cmp::SimdPartialOrd, f64x2, f64x4, num::SimdFloat, simd_swizzle},
};
use super::*;
pub struct Divergences<O: Oscillator>(pub O);
impl<O: Oscillator> Divergences<O> {
pub fn new(oscillator: O) -> Self {
Self(oscillator)
}
pub fn iter<I: Iterator<Item = f64>>(self, prices: I) -> DivergenceIter<O, I> {
DivergenceIter {
prices,
state: DivergenceState::new(self.0),
}
}
}
pub struct DivergenceIter<O: Oscillator, I: Iterator<Item = f64>> {
prices: I,
state: DivergenceState<O>,
}
struct DivergenceState<O: Oscillator> {
oscillator: O,
//price_lo, price_hi; osc_lo, osc_hi
mask: f64x4,
cycle: usize,
divergence: Option<(usize, Divergence)>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Divergence {
Bearish,
Bullish,
HiddenBearish,
HiddenBullish,
}
impl<O: Oscillator> DivergenceState<O> {
pub fn new(oscillator: O) -> Self {
Self {
oscillator,
mask: f64x4::splat(f64::NAN),
cycle: 0,
divergence: None,
}
}
fn cycle(&mut self, price: f64) -> Option<Divergence> {
let osc = self.oscillator.advance(price);
println!(
"{price} {osc} phi={} plo={} ohi={} olo={}",
self.mask[0], self.mask[1], self.mask[2], self.mask[3]
);
if self.mask.is_nan().any() {
self.mask = simd_swizzle!(f64x2::splat(price), f64x2::splat(osc), [0, 1, 2, 3]);
return None;
}
// match (
// (self.price_lo, self.price_hi),
// (self.osc_lo, funnies.osc_hi),
// ) {
// // classic bearish
// // price makes higher highs but oscillator makes lower highs
// ((price_hi, price_lo), (osc_hi, osc_lo))
// if price > price_hi && osc < osc_hi && osc > osc_lo =>
// {
// self.price_hi = price;
// self.osc_hi = osc;
//
// ControlFlow::Continue(Some(Divergence::Bearish))
// }
// // classic bullish
// // price makes lower lows but oscillator makes higher lows
// ((price_hi, price_lo), (osc_hi, osc_lo))
// if price < price_lo && osc > osc_lo && osc < osc_hi =>
// {
// self.price_lo = price;
// self.osc_lo = osc;
//
// ControlFlow::Continue(Some(Divergence::Bullish))
// }
// // hidden bearish
// // price makes lower lows but oscillator makes lower highs
// ((price_hi, price_lo), (osc_hi, osc_lo)) if price < price_lo && osc < osc_hi => {
// self.price_lo = price;
// self.osc_hi = osc;
//
// ControlFlow::Continue(Some(Divergence::HiddenBearish))
// }
// // hidden bullish
// // price makes higher highs but oscillator makes higher lows
// ((price_hi, price_lo), (osc_hi, osc_lo)) if price > price_hi && osc > osc_lo => {
// self.price_hi = price;
// self.osc_lo = osc;
//
// ControlFlow::Continue(Some(Divergence::HiddenBullish))
// }
// _ => {
// // no divergence detected
// ControlFlow::Continue(None)
// }
// };
match self
.mask
.simd_lt(f64x4::from_array([price, price, osc, osc]))
.to_array()
{
[true, _, false, true] => {
self.mask[0] = price;
self.mask[2] = osc;
Some(Divergence::Bearish)
}
[false, true, true, true] => {
self.mask[1] = price;
self.mask[3] = osc;
Some(Divergence::Bullish)
}
[_, false, false, _] => {
self.mask[1] = price;
self.mask[2] = osc;
Some(Divergence::HiddenBearish)
}
[true, _, _, true] => {
self.mask[0] = price;
self.mask[3] = osc;
Some(Divergence::HiddenBullish)
}
_ => None,
}
}
}
impl<O: Oscillator, I: Iterator<Item = f64>> Iterator for DivergenceIter<O, I> {
type Item = (Range<usize>, Divergence);
fn next(&mut self) -> Option<Self::Item> {
loop {
if let Some(current) = self.state.cycle(self.prices.next()?) {
match self.state.divergence {
Some((start, old)) if old == current => {
self.state.divergence = Some((start, current))
}
Some((start, old)) => {
self.state.divergence = Some((self.state.cycle, current));
return Some((start..self.state.cycle, old));
}
_ => self.state.divergence = Some((self.state.cycle, current)),
}
}
self.state.cycle += 1;
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::rsi::Rsi;
use crate::testing::*;
#[test]
fn test_divergence() {
let iter = Divergences::new(Rsi::<10>::default()).iter(
vec![
234.05, 255.95, 260.05, 270.05, 280.05, 290.05, 300.05, 310.05, 320.05, 330.05,
180.08, 190.08, 200.08, 210.08, 220.08, 230.08, 240.08, 250.08, 260.08, 270.08,
]
.into_iter(),
);
panic!("{:#?}", iter.collect_vec())
}
}

View file

@ -0,0 +1,94 @@
//! # sanetrade_algorithms - SIMD-accelerated implementations of common algorithms used by traders
//!
//! ## Indicators
//! - EMA (specifically combined 20,50,100,200 day)
//! - RSI
//!
//! ## Helpers - algorithms that find differences between prices and indicators' outputs
//! - A divergence detector (typically combined with RSI)
#![feature(portable_simd, const_float_classify)]
use std::simd::{LaneCount, Simd, SupportedLaneCount};
//use futures_core::{ready, Stream};
use itertools::Itertools;
pub fn chunk<T>(iter: &mut impl Iterator<Item = T>, size: usize) -> Option<Vec<T>> {
let vec = iter.take(size).collect_vec();
if vec.len() < size {
None
} else {
Some(vec)
}
}
pub mod divergence;
pub mod obv;
pub mod dev;
pub mod ma;
pub mod rsi;
use crate::dev::*;
pub trait Algorithm<T> {
type Output;
fn advance(&mut self, value: T) -> Self::Output;
}
pub struct Candles<const N: usize>
where
LaneCount<N>: SupportedLaneCount,
{
pub open: Simd<f64, N>,
pub high: Simd<f64, N>,
pub low: Simd<f64, N>,
pub close: Simd<f64, N>,
pub volume: Simd<i64, N>,
}
pub trait SimdAlgorithm {
type Output;
fn simd_advance<const N: usize>(&mut self, candles: Candles<N>) -> Self::Output
where
LaneCount<N>: SupportedLaneCount;
}
pub trait Close {
fn close(&self) -> f64;
}
pub trait Volume {
fn volume(&self) -> f64;
}
pub trait Oscillator: Algorithm<f64, Output = f64> {
const PERIOD: usize;
}
pub mod testing {
pub use itertools::assert_equal;
use std::fmt::Debug;
pub fn assert_iter_close<T, A, B>(a: A, b: B, epsilon: f64)
where
T: Debug + PartialEq + Into<f64>,
A: Iterator<Item = T>,
B: IntoIterator<Item = T>,
B::IntoIter: Iterator<Item = T>,
{
a.zip(b).for_each(|(a, b)| {
let a: f64 = a.into();
let b: f64 = b.into();
assert!(
(a - b).abs() < epsilon,
"assertion failed: {a:?} !~= (epsilon: {epsilon:?}) {b:?}"
);
})
}
}

View file

@ -0,0 +1,65 @@
use super::*;
#[derive(Default)]
pub struct Ema<const P: usize>(Nanf64);
impl<const P: usize> Ema<P> {
const WMUL: f64 = 2. / (P + 1) as f64;
}
impl<const P: usize> Algorithm<f64> for Ema<P> {
type Output = f64;
fn advance(&mut self, value: f64) -> Self::Output {
self.0
.update_to(|v| v.map_or(value, |v| Self::WMUL * value + (1.0 - Self::WMUL) * v))
}
}
impl<const P: usize> Oscillator for Ema<P> {
const PERIOD: usize = P;
}
pub struct Sma<const P: usize> {
index: usize,
count: usize,
sum: f64,
deque: [f64; P],
}
impl<const P: usize> Default for Sma<P> {
fn default() -> Self {
Self {
index: 0,
count: 0,
sum: 0.,
deque: [0.; P],
}
}
}
impl<const P: usize> Oscillator for Sma<P> {
const PERIOD: usize = P;
}
impl<const P: usize> Algorithm<f64> for Sma<P> {
type Output = f64;
fn advance(&mut self, value: f64) -> Self::Output {
let old_val = self.deque[self.index];
self.deque[self.index] = value;
self.index = if self.index + 1 < P {
self.index + 1
} else {
0
};
if self.count < P {
self.count += 1;
}
self.sum = self.sum - old_val + value;
self.sum / (self.count as f64)
}
}

View file

@ -0,0 +1,25 @@
use super::*;
#[derive(Default)]
pub struct Obv {
obv: f64,
prev_close: f64,
}
impl<T: Close + Volume> Algorithm<&T> for Obv {
type Output = f64;
fn advance(&mut self, value: &T) -> Self::Output {
let close = value.close();
let volume = value.volume();
if close > self.prev_close {
self.obv = self.obv + volume;
} else if close < self.prev_close {
self.obv = self.obv - volume;
}
self.prev_close = close;
self.obv
}
}

View file

@ -0,0 +1,35 @@
use super::*;
use crate::ma::Ema;
/// Relative strength index
#[derive(Default)]
pub struct Rsi<const P: usize> {
up: Ema<P>,
down: Ema<P>,
prev: Nanf64,
}
impl<const P: usize> Oscillator for Rsi<P> {
const PERIOD: usize = P;
}
impl<const P: usize> Algorithm<f64> for Rsi<P> {
type Output = f64;
fn advance(&mut self, value: f64) -> Self::Output {
let diff = self
.prev
.update(|opt| (opt.map_or(0., |prev| value - prev), value));
println!("{value} {diff}");
// clever math hack to avoid having 2 separate f64 vars for up and down
let up = dbg!(self.up.advance(diff.max(0.)));
100.0 * up / (up + dbg!(self.down.advance(diff.min(0.))))
}
}
/// An absolutely tiny number that is used as a seed for the EMAs if it's the first time
/// calculating the diff in RSI
#[doc(hidden)]
pub const TINY: f64 = 1e-8;

View file

@ -0,0 +1,9 @@
[package]
name = "alpaca_openapi"
version = "0.1.0"
edition = "2021"
[dependencies]
alpaca_broker = { path = "gen/broker" }
alpaca_trading = { path = "gen/trading" }
alpaca_data = { path = "gen/data" }

View file

@ -0,0 +1,3 @@
/target/
**/*.rs.bk
Cargo.lock

View file

@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View file

@ -0,0 +1,212 @@
.gitignore
.openapi-generator-ignore
.travis.yml
Cargo.toml
README.md
docs/Account.md
docs/AccountConfigurations.md
docs/AccountCreationRequest.md
docs/AccountDocument.md
docs/AccountExtended.md
docs/AccountStatus.md
docs/AccountStatusEvent.md
docs/AccountType.md
docs/AccountUpdateRequest.md
docs/AccountsApi.md
docs/AchRelationship.md
docs/Activity.md
docs/ActivityItem.md
docs/ActivityType.md
docs/Agreement.md
docs/AgreementType.md
docs/Announcement.md
docs/AnnouncementCaSubType.md
docs/AnnouncementCaType.md
docs/ApplicationDocument.md
docs/Asset.md
docs/AssetClass.md
docs/AssetsApi.md
docs/AuthorizeOAuthTokenResponse.md
docs/Bank.md
docs/BatchJournalRequest.md
docs/BatchJournalRequestEntriesInner.md
docs/BatchJournalResponse.md
docs/Calendar.md
docs/CalendarApi.md
docs/Clock.md
docs/ClockApi.md
docs/Contact.md
docs/CorporateActionsApi.md
docs/CreateAchRelationshipRequest.md
docs/CreateBankRequest.md
docs/CreateJournalRequest.md
docs/CreateOrderRequest.md
docs/CreateOrderRequestStopLoss.md
docs/CreateOrderRequestTakeProfit.md
docs/CreateTransferRequest.md
docs/CreateWatchlistRequest.md
docs/CustodialAccountMinorIdentity.md
docs/DisclosureContextAnnotation.md
docs/Disclosures.md
docs/DocumentInner.md
docs/DocumentType.md
docs/DocumentUpload.md
docs/DocumentUploadRequest.md
docs/DocumentsApi.md
docs/Error.md
docs/EventsApi.md
docs/Exchange.md
docs/FundingApi.md
docs/Identity.md
docs/IssueOAuthTokenResponse.md
docs/Jnlc.md
docs/Jnls.md
docs/Journal.md
docs/JournalData.md
docs/JournalEntryType.md
docs/JournalResource.md
docs/JournalStatus.md
docs/JournalStatusEvent.md
docs/JournalsApi.md
docs/KycResult.md
docs/NonTradeActivity.md
docs/OAuthApi.md
docs/OAuthTokenRequest.md
docs/OathClientResponse.md
docs/Order.md
docs/OrderClass.md
docs/OrderClosedResponse.md
docs/OrderSide.md
docs/OrderStatus.md
docs/OrderType.md
docs/PortfolioHistory.md
docs/Position.md
docs/PositionClosedResponse.md
docs/TaxIdType.md
docs/TimeInForce.md
docs/TradeAccount.md
docs/TradeActivity.md
docs/TradeUpdateEvent.md
docs/TradeUpdateEventType.md
docs/TradingApi.md
docs/Transfer.md
docs/TransferData.md
docs/TransferDirection.md
docs/TransferResource.md
docs/TransferStatus.md
docs/TransferStatusEvent.md
docs/TransferTiming.md
docs/TransferType.md
docs/TrustedContact.md
docs/UntypedAchTransferData.md
docs/UntypedTransferData.md
docs/UntypedWireTransferData.md
docs/UpdateOrderRequest.md
docs/Watchlist.md
docs/WatchlistApi.md
git_push.sh
src/apis/accounts_api.rs
src/apis/assets_api.rs
src/apis/calendar_api.rs
src/apis/clock_api.rs
src/apis/configuration.rs
src/apis/corporate_actions_api.rs
src/apis/documents_api.rs
src/apis/events_api.rs
src/apis/funding_api.rs
src/apis/journals_api.rs
src/apis/mod.rs
src/apis/o_auth_api.rs
src/apis/trading_api.rs
src/apis/watchlist_api.rs
src/lib.rs
src/models/account.rs
src/models/account_configurations.rs
src/models/account_creation_request.rs
src/models/account_document.rs
src/models/account_extended.rs
src/models/account_status.rs
src/models/account_status_event.rs
src/models/account_type.rs
src/models/account_update_request.rs
src/models/ach_relationship.rs
src/models/activity.rs
src/models/activity_item.rs
src/models/activity_type.rs
src/models/agreement.rs
src/models/agreement_type.rs
src/models/announcement.rs
src/models/announcement_ca_sub_type.rs
src/models/announcement_ca_type.rs
src/models/application_document.rs
src/models/asset.rs
src/models/asset_class.rs
src/models/authorize_o_auth_token_response.rs
src/models/bank.rs
src/models/batch_journal_request.rs
src/models/batch_journal_request_entries_inner.rs
src/models/batch_journal_response.rs
src/models/calendar.rs
src/models/clock.rs
src/models/contact.rs
src/models/create_ach_relationship_request.rs
src/models/create_bank_request.rs
src/models/create_journal_request.rs
src/models/create_order_request.rs
src/models/create_order_request_stop_loss.rs
src/models/create_order_request_take_profit.rs
src/models/create_transfer_request.rs
src/models/create_watchlist_request.rs
src/models/custodial_account_minor_identity.rs
src/models/disclosure_context_annotation.rs
src/models/disclosures.rs
src/models/document_inner.rs
src/models/document_type.rs
src/models/document_upload.rs
src/models/document_upload_request.rs
src/models/error.rs
src/models/exchange.rs
src/models/identity.rs
src/models/issue_o_auth_token_response.rs
src/models/jnlc.rs
src/models/jnls.rs
src/models/journal.rs
src/models/journal_data.rs
src/models/journal_entry_type.rs
src/models/journal_resource.rs
src/models/journal_status.rs
src/models/journal_status_event.rs
src/models/kyc_result.rs
src/models/mod.rs
src/models/non_trade_activity.rs
src/models/o_auth_token_request.rs
src/models/oath_client_response.rs
src/models/order.rs
src/models/order_class.rs
src/models/order_closed_response.rs
src/models/order_side.rs
src/models/order_status.rs
src/models/order_type.rs
src/models/portfolio_history.rs
src/models/position.rs
src/models/position_closed_response.rs
src/models/tax_id_type.rs
src/models/time_in_force.rs
src/models/trade_account.rs
src/models/trade_activity.rs
src/models/trade_update_event.rs
src/models/trade_update_event_type.rs
src/models/transfer.rs
src/models/transfer_data.rs
src/models/transfer_direction.rs
src/models/transfer_resource.rs
src/models/transfer_status.rs
src/models/transfer_status_event.rs
src/models/transfer_timing.rs
src/models/transfer_type.rs
src/models/trusted_contact.rs
src/models/untyped_ach_transfer_data.rs
src/models/untyped_transfer_data.rs
src/models/untyped_wire_transfer_data.rs
src/models/update_order_request.rs
src/models/watchlist.rs

View file

@ -0,0 +1 @@
7.5.0

View file

@ -0,0 +1 @@
language: rust

View file

@ -0,0 +1,19 @@
[package]
name = "alpaca_broker"
version = "1.0.0"
authors = ["support@alpaca.markets"]
description = "Open brokerage accounts, enable crypto and stock trading, and manage the ongoing user experience with Alpaca Broker API"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
edition = "2018"
[dependencies]
serde = "^1.0"
serde_derive = "^1.0"
serde_with = "^2.0"
serde_json = "^1.0"
url = "^2.2"
uuid = { version = "^1.0", features = ["serde", "v4"] }
[dependencies.reqwest]
version = "^0.11"
features = ["json", "multipart"]

View file

@ -0,0 +1,199 @@
# Rust API client for alpaca_broker
Open brokerage accounts, enable crypto and stock trading, and manage the ongoing user experience with Alpaca Broker API
For more information, please visit [https://alpaca.markets/support](https://alpaca.markets/support)
## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client.
- API version: 1.0.0
- Package version: 1.0.0
- Generator version: 7.5.0
- Build package: `org.openapitools.codegen.languages.RustClientCodegen`
## Installation
Put the package under your project folder in a directory named `alpaca_broker` and add the following to `Cargo.toml` under `[dependencies]`:
```
alpaca_broker = { path = "./alpaca_broker" }
```
## Documentation for API Endpoints
All URIs are relative to *https://broker-api.sandbox.alpaca.markets*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AccountsApi* | [**create_account**](docs/AccountsApi.md#create_account) | **POST** /v1/accounts | Create an account
*AccountsApi* | [**create_ach_relationship_for_account**](docs/AccountsApi.md#create_ach_relationship_for_account) | **POST** /v1/accounts/{account_id}/ach_relationships | Create an ACH Relationship
*AccountsApi* | [**create_recipient_bank**](docs/AccountsApi.md#create_recipient_bank) | **POST** /v1/accounts/{account_id}/recipient_banks | Create a Bank Relationship for an account
*AccountsApi* | [**create_transfer_for_account**](docs/AccountsApi.md#create_transfer_for_account) | **POST** /v1/accounts/{account_id}/transfers | Request a new transfer
*AccountsApi* | [**delete_account**](docs/AccountsApi.md#delete_account) | **DELETE** /v1/accounts/{account_id} | Request to close an account
*AccountsApi* | [**delete_ach_relationship_from_account**](docs/AccountsApi.md#delete_ach_relationship_from_account) | **DELETE** /v1/accounts/{account_id}/ach_relationships/{ach_relationship_id} | Delete an existing ACH relationship
*AccountsApi* | [**delete_recipient_bank**](docs/AccountsApi.md#delete_recipient_bank) | **DELETE** /v1/accounts/{account_id}/recipient_banks/{bank_id} | Delete a Bank Relationship for an account
*AccountsApi* | [**delete_transfer**](docs/AccountsApi.md#delete_transfer) | **DELETE** /v1/accounts/{account_id}/transfers/{transfer_id} | Request to close a transfer
*AccountsApi* | [**get_account**](docs/AccountsApi.md#get_account) | **GET** /v1/accounts/{account_id} | Get an account by Id.
*AccountsApi* | [**get_account_ach_relationships**](docs/AccountsApi.md#get_account_ach_relationships) | **GET** /v1/accounts/{account_id}/ach_relationships | Retrieve ACH Relationships for an account
*AccountsApi* | [**get_account_activities**](docs/AccountsApi.md#get_account_activities) | **GET** /v1/accounts/activities | Retrieve account activities
*AccountsApi* | [**get_account_activities_by_type**](docs/AccountsApi.md#get_account_activities_by_type) | **GET** /v1/accounts/activities/{activity_type} | Retrieve specific account activities
*AccountsApi* | [**get_all_accounts**](docs/AccountsApi.md#get_all_accounts) | **GET** /v1/accounts | Get all accounts
*AccountsApi* | [**get_recipient_banks**](docs/AccountsApi.md#get_recipient_banks) | **GET** /v1/accounts/{account_id}/recipient_banks | Retrieve bank relationships for an account
*AccountsApi* | [**get_trading_account**](docs/AccountsApi.md#get_trading_account) | **GET** /v1/trading/accounts/{account_id}/account | Retrieve trading details for an account.
*AccountsApi* | [**get_transfers_for_account**](docs/AccountsApi.md#get_transfers_for_account) | **GET** /v1/accounts/{account_id}/transfers | Return a list of transfers for an account.
*AccountsApi* | [**patch_account**](docs/AccountsApi.md#patch_account) | **PATCH** /v1/accounts/{account_id} | Update an account
*AccountsApi* | [**suscribe_to_account_status_sse**](docs/AccountsApi.md#suscribe_to_account_status_sse) | **GET** /v1/events/accounts/status | Subscribe to account status events (SSE).
*AccountsApi* | [**upload_doc_to_account**](docs/AccountsApi.md#upload_doc_to_account) | **POST** /v1/accounts/{account_id}/documents/upload | Upload a document to an already existing account
*AssetsApi* | [**get_asset_by_symbol_or_id**](docs/AssetsApi.md#get_asset_by_symbol_or_id) | **GET** /v1/assets/{symbol_or_asset_id} | Retrieve an asset by UUID
*AssetsApi* | [**get_assets**](docs/AssetsApi.md#get_assets) | **GET** /v1/assets | Retrieve all assets
*CalendarApi* | [**query_market_calendar**](docs/CalendarApi.md#query_market_calendar) | **GET** /v1/calendar | Query market calendar
*ClockApi* | [**query_market_clock**](docs/ClockApi.md#query_market_clock) | **GET** /v1/clock | Query market clock
*CorporateActionsApi* | [**get_corporate_announcements**](docs/CorporateActionsApi.md#get_corporate_announcements) | **GET** /v1/corporate_actions/announcements | Retrieving Announcements
*DocumentsApi* | [**download_doc_from_account**](docs/DocumentsApi.md#download_doc_from_account) | **GET** /v1/accounts/{account_id}/documents/{document_id}/download | Download a document file that belongs to an account.
*DocumentsApi* | [**download_document_by_id**](docs/DocumentsApi.md#download_document_by_id) | **GET** /v1/documents/{document_id} | Download a document file directly
*DocumentsApi* | [**get_docs_for_account**](docs/DocumentsApi.md#get_docs_for_account) | **GET** /v1/accounts/{account_id}/documents | Return a list of account documents.
*EventsApi* | [**subscribe_to_journal_status_sse**](docs/EventsApi.md#subscribe_to_journal_status_sse) | **GET** /v1/events/journals/status | Subscribe to journal events (SSE).
*EventsApi* | [**subscribe_to_trade_sse**](docs/EventsApi.md#subscribe_to_trade_sse) | **GET** /v1/events/trades | Subscribe to Trade Events (SSE)
*EventsApi* | [**subscribe_to_transfer_status_sse**](docs/EventsApi.md#subscribe_to_transfer_status_sse) | **GET** /v1/events/transfers/status | Subscribe to Transfer Events (SSE)
*EventsApi* | [**suscribe_to_account_status_sse**](docs/EventsApi.md#suscribe_to_account_status_sse) | **GET** /v1/events/accounts/status | Subscribe to account status events (SSE).
*FundingApi* | [**create_ach_relationship_for_account**](docs/FundingApi.md#create_ach_relationship_for_account) | **POST** /v1/accounts/{account_id}/ach_relationships | Create an ACH Relationship
*FundingApi* | [**create_recipient_bank**](docs/FundingApi.md#create_recipient_bank) | **POST** /v1/accounts/{account_id}/recipient_banks | Create a Bank Relationship for an account
*FundingApi* | [**create_transfer_for_account**](docs/FundingApi.md#create_transfer_for_account) | **POST** /v1/accounts/{account_id}/transfers | Request a new transfer
*FundingApi* | [**delete_ach_relationship_from_account**](docs/FundingApi.md#delete_ach_relationship_from_account) | **DELETE** /v1/accounts/{account_id}/ach_relationships/{ach_relationship_id} | Delete an existing ACH relationship
*FundingApi* | [**delete_recipient_bank**](docs/FundingApi.md#delete_recipient_bank) | **DELETE** /v1/accounts/{account_id}/recipient_banks/{bank_id} | Delete a Bank Relationship for an account
*FundingApi* | [**delete_transfer**](docs/FundingApi.md#delete_transfer) | **DELETE** /v1/accounts/{account_id}/transfers/{transfer_id} | Request to close a transfer
*FundingApi* | [**get_account_ach_relationships**](docs/FundingApi.md#get_account_ach_relationships) | **GET** /v1/accounts/{account_id}/ach_relationships | Retrieve ACH Relationships for an account
*FundingApi* | [**get_recipient_banks**](docs/FundingApi.md#get_recipient_banks) | **GET** /v1/accounts/{account_id}/recipient_banks | Retrieve bank relationships for an account
*FundingApi* | [**get_transfers_for_account**](docs/FundingApi.md#get_transfers_for_account) | **GET** /v1/accounts/{account_id}/transfers | Return a list of transfers for an account.
*FundingApi* | [**subscribe_to_transfer_status_sse**](docs/FundingApi.md#subscribe_to_transfer_status_sse) | **GET** /v1/events/transfers/status | Subscribe to Transfer Events (SSE)
*JournalsApi* | [**create_batch_journal**](docs/JournalsApi.md#create_batch_journal) | **POST** /v1/journals/batch | Create a Batch Journal Transaction (One-to-Many)
*JournalsApi* | [**create_journal**](docs/JournalsApi.md#create_journal) | **POST** /v1/journals | Create a Journal.
*JournalsApi* | [**delete_journal_by_id**](docs/JournalsApi.md#delete_journal_by_id) | **DELETE** /v1/journals/{journal_id} | Cancel a pending journal.
*JournalsApi* | [**get_all_journals**](docs/JournalsApi.md#get_all_journals) | **GET** /v1/journals | Return a list of requested journals.
*JournalsApi* | [**subscribe_to_journal_status_sse**](docs/JournalsApi.md#subscribe_to_journal_status_sse) | **GET** /v1/events/journals/status | Subscribe to journal events (SSE).
*OAuthApi* | [**authorize_o_auth_token**](docs/OAuthApi.md#authorize_o_auth_token) | **POST** /v1/oauth/authorize | Authorize an OAuth Token
*OAuthApi* | [**get_o_auth_client**](docs/OAuthApi.md#get_o_auth_client) | **GET** /v1/oauth/clients/{client_id} | Get an OAuth client
*OAuthApi* | [**issue_o_auth_token**](docs/OAuthApi.md#issue_o_auth_token) | **POST** /v1/oauth/token | Issue an OAuth token.
*TradingApi* | [**close_all_positions_for_account**](docs/TradingApi.md#close_all_positions_for_account) | **DELETE** /v1/trading/accounts/{account_id}/positions | Close All Positions for an Account
*TradingApi* | [**close_position_for_account_by_symbol**](docs/TradingApi.md#close_position_for_account_by_symbol) | **DELETE** /v1/trading/accounts/{account_id}/positions/{symbol_or_asset_id} | Close a Position for an Account
*TradingApi* | [**create_order_for_account**](docs/TradingApi.md#create_order_for_account) | **POST** /v1/trading/accounts/{account_id}/orders | Create an order for an account.
*TradingApi* | [**delete_all_orders_for_account**](docs/TradingApi.md#delete_all_orders_for_account) | **DELETE** /v1/trading/accounts/{account_id}/orders | Attempts to cancel all open orders. A response will be provided for each order that is attempted to be cancelled.
*TradingApi* | [**delete_order_for_account**](docs/TradingApi.md#delete_order_for_account) | **DELETE** /v1/trading/accounts/{account_id}/orders/{order_id} | Attempts to cancel an open order.
*TradingApi* | [**get_all_orders_for_account**](docs/TradingApi.md#get_all_orders_for_account) | **GET** /v1/trading/accounts/{account_id}/orders | Retrieves a list of orders for the account, filtered by the supplied query parameters.
*TradingApi* | [**get_order_for_account**](docs/TradingApi.md#get_order_for_account) | **GET** /v1/trading/accounts/{account_id}/orders/{order_id} | Retrieves a single order for the given order_id.
*TradingApi* | [**get_positions_for_account**](docs/TradingApi.md#get_positions_for_account) | **GET** /v1/trading/accounts/{account_id}/positions | List open positions for an account
*TradingApi* | [**get_positions_for_account_by_symbol**](docs/TradingApi.md#get_positions_for_account_by_symbol) | **GET** /v1/trading/accounts/{account_id}/positions/{symbol_or_asset_id} | Get an Open Position for account by Symbol or AssetId
*TradingApi* | [**replace_order_for_account**](docs/TradingApi.md#replace_order_for_account) | **PATCH** /v1/trading/accounts/{account_id}/orders/{order_id} | Replaces a single order with updated parameters
*TradingApi* | [**subscribe_to_trade_sse**](docs/TradingApi.md#subscribe_to_trade_sse) | **GET** /v1/events/trades | Subscribe to Trade Events (SSE)
*WatchlistApi* | [**create_watchlist_for_account**](docs/WatchlistApi.md#create_watchlist_for_account) | **POST** /v1/trading/accounts/{account_id}/watchlists | Create a new watchlist
*WatchlistApi* | [**delete_watchlist_from_account_by_id**](docs/WatchlistApi.md#delete_watchlist_from_account_by_id) | **DELETE** /v1/accounts/{account_id}/watchlists/{watchlist_id} | Remove a watchlist
*WatchlistApi* | [**get_all_watchlists_for_account**](docs/WatchlistApi.md#get_all_watchlists_for_account) | **GET** /v1/trading/accounts/{account_id}/watchlists | Retrieve all watchlists
*WatchlistApi* | [**get_watchlist_for_account_by_id**](docs/WatchlistApi.md#get_watchlist_for_account_by_id) | **GET** /v1/accounts/{account_id}/watchlists/{watchlist_id} | Manage watchlists
*WatchlistApi* | [**replace_watchlist_for_account_by_id**](docs/WatchlistApi.md#replace_watchlist_for_account_by_id) | **PUT** /v1/accounts/{account_id}/watchlists/{watchlist_id} | Update an existing watchlist
## Documentation For Models
- [Account](docs/Account.md)
- [AccountConfigurations](docs/AccountConfigurations.md)
- [AccountCreationRequest](docs/AccountCreationRequest.md)
- [AccountDocument](docs/AccountDocument.md)
- [AccountExtended](docs/AccountExtended.md)
- [AccountStatus](docs/AccountStatus.md)
- [AccountStatusEvent](docs/AccountStatusEvent.md)
- [AccountType](docs/AccountType.md)
- [AccountUpdateRequest](docs/AccountUpdateRequest.md)
- [AchRelationship](docs/AchRelationship.md)
- [Activity](docs/Activity.md)
- [ActivityItem](docs/ActivityItem.md)
- [ActivityType](docs/ActivityType.md)
- [Agreement](docs/Agreement.md)
- [AgreementType](docs/AgreementType.md)
- [Announcement](docs/Announcement.md)
- [AnnouncementCaSubType](docs/AnnouncementCaSubType.md)
- [AnnouncementCaType](docs/AnnouncementCaType.md)
- [ApplicationDocument](docs/ApplicationDocument.md)
- [Asset](docs/Asset.md)
- [AssetClass](docs/AssetClass.md)
- [AuthorizeOAuthTokenResponse](docs/AuthorizeOAuthTokenResponse.md)
- [Bank](docs/Bank.md)
- [BatchJournalRequest](docs/BatchJournalRequest.md)
- [BatchJournalRequestEntriesInner](docs/BatchJournalRequestEntriesInner.md)
- [BatchJournalResponse](docs/BatchJournalResponse.md)
- [Calendar](docs/Calendar.md)
- [Clock](docs/Clock.md)
- [Contact](docs/Contact.md)
- [CreateAchRelationshipRequest](docs/CreateAchRelationshipRequest.md)
- [CreateBankRequest](docs/CreateBankRequest.md)
- [CreateJournalRequest](docs/CreateJournalRequest.md)
- [CreateOrderRequest](docs/CreateOrderRequest.md)
- [CreateOrderRequestStopLoss](docs/CreateOrderRequestStopLoss.md)
- [CreateOrderRequestTakeProfit](docs/CreateOrderRequestTakeProfit.md)
- [CreateTransferRequest](docs/CreateTransferRequest.md)
- [CreateWatchlistRequest](docs/CreateWatchlistRequest.md)
- [CustodialAccountMinorIdentity](docs/CustodialAccountMinorIdentity.md)
- [DisclosureContextAnnotation](docs/DisclosureContextAnnotation.md)
- [Disclosures](docs/Disclosures.md)
- [DocumentInner](docs/DocumentInner.md)
- [DocumentType](docs/DocumentType.md)
- [DocumentUpload](docs/DocumentUpload.md)
- [DocumentUploadRequest](docs/DocumentUploadRequest.md)
- [Error](docs/Error.md)
- [Exchange](docs/Exchange.md)
- [Identity](docs/Identity.md)
- [IssueOAuthTokenResponse](docs/IssueOAuthTokenResponse.md)
- [Jnlc](docs/Jnlc.md)
- [Jnls](docs/Jnls.md)
- [Journal](docs/Journal.md)
- [JournalData](docs/JournalData.md)
- [JournalEntryType](docs/JournalEntryType.md)
- [JournalResource](docs/JournalResource.md)
- [JournalStatus](docs/JournalStatus.md)
- [JournalStatusEvent](docs/JournalStatusEvent.md)
- [KycResult](docs/KycResult.md)
- [NonTradeActivity](docs/NonTradeActivity.md)
- [OAuthTokenRequest](docs/OAuthTokenRequest.md)
- [OathClientResponse](docs/OathClientResponse.md)
- [Order](docs/Order.md)
- [OrderClass](docs/OrderClass.md)
- [OrderClosedResponse](docs/OrderClosedResponse.md)
- [OrderSide](docs/OrderSide.md)
- [OrderStatus](docs/OrderStatus.md)
- [OrderType](docs/OrderType.md)
- [PortfolioHistory](docs/PortfolioHistory.md)
- [Position](docs/Position.md)
- [PositionClosedResponse](docs/PositionClosedResponse.md)
- [TaxIdType](docs/TaxIdType.md)
- [TimeInForce](docs/TimeInForce.md)
- [TradeAccount](docs/TradeAccount.md)
- [TradeActivity](docs/TradeActivity.md)
- [TradeUpdateEvent](docs/TradeUpdateEvent.md)
- [TradeUpdateEventType](docs/TradeUpdateEventType.md)
- [Transfer](docs/Transfer.md)
- [TransferData](docs/TransferData.md)
- [TransferDirection](docs/TransferDirection.md)
- [TransferResource](docs/TransferResource.md)
- [TransferStatus](docs/TransferStatus.md)
- [TransferStatusEvent](docs/TransferStatusEvent.md)
- [TransferTiming](docs/TransferTiming.md)
- [TransferType](docs/TransferType.md)
- [TrustedContact](docs/TrustedContact.md)
- [UntypedAchTransferData](docs/UntypedAchTransferData.md)
- [UntypedTransferData](docs/UntypedTransferData.md)
- [UntypedWireTransferData](docs/UntypedWireTransferData.md)
- [UpdateOrderRequest](docs/UpdateOrderRequest.md)
- [Watchlist](docs/Watchlist.md)
To get access to the crate's generated documentation, use:
```
cargo doc --open
```
## Author
support@alpaca.markets

View file

@ -0,0 +1,19 @@
# Account
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | [**uuid::Uuid**](uuid::Uuid.md) | |
**account_number** | Option<**String**> | |
**status** | [**models::AccountStatus**](AccountStatus.md) | |
**crypto_status** | Option<[**models::AccountStatus**](AccountStatus.md)> | | [optional]
**currency** | **String** | Always \"USD\" |
**created_at** | **String** | |
**last_equity** | **String** | |
**kyc_results** | Option<[**models::KycResult**](KYCResult.md)> | | [optional]
**account_type** | Option<[**models::AccountType**](AccountType.md)> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,17 @@
# AccountConfigurations
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**dtbp_check** | **String** | both, entry, or exit. Controls Day Trading Margin Call (DTMC) checks. |
**trade_confirm_email** | **String** | all or none. If none, emails for order fills are not sent. |
**suspend_trade** | **bool** | If true, new orders are blocked. |
**no_shorting** | **bool** | If true, account becomes long-only mode. |
**fractional_trading** | **bool** | If true, account is able to participate in fractional trading |
**max_margin_multiplier** | **String** | Can be \"1\" or \"2\" |
**pdt_check** | **String** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,16 @@
# AccountCreationRequest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**contact** | [**models::Contact**](Contact.md) | |
**identity** | [**models::Identity**](Identity.md) | |
**disclosures** | [**models::Disclosures**](Disclosures.md) | |
**agreements** | [**Vec<models::Agreement>**](Agreement.md) | The client has to present the Alpaca Account and Margin Agreements to the end user, and have them read full sentences. |
**documents** | Option<[**Vec<models::DocumentUploadRequest>**](DocumentUploadRequest.md)> | | [optional]
**trusted_contact** | Option<[**models::TrustedContact**](TrustedContact.md)> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,15 @@
# AccountDocument
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | [**uuid::Uuid**](uuid::Uuid.md) | |
**document_type** | [**models::DocumentType**](DocumentType.md) | |
**document_sub_type** | Option<**String**> | | [optional]
**mime_type** | Option<**String**> | | [optional]
**created_at** | **String** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,29 @@
# AccountExtended
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | [**uuid::Uuid**](uuid::Uuid.md) | |
**account_number** | Option<**String**> | |
**status** | [**models::AccountStatus**](AccountStatus.md) | |
**crypto_status** | Option<[**models::AccountStatus**](AccountStatus.md)> | | [optional]
**kyc_result** | Option<[**models::KycResult**](KYCResult.md)> | | [optional]
**currency** | **String** | Always \"USD\" |
**last_equity** | **String** | |
**created_at** | **String** | |
**contact** | Option<[**models::Contact**](Contact.md)> | | [optional]
**identity** | Option<[**models::Identity**](Identity.md)> | | [optional]
**disclosures** | Option<[**models::Disclosures**](Disclosures.md)> | | [optional]
**agreements** | Option<[**Vec<models::Agreement>**](Agreement.md)> | | [optional]
**documents** | Option<[**Vec<models::ApplicationDocument>**](ApplicationDocument.md)> | | [optional]
**trusted_contact** | Option<[**models::TrustedContact**](TrustedContact.md)> | | [optional]
**account_name** | Option<**String**> | | [optional]
**account_type** | [**models::AccountType**](AccountType.md) | |
**custodial_account_type** | Option<**String**> | \"UGMA\" or \"UTMA\" only used when account_type is \"custodial\" | [optional]
**minor_identity** | Option<[**models::CustodialAccountMinorIdentity**](CustodialAccountMinorIdentity.md)> | | [optional]
**trading_configurations** | Option<[**models::AccountConfigurations**](AccountConfigurations.md)> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,31 @@
# AccountStatus
## Enum Variants
| Name | Value |
|---- | -----|
| Onboarding | ONBOARDING |
| Submitted | SUBMITTED |
| Resubmitted | RESUBMITTED |
| SubmissionFailed | SUBMISSION_FAILED |
| ActionRequired | ACTION_REQUIRED |
| Edited | EDITED |
| AccountUpdated | ACCOUNT_UPDATED |
| ApprovalPending | APPROVAL_PENDING |
| ReapprovalPending | REAPPROVAL_PENDING |
| SignedUp | SIGNED_UP |
| KycSubmitted | KYC_SUBMITTED |
| Limited | LIMITED |
| AmlReview | AML_REVIEW |
| Approved | APPROVED |
| Rejected | REJECTED |
| Active | ACTIVE |
| Disabled | DISABLED |
| DisablePending | DISABLE_PENDING |
| AccountClosed | ACCOUNT_CLOSED |
| PaperOnly | PAPER_ONLY |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,18 @@
# AccountStatusEvent
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**account_id** | **String** | |
**account_number** | **String** | |
**status_from** | [**models::AccountStatus**](AccountStatus.md) | |
**status_to** | [**models::AccountStatus**](AccountStatus.md) | |
**reason** | **String** | Optional |
**at** | **String** | Timestamp of event |
**kyc_result** | Option<[**models::KycResult**](KYCResult.md)> | | [optional]
**event_id** | **i32** | monotonically increasing 64bit integer |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,14 @@
# AccountType
## Enum Variants
| Name | Value |
|---- | -----|
| Trading | trading |
| Custodial | custodial |
| DonorAdvised | donor_advised |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,14 @@
# AccountUpdateRequest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**contact** | Option<[**models::Contact**](Contact.md)> | | [optional]
**identity** | Option<[**models::Identity**](Identity.md)> | | [optional]
**disclosures** | Option<[**models::Disclosures**](Disclosures.md)> | | [optional]
**trusted_contact** | Option<[**models::TrustedContact**](TrustedContact.md)> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,632 @@
# \AccountsApi
All URIs are relative to *https://broker-api.sandbox.alpaca.markets*
Method | HTTP request | Description
------------- | ------------- | -------------
[**create_account**](AccountsApi.md#create_account) | **POST** /v1/accounts | Create an account
[**create_ach_relationship_for_account**](AccountsApi.md#create_ach_relationship_for_account) | **POST** /v1/accounts/{account_id}/ach_relationships | Create an ACH Relationship
[**create_recipient_bank**](AccountsApi.md#create_recipient_bank) | **POST** /v1/accounts/{account_id}/recipient_banks | Create a Bank Relationship for an account
[**create_transfer_for_account**](AccountsApi.md#create_transfer_for_account) | **POST** /v1/accounts/{account_id}/transfers | Request a new transfer
[**delete_account**](AccountsApi.md#delete_account) | **DELETE** /v1/accounts/{account_id} | Request to close an account
[**delete_ach_relationship_from_account**](AccountsApi.md#delete_ach_relationship_from_account) | **DELETE** /v1/accounts/{account_id}/ach_relationships/{ach_relationship_id} | Delete an existing ACH relationship
[**delete_recipient_bank**](AccountsApi.md#delete_recipient_bank) | **DELETE** /v1/accounts/{account_id}/recipient_banks/{bank_id} | Delete a Bank Relationship for an account
[**delete_transfer**](AccountsApi.md#delete_transfer) | **DELETE** /v1/accounts/{account_id}/transfers/{transfer_id} | Request to close a transfer
[**get_account**](AccountsApi.md#get_account) | **GET** /v1/accounts/{account_id} | Get an account by Id.
[**get_account_ach_relationships**](AccountsApi.md#get_account_ach_relationships) | **GET** /v1/accounts/{account_id}/ach_relationships | Retrieve ACH Relationships for an account
[**get_account_activities**](AccountsApi.md#get_account_activities) | **GET** /v1/accounts/activities | Retrieve account activities
[**get_account_activities_by_type**](AccountsApi.md#get_account_activities_by_type) | **GET** /v1/accounts/activities/{activity_type} | Retrieve specific account activities
[**get_all_accounts**](AccountsApi.md#get_all_accounts) | **GET** /v1/accounts | Get all accounts
[**get_recipient_banks**](AccountsApi.md#get_recipient_banks) | **GET** /v1/accounts/{account_id}/recipient_banks | Retrieve bank relationships for an account
[**get_trading_account**](AccountsApi.md#get_trading_account) | **GET** /v1/trading/accounts/{account_id}/account | Retrieve trading details for an account.
[**get_transfers_for_account**](AccountsApi.md#get_transfers_for_account) | **GET** /v1/accounts/{account_id}/transfers | Return a list of transfers for an account.
[**patch_account**](AccountsApi.md#patch_account) | **PATCH** /v1/accounts/{account_id} | Update an account
[**suscribe_to_account_status_sse**](AccountsApi.md#suscribe_to_account_status_sse) | **GET** /v1/events/accounts/status | Subscribe to account status events (SSE).
[**upload_doc_to_account**](AccountsApi.md#upload_doc_to_account) | **POST** /v1/accounts/{account_id}/documents/upload | Upload a document to an already existing account
## create_account
> models::Account create_account(account_creation_request)
Create an account
Submit an account application with KYC information. This will create a trading account for the end user. The account status may or may not be ACTIVE immediately and you will receive account status updates on the event API.
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**account_creation_request** | [**AccountCreationRequest**](AccountCreationRequest.md) | | [required] |
### Return type
[**models::Account**](Account.md)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## create_ach_relationship_for_account
> models::AchRelationship create_ach_relationship_for_account(account_id, create_ach_relationship_request)
Create an ACH Relationship
Create a new ACHRelationship for an account If successful, will return 200 code with a newly created ACH Relationship entity.
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**account_id** | **uuid::Uuid** | Account identifier. | [required] |
**create_ach_relationship_request** | [**CreateAchRelationshipRequest**](CreateAchRelationshipRequest.md) | Create ACH Relationship | [required] |
### Return type
[**models::AchRelationship**](ACHRelationship.md)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## create_recipient_bank
> models::Bank create_recipient_bank(account_id, create_bank_request)
Create a Bank Relationship for an account
If successful, retrieves Bank Relationships for an account
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**account_id** | **uuid::Uuid** | Account identifier. | [required] |
**create_bank_request** | [**CreateBankRequest**](CreateBankRequest.md) | | [required] |
### Return type
[**models::Bank**](Bank.md)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## create_transfer_for_account
> models::Transfer create_transfer_for_account(account_id, create_transfer_request)
Request a new transfer
Create a new transfer to an account to fund it. In the sandbox environment, you can instantly deposit to or withdraw from an account with a virtual money amount. In the production environment, this endpoint is used only for requesting an outgoing (withdrawal) wire transfer at this moment. For the wire transfer (in production), you need to create a bank resource first using the Bank API. For more on how to fund an account in sandbox please check out this tutorial [here](https://alpaca.markets/learn/fund-broker-api/).
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**account_id** | **uuid::Uuid** | Account identifier. | [required] |
**create_transfer_request** | [**CreateTransferRequest**](CreateTransferRequest.md) | | [required] |
### Return type
[**models::Transfer**](Transfer.md)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## delete_account
> delete_account(account_id)
Request to close an account
This operation closes an active account.
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**account_id** | **uuid::Uuid** | Account identifier. | [required] |
### Return type
(empty response body)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## delete_ach_relationship_from_account
> delete_ach_relationship_from_account(account_id, ach_relationship_id)
Delete an existing ACH relationship
Delete an existing ACH relationship for an account
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**account_id** | **uuid::Uuid** | Account identifier. | [required] |
**ach_relationship_id** | **uuid::Uuid** | ACH relationship identifier | [required] |
### Return type
(empty response body)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## delete_recipient_bank
> delete_recipient_bank(account_id, bank_id)
Delete a Bank Relationship for an account
If successful, deletes Bank Relationship for an account
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**account_id** | **uuid::Uuid** | Account identifier. | [required] |
**bank_id** | **uuid::Uuid** | | [required] |
### Return type
(empty response body)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## delete_transfer
> delete_transfer(account_id, transfer_id)
Request to close a transfer
Request to close a transfer
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**account_id** | **uuid::Uuid** | Account identifier. | [required] |
**transfer_id** | **uuid::Uuid** | Tranfer identifier | [required] |
### Return type
(empty response body)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## get_account
> models::AccountExtended get_account(account_id)
Get an account by Id.
You can query a specific account that you submitted to Alpaca by passing into the query the account_id associated with the account youre retrieving.
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**account_id** | **uuid::Uuid** | Account identifier. | [required] |
### Return type
[**models::AccountExtended**](AccountExtended.md)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## get_account_ach_relationships
> Vec<models::AchRelationship> get_account_ach_relationships(account_id, statuses)
Retrieve ACH Relationships for an account
Returns a list of ACH Relationships for an account
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**account_id** | **uuid::Uuid** | Account identifier. | [required] |
**statuses** | Option<**String**> | Comma-separated status values | |
### Return type
[**Vec<models::AchRelationship>**](ACHRelationship.md)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## get_account_activities
> Vec<models::Activity> get_account_activities(account_id, date, until, after, direction, page_size, page_token)
Retrieve account activities
Returns an array of Activities Notes: * Pagination is handled using the `page_token` and `page_size` parameters. * `page_token` represents the ID of the end of your current page of results. for example if in your first response the id of the last Activiy item returned in the array was `20220203000000000::045b3b8d-c566-4bef-b741-2bf598dd6ae7`, you'd pass that value as `page_token` to get the next page of results * If specified with a `direction` of `desc`, for example, the results will end before the activity with the specified ID. * If specified with a `direction` of `asc`, results will begin with the activity immediately after the one specified. * `page_size` is the maximum number of entries to return in the response. * If `date` is not specified, the default and maximum value is 100. * If `date` is specified, the default behavior is to return all results, and there is no maximum page size.
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**account_id** | Option<**uuid::Uuid**> | id of a single account to filter by | |
**date** | Option<**String**> | Both formats YYYY-MM-DD and YYYY-MM-DDTHH:MM:SSZ supported. | |
**until** | Option<**String**> | Both formats YYYY-MM-DD and YYYY-MM-DDTHH:MM:SSZ supported. | |
**after** | Option<**String**> | Both formats YYYY-MM-DD and YYYY-MM-DDTHH:MM:SSZ supported. Cannot be used with date. | |
**direction** | Option<**String**> | The chronological order of response based on the submission time. asc or desc. Defaults to desc. | |
**page_size** | Option<**i32**> | The maximum number of entries to return in the response | |[default to 100]
**page_token** | Option<**String**> | The Activity ID of the end of your current page of results. | |
### Return type
[**Vec<models::Activity>**](Activity.md)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## get_account_activities_by_type
> Vec<models::Activity> get_account_activities_by_type(activity_type, account_id, date, until, after, direction, page_size, page_token)
Retrieve specific account activities
Retrieves an Array of Activies by type Notes: * Pagination is handled using the `page_token` and `page_size` parameters. * `page_token` represents the ID of the end of your current page of results. for example if in your first response the id of the last Activiy item returned in the array was `20220203000000000::045b3b8d-c566-4bef-b741-2bf598dd6ae7`, you'd pass that value as `page_token` to get the next page of results * If specified with a `direction` of `desc`, for example, the results will end before the activity with the specified ID. * If specified with a `direction` of `asc`, results will begin with the activity immediately after the one specified. * `page_size` is the maximum number of entries to return in the response. * If `date` is not specified, the default and maximum value is 100. * If `date` is specified, the default behavior is to return all results, and there is no maximum page size.
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**activity_type** | **String** | see ActivityType model for details about what the different types mean | [required] |
**account_id** | Option<**uuid::Uuid**> | id of a single account to filter by | |
**date** | Option<**String**> | Both formats YYYY-MM-DD and YYYY-MM-DDTHH:MM:SSZ supported. | |
**until** | Option<**String**> | Both formats YYYY-MM-DD and YYYY-MM-DDTHH:MM:SSZ supported. | |
**after** | Option<**String**> | Both formats YYYY-MM-DD and YYYY-MM-DDTHH:MM:SSZ supported. | |
**direction** | Option<**String**> | The chronological order of response based on the submission time. asc or desc. Defaults to desc. | |
**page_size** | Option<**i32**> | The maximum number of entries to return in the response | |[default to 100]
**page_token** | Option<**String**> | The ID of the end of your current page of results | |
### Return type
[**Vec<models::Activity>**](Activity.md)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## get_all_accounts
> Vec<models::Account> get_all_accounts(query, created_after, created_before, status, sort, entities)
Get all accounts
Retrieves all accounts found by the query'
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**query** | Option<**String**> | Pass space-delimited tokens. The response will contain accounts that match with each of the tokens (logical AND). A match means the token is present in either the accounts associated account number, phone number, name, or e-mail address (logical OR). | |
**created_after** | Option<**String**> | | |
**created_before** | Option<**String**> | | |
**status** | Option<**String**> | See the AccountStatus model for values | |
**sort** | Option<**String**> | The chronological order of response based on the submission time. asc or desc. Defaults to desc. | |
**entities** | Option<**String**> | Comma-delimited entity names to include in the response | |
### Return type
[**Vec<models::Account>**](Account.md)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## get_recipient_banks
> Vec<models::Bank> get_recipient_banks(account_id, status, bank_name)
Retrieve bank relationships for an account
Retrieves Bank Relationships for an account
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**account_id** | **uuid::Uuid** | Account identifier. | [required] |
**status** | Option<**String**> | | |
**bank_name** | Option<**String**> | | |
### Return type
[**Vec<models::Bank>**](Bank.md)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## get_trading_account
> models::TradeAccount get_trading_account(account_id)
Retrieve trading details for an account.
As a broker you can view more trading details about your users. The response is a Trading Account model.
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**account_id** | **uuid::Uuid** | Account identifier. | [required] |
### Return type
[**models::TradeAccount**](TradeAccount.md)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## get_transfers_for_account
> Vec<models::Transfer> get_transfers_for_account(account_id, direction, limit, offset)
Return a list of transfers for an account.
You can query a list of transfers for an account. You can filter requested transfers by values such as direction and status.
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**account_id** | **uuid::Uuid** | Account identifier. | [required] |
**direction** | Option<**String**> | INCOMING or OUTGOING | |
**limit** | Option<**i32**> | | |
**offset** | Option<**i32**> | | |
### Return type
[**Vec<models::Transfer>**](Transfer.md)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## patch_account
> models::AccountExtended patch_account(account_id, account_update_request)
Update an account
This operation updates account information. If all parameters are valid and updates have been made, it returns with status code 200. The response is the account model.
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**account_id** | **uuid::Uuid** | Account identifier. | [required] |
**account_update_request** | [**AccountUpdateRequest**](AccountUpdateRequest.md) | | [required] |
### Return type
[**models::AccountExtended**](AccountExtended.md)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## suscribe_to_account_status_sse
> Vec<models::AccountStatusEvent> suscribe_to_account_status_sse(since, until, since_id, until_id)
Subscribe to account status events (SSE).
Events API provide event push as well as historical queries via SSE (server sent events). Historical events are streamed immediately if queried, and updates are pushed as events occur. Query Params Rules: - `since` required if `until` specified - `since_id` required if `until_id` specified - `since` and `since_id` cant be used at the same time Behavior: - if `since` or `since_id` not specified this will not return any historic data - if `until` or `until_id` reached stream will end (status 200) --- Note for people using the clients generated from this OAS spec. Currently OAS-3 doesn't have full support for representing SSE style responses from an API, so if you are using a generated client and don't specify a `since` and `until` there is a good chance the generated clients will hang waiting for the response to end. If you require the streaming capabilities we recommend not using the generated clients for this specific usecase until the OAS-3 standards come to a consensus on how to represent this correcting in OAS-3.
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**since** | Option<**String**> | Format: YYYY-MM-DD | |
**until** | Option<**String**> | Format: YYYY-MM-DD | |
**since_id** | Option<**i32**> | | |
**until_id** | Option<**i32**> | | |
### Return type
[**Vec<models::AccountStatusEvent>**](AccountStatusEvent.md)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/event-stream
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## upload_doc_to_account
> upload_doc_to_account(account_id, document_upload_request)
Upload a document to an already existing account
Upload a document to be attached to an account. Documents are binary objects whose contents are encoded in base64. Each encoded content size is limited to 10MB if you use Alpaca for KYCaaS. If you perform your own KYC there are no document size limitations.
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**account_id** | **uuid::Uuid** | Account identifier. | [required] |
**document_upload_request** | [**DocumentUploadRequest**](DocumentUploadRequest.md) | | [required] |
### Return type
(empty response body)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View file

@ -0,0 +1,20 @@
# AchRelationship
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | [**uuid::Uuid**](uuid::Uuid.md) | |
**created_at** | **String** | Format: 2020-01-01T01:01:01Z |
**updated_at** | **String** | Format: 2020-01-01T01:01:01Z |
**account_id** | [**uuid::Uuid**](uuid::Uuid.md) | |
**status** | **String** | |
**account_owner_name** | **String** | Name of the account owner |
**bank_account_type** | Option<**String**> | Must be CHECKING or SAVINGS | [optional]
**bank_account_number** | Option<**String**> | | [optional]
**bank_routing_number** | Option<**String**> | | [optional]
**nickname** | Option<**String**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,28 @@
# Activity
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **String** | |
**account_id** | Option<[**uuid::Uuid**](uuid::Uuid.md)> | | [optional]
**activity_type** | [**models::ActivityType**](ActivityType.md) | |
**transaction_time** | Option<**String**> | Valid only for trading activity types. Null for non-trading activites. | [optional]
**r#type** | Option<**String**> | Valid only for trading activity types. Null for non-trading activites. | [optional]
**price** | Option<**String**> | Valid only for trading activity types. Null for non-trading activites. | [optional]
**qty** | Option<**String**> | Valid only for non-trading activity types. Null for trading activites. | [optional]
**side** | Option<[**models::OrderSide**](OrderSide.md)> | | [optional]
**symbol** | Option<**String**> | Valid only for non-trading activity types. Null for trading activites. | [optional]
**leaves_qty** | Option<**String**> | Valid only for trading activity types. Null for non-trading activites. | [optional]
**order_id** | Option<[**uuid::Uuid**](uuid::Uuid.md)> | Valid only for trading activity types. Null for non-trading activites. | [optional]
**cum_qty** | Option<**String**> | Valid only for trading activity types. Null for non-trading activites. | [optional]
**order_status** | Option<[**models::OrderStatus**](OrderStatus.md)> | | [optional]
**date** | Option<[**String**](string.md)> | Valid only for non-trading activity types. Null for trading activites. | [optional]
**net_amount** | Option<**String**> | Valid only for non-trading activity types. Null for trading activites. | [optional]
**description** | Option<**String**> | Valid only for non-trading activity types. Null for trading activites. | [optional]
**status** | Option<**String**> | Valid only for non-trading activity types. Null for trading activites. | [optional]
**per_share_amount** | Option<**String**> | Valid only for non-trading activity types. Null for trading activites. | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,25 @@
# ActivityItem
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**transaction_time** | Option<**String**> | Valid only for trading activity types. Null for non-trading activites. | [optional]
**r#type** | Option<**String**> | Valid only for trading activity types. Null for non-trading activites. | [optional]
**price** | Option<**String**> | Valid only for trading activity types. Null for non-trading activites. | [optional]
**qty** | Option<**String**> | Valid only for non-trading activity types. Null for trading activites. | [optional]
**side** | Option<[**models::OrderSide**](OrderSide.md)> | | [optional]
**symbol** | Option<**String**> | Valid only for non-trading activity types. Null for trading activites. | [optional]
**leaves_qty** | Option<**String**> | Valid only for trading activity types. Null for non-trading activites. | [optional]
**order_id** | Option<[**uuid::Uuid**](uuid::Uuid.md)> | Valid only for trading activity types. Null for non-trading activites. | [optional]
**cum_qty** | Option<**String**> | Valid only for trading activity types. Null for non-trading activites. | [optional]
**order_status** | Option<[**models::OrderStatus**](OrderStatus.md)> | | [optional]
**date** | Option<[**String**](string.md)> | Valid only for non-trading activity types. Null for trading activites. | [optional]
**net_amount** | Option<**String**> | Valid only for non-trading activity types. Null for trading activites. | [optional]
**description** | Option<**String**> | Valid only for non-trading activity types. Null for trading activites. | [optional]
**status** | Option<**String**> | Valid only for non-trading activity types. Null for trading activites. | [optional]
**per_share_amount** | Option<**String**> | Valid only for non-trading activity types. Null for trading activites. | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,32 @@
# ActivityType
## Enum Variants
| Name | Value |
|---- | -----|
| Fill | FILL |
| Acatc | ACATC |
| Acats | ACATS |
| Cil | CIL |
| Csd | CSD |
| Csw | CSW |
| Div | DIV |
| Divcgl | DIVCGL |
| Divcgs | DIVCGS |
| Divnra | DIVNRA |
| Divroc | DIVROC |
| Divtxex | DIVTXEX |
| Fee | FEE |
| Int | INT |
| Jnlc | JNLC |
| Jnls | JNLS |
| Ma | MA |
| Ptc | PTC |
| Reorg | REORG |
| Spin | SPIN |
| Split | SPLIT |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,14 @@
# Agreement
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**agreement** | [**models::AgreementType**](AgreementType.md) | |
**signed_at** | **String** | |
**ip_address** | **String** | |
**revision** | Option<**String**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,15 @@
# AgreementType
## Enum Variants
| Name | Value |
|---- | -----|
| MarginAgreement | margin_agreement |
| AccountAgreement | account_agreement |
| CustomerAgreement | customer_agreement |
| CryptoAgreement | crypto_agreement |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,25 @@
# Announcement
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **String** | ID that is specific to a single announcement. |
**corporate_action_id** | **String** | ID that remains consistent across all announcements for the same corporate action. Unlike id, this can be used to connect multiple announcements to see how the terms have changed throughout the lifecycle of the corporate action event. |
**ca_type** | [**models::AnnouncementCaType**](AnnouncementCAType.md) | |
**ca_sub_type** | [**models::AnnouncementCaSubType**](AnnouncementCASubType.md) | |
**initiating_symbol** | **String** | Symbol of the company initiating the announcement. |
**initiating_original_cusip** | **String** | CUSIP of the company initiating the announcement. |
**target_symbol** | Option<**String**> | Symbol of the child company involved in the announcement. |
**target_original_cusip** | Option<**String**> | CUSIP of the child company involved in the announcement. |
**declaration_date** | **String** | Date the corporate action or subsequent terms update was announced. |
**ex_date** | Option<**String**> | The first date that purchasing a security will not result in a corporate action entitlement. |
**record_date** | Option<**String**> | The date an account must hold a settled position in the security in order to receive the corporate action entitlement. |
**payable_date** | **String** | The date the announcement will take effect. On this date, account stock and cash balances are expected to be processed accordingly. |
**cash** | Option<**String**> | The amount of cash to be paid per share held by an account on the record date. |
**old_rate** | Option<**String**> | The denominator to determine any quantity change ratios in positions. |
**new_rate** | Option<**String**> | The numerator to determine any quantity change ratios in positions. |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,20 @@
# AnnouncementCaSubType
## Enum Variants
| Name | Value |
|---- | -----|
| Cash | cash |
| Stock | stock |
| MergerUpdate | merger_update |
| MergerCompletion | merger_completion |
| StockSplit | stock_split |
| UntilSplit | until_split |
| ReverseSplit | reverse_split |
| Recapitalization | recapitalization |
| Spinoff | spinoff |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,15 @@
# AnnouncementCaType
## Enum Variants
| Name | Value |
|---- | -----|
| Dividend | dividend |
| Merger | merger |
| Split | split |
| Spinoff | spinoff |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,15 @@
# ApplicationDocument
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | [**uuid::Uuid**](uuid::Uuid.md) | |
**document_type** | [**models::DocumentType**](DocumentType.md) | |
**document_sub_type** | Option<**String**> | | [optional]
**mime_type** | Option<**String**> | | [optional]
**created_at** | **String** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,24 @@
# Asset
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | [**uuid::Uuid**](uuid::Uuid.md) | Asset ID |
**class** | [**models::AssetClass**](AssetClass.md) | |
**exchange** | Option<[**models::Exchange**](Exchange.md)> | | [optional]
**symbol** | **String** | The symbol of the asset |
**name** | Option<**String**> | The official name of the asset | [optional]
**status** | Option<**String**> | active or inactive | [optional]
**tradable** | Option<**bool**> | Asset is tradable on Alpaca or not | [optional]
**marginable** | Option<**bool**> | Asset is marginable or not | [optional]
**shortable** | Option<**bool**> | Asset is shortable or not | [optional]
**easy_to_borrow** | Option<**bool**> | Asset is easy-to-borrow or not (filtering for easy_to_borrow = True is the best way to check whether the name is currently available to short at Alpaca). | [optional]
**fractionable** | Option<**bool**> | Asset is fractionable or not | [optional]
**last_close_pct_change** | Option<**String**> | Percent change for the trading day as of last market closure. NOTE: This field is currently in this spec however it may not be present in the production environment at time of publishing. It will be coming in a future update at which point this spec should be updated. | [optional]
**last_price** | Option<**String**> | Most recent available price for this asset on the market. NOTE: This field is currently in this spec however it may not be present in the production environment at time of publishing. It will be coming in a future update at which point this spec should be updated. | [optional]
**last_close** | Option<**String**> | Last price of the asset upon market closure on the most recent trading day. NOTE: This field is currently in this spec however it may not be present in the production environment at time of publishing. It will be coming in a future update at which point this spec should be updated. | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,13 @@
# AssetClass
## Enum Variants
| Name | Value |
|---- | -----|
| UsEquity | us_equity |
| Crypto | crypto |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,71 @@
# \AssetsApi
All URIs are relative to *https://broker-api.sandbox.alpaca.markets*
Method | HTTP request | Description
------------- | ------------- | -------------
[**get_asset_by_symbol_or_id**](AssetsApi.md#get_asset_by_symbol_or_id) | **GET** /v1/assets/{symbol_or_asset_id} | Retrieve an asset by UUID
[**get_assets**](AssetsApi.md#get_assets) | **GET** /v1/assets | Retrieve all assets
## get_asset_by_symbol_or_id
> models::Asset get_asset_by_symbol_or_id(symbol_or_asset_id)
Retrieve an asset by UUID
Returns the requested asset, if found
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**symbol_or_asset_id** | **String** | you can use either the asset's Id or the symbol to search | [required] |
### Return type
[**models::Asset**](Asset.md)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## get_assets
> Vec<models::Asset> get_assets(status, asset_class)
Retrieve all assets
Returns all assets
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**status** | Option<**String**> | Asset status to filter by, will default to `all` | |[default to all]
**asset_class** | Option<**String**> | Asset class to filter by, `us_equity` or `crypto`. Defaults to `us_equity` | |[default to us_equity]
### Return type
[**Vec<models::Asset>**](Asset.md)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View file

@ -0,0 +1,14 @@
# AuthorizeOAuthTokenResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**code** | **String** | OAuth code to exchange with token |
**client_id** | **String** | OAuth `client_id` |
**redirect_uri** | **String** | Redirect URI of OAuth flow |
**scope** | **String** | Granted scopes |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,24 @@
# Bank
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | [**uuid::Uuid**](uuid::Uuid.md) | |
**created_at** | **String** | Format: 2020-01-01T01:01:01Z |
**updated_at** | **String** | Format: 2020-01-01T01:01:01Z |
**account_id** | Option<[**uuid::Uuid**](uuid::Uuid.md)> | | [optional]
**status** | Option<**String**> | QUEUED, SENT_TO_CLEARING, APPROVED, CANCELED | [optional]
**name** | **String** | Name of recipient bank |
**bank_code** | **String** | 9-Digit ABA RTN (Routing Number) or BIC |
**bank_code_type** | **String** | ABA (Domestic) or BIC (International) |
**country** | Option<**String**> | Only for international banks | [optional]
**state_province** | Option<**String**> | Only for international banks | [optional]
**postal_code** | Option<**String**> | Only for international banks | [optional]
**city** | Option<**String**> | Only for international banks | [optional]
**street_address** | Option<**String**> | Only for international banks | [optional]
**account_number** | **String** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,14 @@
# BatchJournalRequest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**entry_type** | **String** | Only supports `JNLC` for now |
**from_account** | [**uuid::Uuid**](uuid::Uuid.md) | The account id that is the originator of the funds being moved. Most likely is your Sweep Firm Account |
**description** | Option<**String**> | Journal description, gets returned in the response | [optional]
**entries** | [**Vec<models::BatchJournalRequestEntriesInner>**](BatchJournalRequest_entries_inner.md) | An array of objects describing to what accounts you want to move funds into and how much to move into for each account |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,12 @@
# BatchJournalRequestEntriesInner
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**to_account** | [**uuid::Uuid**](uuid::Uuid.md) | The ID of the account that you want to journal funds into |
**amount** | **String** | Journal amount in USD |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,27 @@
# BatchJournalResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | [**uuid::Uuid**](uuid::Uuid.md) | journal ID |
**entry_type** | [**models::JournalEntryType**](JournalEntryType.md) | |
**from_account** | [**uuid::Uuid**](uuid::Uuid.md) | account ID the shares go from |
**to_account** | [**uuid::Uuid**](uuid::Uuid.md) | account ID the shares go to |
**settle_date** | [**String**](string.md) | |
**status** | Option<[**models::JournalStatus**](JournalStatus.md)> | | [optional]
**symbol** | **String** | Only valid for JNLS journals. Null for JNLC. |
**qty** | **String** | Only valid for JNLS journals. Null for JNLC. |
**price** | **String** | Only valid for JNLS journals. Null for JNLC. |
**description** | Option<**String**> | ID the amount goes to. Only valid for JNLC journals. Null for JNLS. | [optional]
**net_amount** | **String** | Only valid for JNLC journals. Null for JNLS. |
**transmitter_name** | Option<**String**> | Only valid for JNLC journals. Null for JNLS. Max 255 characters. | [optional]
**transmitter_account_number** | Option<**String**> | Only valid for JNLC journals. Null for JNLS.max 255 characters | [optional]
**transmitter_address** | Option<**String**> | Only valid for JNLC journals. Null for JNLS.max 255 characters | [optional]
**transmitter_financial_institution** | Option<**String**> | Only valid for JNLC journals. Null for JNLS.max 255 characters | [optional]
**transmitter_timestamp** | Option<**String**> | Only valid for JNLC journals. Null for JNLS. | [optional]
**error_message** | **String** | Description of why this journal transaction failed |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,15 @@
# Calendar
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**date** | [**String**](string.md) | Date string in YYYY-MM-DD format |
**open** | **String** | The time the market opens at on this date in HH:MM format |
**close** | **String** | The time the market closes at on this date in HH:MM format |
**session_open** | Option<**String**> | this field has been deprecated please ignore | [optional]
**session_close** | Option<**String**> | this field has been deprecated please ignore | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,40 @@
# \CalendarApi
All URIs are relative to *https://broker-api.sandbox.alpaca.markets*
Method | HTTP request | Description
------------- | ------------- | -------------
[**query_market_calendar**](CalendarApi.md#query_market_calendar) | **GET** /v1/calendar | Query market calendar
## query_market_calendar
> Vec<models::Calendar> query_market_calendar(start, end)
Query market calendar
The calendar API serves the full list of market days from 1970 to 2029. It can also be queried by specifying a start and/or end time to narrow down the results. In addition to the dates, the response also contains the specific open and close times for the market days, taking into account early closures.
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**start** | Option<**String**> | The first date to retrieve data for. (Inclusive) in YYYY-MM-DD format | |
**end** | Option<**String**> | The last date to retrieve data for. (Inclusive) in YYYY-MM-DD format | |
### Return type
[**Vec<models::Calendar>**](Calendar.md)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View file

@ -0,0 +1,14 @@
# Clock
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**timestamp** | **String** | Current timestamp |
**is_open** | **bool** | Whether the market is open or not |
**next_open** | **String** | Next market open timestamp |
**next_close** | **String** | Next market close timestamp |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,36 @@
# \ClockApi
All URIs are relative to *https://broker-api.sandbox.alpaca.markets*
Method | HTTP request | Description
------------- | ------------- | -------------
[**query_market_clock**](ClockApi.md#query_market_clock) | **GET** /v1/clock | Query market clock
## query_market_clock
> models::Clock query_market_clock()
Query market clock
The Clock API serves the current market timestamp, whether or not the market is currently open, as well as the times of the next market open and close.
### Parameters
This endpoint does not need any parameter.
### Return type
[**models::Clock**](Clock.md)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View file

@ -0,0 +1,16 @@
# Contact
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**email_address** | Option<**String**> | | [optional]
**phone_number** | Option<**String**> | with country code, no hyphen or space | [optional]
**street_address** | Option<**Vec<String>**> | | [optional]
**city** | Option<**String**> | | [optional]
**state** | Option<**String**> | | [optional]
**postal_code** | Option<**String**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,44 @@
# \CorporateActionsApi
All URIs are relative to *https://broker-api.sandbox.alpaca.markets*
Method | HTTP request | Description
------------- | ------------- | -------------
[**get_corporate_announcements**](CorporateActionsApi.md#get_corporate_announcements) | **GET** /v1/corporate_actions/announcements | Retrieving Announcements
## get_corporate_announcements
> Vec<models::Announcement> get_corporate_announcements(ca_types, since, until, symbol, cusip, date_type)
Retrieving Announcements
This enables searching for an array of corporate action announcements based on criteria.
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**ca_types** | **String** | A comma-delimited list of CorporateActionType values | [required] |
**since** | **String** | The start (inclusive) of the date range when searching corporate action announcements. This should follow the YYYY-MM-DD format. The date range is limited to 90 days. | [required] |
**until** | **String** | The end (inclusive) of the date range when searching corporate action announcements. This should follow the YYYY-MM-DD format. The date range is limited to 90 days. | [required] |
**symbol** | Option<**String**> | The symbol of the company initiating the announcement. | |
**cusip** | Option<**String**> | The CUSIP of the company initiating the announcement. | |
**date_type** | Option<**String**> | An emum of possible ways to use the `since` and `until` parameters to search by. the types are: - **declaration_date**: The date of the preliminary announcement details or the date that any subsequent term updates took place. - **ex_date**: The date on which any security purchasing activity will not result in a corporate action entitlement. Any selling activity that takes place on or after this date will result in a corporate action entitlement. - **record_date**: The date the company checks its records to determine who is shareholder in order to allocate entitlements. - **payable_date**: The date that the stock and cash positions will update according to the account positions as of the record date. | |
### Return type
[**Vec<models::Announcement>**](Announcement.md)
### Authorization
[BasicAuth](../README.md#BasicAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View file

@ -0,0 +1,16 @@
# CreateAchRelationshipRequest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**account_owner_name** | **String** | |
**bank_account_type** | **String** | Must be CHECKING or SAVINGS |
**bank_account_number** | **String** | In sandbox, this still must be a valid format |
**bank_routing_number** | **String** | In sandbox, this still must be a valid format |
**nickname** | Option<**String**> | | [optional]
**processor_token** | Option<**String**> | If using Plaid, you can specify a Plaid processor token here | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,19 @@
# CreateBankRequest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | Name of recipient bank |
**bank_code** | **String** | 9-Digit ABA RTN (Routing Number) or BIC |
**bank_code_type** | **String** | ABA (Domestic) or BIC (International) |
**country** | Option<**String**> | Only for international banks | [optional]
**state_province** | Option<**String**> | Only for international banks | [optional]
**postal_code** | Option<**String**> | Only for international banks | [optional]
**city** | Option<**String**> | Only for international banks | [optional]
**street_address** | Option<**String**> | Only for international banks | [optional]
**account_number** | **String** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,22 @@
# CreateJournalRequest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**to_account** | [**uuid::Uuid**](uuid::Uuid.md) | The account_id you wish to journal to |
**from_account** | [**uuid::Uuid**](uuid::Uuid.md) | The account_id you wish to journal from |
**entry_type** | [**models::JournalEntryType**](JournalEntryType.md) | |
**amount** | Option<**String**> | Required if `entry_type` = `JNLC` | [optional]
**symbol** | Option<**String**> | Required if `entry_type` = `JNLS` | [optional]
**qty** | Option<**String**> | Required if `entry_type` = `JNLS` | [optional]
**description** | Option<**String**> | Max 1024 characters. Can include fixtures for amounts that are above the transaction limit | [optional]
**transmitter_name** | Option<**String**> | Max 255 characters. See more details about [Travel Rule](https://alpaca.markets/docs/broker/integration/funding/#travel-rule) in our main documentation. | [optional]
**transmitter_account_number** | Option<**String**> | Max 255 characters. See more details about [Travel Rule](https://alpaca.markets/docs/broker/integration/funding/#travel-rule) in our main documentation. | [optional]
**transmitter_address** | Option<**String**> | Max 255 characters. See more details about [Travel Rule](https://alpaca.markets/docs/broker/integration/funding/#travel-rule) in our main documentation. | [optional]
**transmitter_financial_institution** | Option<**String**> | Max 255 characters. See more details about [Travel Rule](https://alpaca.markets/docs/broker/integration/funding/#travel-rule) in our main documentation. | [optional]
**transmitter_timestamp** | Option<**String**> | RFC 3339 format. See more details about [Travel Rule](https://alpaca.markets/docs/broker/integration/funding/#travel-rule) in our main documentation. | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,26 @@
# CreateOrderRequest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**symbol** | **String** | Symbol or asset ID to identify the asset to trade |
**qty** | Option<**String**> | Number of shares to trade. Can be fractionable for only market and day order types. | [optional]
**notional** | Option<**String**> | Dollar amount to trade. Cannot work with qty. Can only work for market order types and time_in_force = day. | [optional]
**side** | [**models::OrderSide**](OrderSide.md) | |
**r#type** | [**models::OrderType**](OrderType.md) | |
**time_in_force** | [**models::TimeInForce**](TimeInForce.md) | |
**limit_price** | Option<**String**> | Required if type is limit or stop_limit | [optional]
**stop_price** | Option<**String**> | Required if type is stop or stop_limit | [optional]
**trail_price** | Option<**String**> | If type is trailing_stop, then one of trail_price or trail_percent is required | [optional]
**trail_percent** | Option<**String**> | If type is trailing_stop, then one of trail_price or trail_percent is required | [optional]
**extended_hours** | Option<**bool**> | Defaults to false. If true, order will be eligible to execute in premarket/afterhours. Only works with type limit and time_in_force = day. | [optional]
**client_order_id** | Option<**String**> | A unique identifier for the order. Automatically generated if not sent. (<= 48 characters) | [optional]
**order_class** | Option<[**models::OrderClass**](OrderClass.md)> | | [optional]
**take_profit** | Option<[**models::CreateOrderRequestTakeProfit**](CreateOrderRequest_take_profit.md)> | | [optional]
**stop_loss** | Option<[**models::CreateOrderRequestStopLoss**](CreateOrderRequest_stop_loss.md)> | | [optional]
**commission** | Option<**String**> | The commission you want to collect from the user. | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,12 @@
# CreateOrderRequestStopLoss
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**stop_price** | Option<**String**> | | [optional]
**limit_price** | Option<**String**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,11 @@
# CreateOrderRequestTakeProfit
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**limit_price** | Option<**String**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,17 @@
# CreateTransferRequest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**transfer_type** | [**models::TransferType**](TransferType.md) | |
**relationship_id** | Option<[**uuid::Uuid**](uuid::Uuid.md)> | Required if type = `ach` The ach_relationship created for the account_id [here](https://alpaca.markets/docs/api-references/broker-api/funding/ach/#creating-an-ach-relationship) | [optional]
**bank_id** | Option<[**uuid::Uuid**](uuid::Uuid.md)> | Required if type = `wire` The bank_relationship created for the account_id [here](https://alpaca.markets/docs/api-references/broker-api/funding/bank/#creating-a-new-bank-relationship) | [optional]
**amount** | **String** | Must be > 0.00 |
**direction** | [**models::TransferDirection**](TransferDirection.md) | |
**timing** | [**models::TransferTiming**](TransferTiming.md) | |
**additional_information** | Option<**String**> | Additional details for when type = `wire` | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,12 @@
# CreateWatchlistRequest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | The watchlist name |
**symbols** | **Vec<String>** | The new list of symbol names to watch |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,20 @@
# CustodialAccountMinorIdentity
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**given_name** | **String** | |
**family_name** | **String** | |
**date_of_birth** | [**String**](string.md) | |
**tax_id** | Option<**String**> | | [optional]
**tax_id_type** | Option<[**models::TaxIdType**](TaxIdType.md)> | | [optional]
**country_of_citizenship** | Option<**String**> | | [optional]
**country_of_birth** | Option<**String**> | | [optional]
**country_of_tax_residence** | **String** | |
**state** | **String** | |
**email** | **String** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,19 @@
# DisclosureContextAnnotation
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**context_type** | **String** | Specifies the type of disclosure annotation. Valid types are FINRA affiliations, for users affiliated with or employed by a FINRA member firm, a Stock Exchange Member, FINRA, Registered Investment Advisor, or a Municipal Securities Broker/Dealer; Company control relationships, for senior executives, and 10% or greater shareholders, of a publicly traded company; and immediate family members of politically exposed individuals. |
**company_name** | Option<**String**> | Required for FINRA affiliations and controlled firms. | [optional]
**company_street_address** | Option<**String**> | Required for FINRA affiliations and controlled firms. | [optional]
**company_city** | Option<**String**> | Required for FINRA affiliations and controlled firms. | [optional]
**company_state** | Option<**String**> | Required if and only if `company_country` is `USA`. | [optional]
**company_country** | Option<**String**> | Required for FINRA affiliations and controlled firms. | [optional]
**company_compliance_email** | Option<**String**> | Required for FINRA affiliations and controlled firms. | [optional]
**given_name** | Option<**String**> | Required for immediate family members of politically exposed persons. | [optional]
**family_name** | Option<**String**> | Required for immediate family members of politically exposed persons. | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,19 @@
# Disclosures
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**employment_status** | Option<**String**> | | [optional]
**employer_name** | Option<**String**> | | [optional]
**employer_address** | Option<**String**> | | [optional]
**employment_position** | Option<**String**> | | [optional]
**is_control_person** | **bool** | |
**is_affiliated_exchange_or_finra** | **bool** | |
**is_politically_exposed** | **bool** | |
**immediate_family_exposed** | **bool** | |
**context** | Option<[**Vec<models::DisclosureContextAnnotation>**](DisclosureContextAnnotation.md)> | Array of annotations describing the rational for marking `is_control_person`, `is_affiliated_exchange_or_finra`, and/or `immediate_family_exposed` as true | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View file

@ -0,0 +1,13 @@
# DocumentInner
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**document_id** | [**uuid::Uuid**](uuid::Uuid.md) | |
**document_type** | [**models::DocumentType**](DocumentType.md) | |
**document_date** | **String** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Some files were not shown because too many files have changed in this diff Show more