Crate alpaca_api_client
source ·Expand description
§Alpaca API Client (unofficial)
DO NOT USE IN A SERIOUS PROJECT, NOT LIABLE FOR ANY ISSUES
§Introduction
Alpaca is a trading platform for developers and app makers, and they provide various endpoints to access over http. The goal of this package is to provide the bare minimum tools for using the Alpaca API, and to learn more about open source software building. This is not a batteries included package yet, and still requires a lot of testing.
§Quick Examples
Get bars for a single stock
use alpaca_api_client::get_bars;
let bars = get_bars("BTU", "1Day", Some("start=2023-02-23"));
Get bars for multiple symbols
use alpaca_api_client::get_multi_bars;
let watchlist: [&str; 30] = [
"META", "DIS", "CMCSA", "VZ", "T", "CHTR", "NFLX", "TMUS", "TWTR", "FOXA", "FOX", "DISH",
"CBS", "OMC", "TME", "TTWO", "EA", "ATVI", "ZM", "MTCH", "IAC", "NTES", "BIDU", "ROKU", "SPOT",
"LYV", "IQ", "HUYA", "DOYU", "VIAV",
];
let multi_bars: MultiBars = get_multi_bars(&watchlist, "1Day", Some("start=2022-01-01"));
Place market order
use alpaca_api_client::{place_market_order, OrderSide};
let order = place_market_order("SO", 3.0, OrderSide::Buy);
Structs§
- API object for an Account
- API object for a Bar
- API object for an Order
- API object for a Position
- API object for a Trade
- API object for a TradeActivity
Enums§
- Trend enum
- Buy or Sell
- Possible order statuses
- Timeframe options utility for time frames accepted by alpaca api
Traits§
- Utility methods for interacting with Bars type
Functions§
- Get your account details
- Get bars for a single stock
- Get latest trade for single stock
- Get bars for multiple stocks at a time
- Get latest trade for multiple stocks
- Get multiple trades for multiple stocks
- Get all open positions
- Get order by id
- Get all orders
- Get a open single position by symbol
- Get your recent activity by type
- Get the trades for a specific stock with a query option
- Submit a basic bracket order.
- Submit basic market order
- Submit a One-Triggers-Other for a stop loss order
- Submit a One-Triggers-Other for a take profit order
- Submit a trailing stop order, must have a filled market order for symbol
Type Aliases§
- A custom type for a vector of bars
- A custom type for a hashmap of stock symbols and bars
- A custom type for a hashmap of stock symbols and latest trade objects
- A custom type for a hashmap of stock symbols and trade objects