• Stars
    star
    145
  • Rank 254,144 (Top 6 %)
  • Language
    Rust
  • License
    GNU General Publi...
  • Created over 4 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A crate for interacting with the Alpaca API at alpaca.markets.

pipeline coverage crates.io Docs rustc

apca

apca is a library for interacting with the Alpaca API at alpaca.markets. The crate is entirely written in Rust and exposes a fully async API based on the native async/await language feature.

The crate provides access to the majority of functionality provided by Alpaca, including, but not limited to:

  • inquiring of account information
  • changing of the account configuration
  • retrieving of past account activity
  • accessing the market clock
  • submitting, changing, listing, and canceling orders
  • listing and closing open positions
  • listing and retrieving general asset information
  • streaming of order updates over WebSocket
  • historic market data retrieval through Alpaca's Data API
  • real time market data streaming via Alpaca's websocket API

For convenient command-line based access to the API, please use apcacli.

Usage

The following example illustrates how to create a Client object and then submit a limit order for AAPL with a limit price of USD 100:

let api_info = ApiInfo::from_env().unwrap();
let client = Client::new(api_info);

let request = order::OrderReqInit {
  type_: Type::Limit,
  limit_price: Some(Num::from(100)),
  ..Default::default()
}
.init("AAPL", Side::Buy, order::Amount::quantity(1));

let order = client
  .issue::<order::Post>(&request)
  .await
  .unwrap();

The returned order object can subsequently be inspected to find out details about the order (such as its ID). The full example is available here.

Please refer to the full documentation for more details.

More Repositories

1

test-log

A replacement of the #[test] attribute that initializes logging and/or tracing infrastructure before running tests.
Rust
118
star
2

apcacli

A command line tool for trading stocks on Alpaca (alpaca.markets).
Rust
39
star
3

notnow

A terminal based task and TODO management software.
Rust
31
star
4

nitrocli

A command line tool for interacting with Nitrokey devices.
Rust
30
star
5

cargo-http-registry

A cargo registry allowing for quick publishing of crates when using crates.io is just not desired.
Rust
19
star
6

gui

A generic UI library/framework.
Rust
18
star
7

polyio

A create for interacting with the Polygon API at polygon.io.
Rust
17
star
8

coredump

A crate to force coredump creation on panics.
Rust
15
star
9

serde_variant

Retrieve serde provided variant names for enum objects.
Rust
11
star
10

cell

A replacement of std::cell::RefCell adding advanced support for mapping borrows.
Rust
8
star
11

ssh-gpg-agent

An SSH agent implementation that transparently supports PGP encrypted private SSH keys.
Rust
7
star
12

http-endpoint

A crate providing a declarative way for specifying an HTTP endpoint.
Rust
5
star
13

num-decimal

Infinite precision decimals with fair rounding and other gimmicks based on num-rational.
Rust
4
star
14

git-split

Interactively split a git commit into two or more.
Shell
4
star
15

websocket-util

A crate providing an easy to consume streaming interface for WebSocket data.
Rust
4
star
16

test-tag

The #[tag] attribute for convenient tagging/grouping of #[test] tests.
Rust
4
star
17

btrfs-backup

A program for backup & restoration of btrfs subvolumes.
Rust
3
star
18

git-subrepo

Forget about submodules and subtrees, use a subrepo!
Python
3
star
19

argcomp

A drop-in replacement for Python's argparse module, providing automatic argument completion support.
Python
3
star
20

uid

A crate for the creation of unique IDs.
Rust
3
star
21

debuginfod

A crate for interacting with debuginfod servers.
Rust
3
star
22

tetromino

A graphical Tetris clone.
Rust
2
star
23

conky-calendar

A Conky theme providing a calendar view.
2
star
24

apcaledge

A command line tool for exporting trading activity from Alpaca (alpaca.markets) in a Ledger CLI compatible format.
Rust
2
star
25

neovim-ctrl

A program for controlling a Neovim instance, typically from a tmux environment.
Rust
2
star
26

polycli

A command line application for interacting with the Polygon API at polygon.io.
Rust
2
star
27

git-foreach

Perform a git command on multiple repositories.
Shell
1
star
28

delaunay-triangulation

Delaunay triangulation using an incremental insertion algorithm, implemented in JavaScript.
JavaScript
1
star
29

httpc

An HTTP client working both natively and in WASM environments.
Rust
1
star
30

rbuf

A general purpose ring buffer implementation with some non-standard constraints.
Rust
1
star
31

cformat

Rust
1
star
32

math-util

A crate providing miscellaneous mathematical utility functions.
Rust
1
star
33

pyvenv-auto

Fully automated activation of Python virtual environments.
Shell
1
star
34

nfuzz

A Neovim "remote" plugin enabling fuzzy selection/search operations.
Python
1
star