Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: d-e-s-o/apca
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.22.4
Choose a base ref
...
head repository: d-e-s-o/apca
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
10 changes: 10 additions & 0 deletions .github/.codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
coverage:
status:
project:
default:
# We don't gate anything based on potentially flaky code
# coverage reports.
informational: true
patch:
default:
informational: true
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (C) 2024 The apca Developers
# SPDX-License-Identifier: GPL-3.0-or-later

# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: github-actions
open-pull-requests-limit: 25
rebase-strategy: auto
directory: /
schedule:
interval: daily
- package-ecosystem: cargo
versioning-strategy: auto
directory: /
schedule:
interval: daily
65 changes: 65 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Copyright (C) 2023-2024 The apca Developers
# SPDX-License-Identifier: GPL-3.0-or-later

name: Publish

on:
workflow_dispatch:

jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
- id: version
shell: bash
run: |
cargo generate-lockfile
pkgid="$(cargo pkgid)"
# Format is typically
# file://<path>/<crate>#<version>
# but could also be along the lines of
# file://<path>/<crate>#<actual-crate-name>@<version>
version="$(echo ${pkgid} | cut -d '#' -f2 | cut -d '@' -f2 | grep -o '[^:]*$')"
if [ -z "${version}" ]; then
echo "Invalid version string: ${pkgid}"
exit 1
fi
echo "Determined crate version: ${version}"
echo "version=${version}" >> $GITHUB_OUTPUT
test:
uses: ./.github/workflows/test.yml
secrets: inherit
publish:
needs: [test, version]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Dry-run package creation
run: cargo package --no-verify
- name: Create git tag
env:
version: ${{ needs.version.outputs.version }}
run: |
curl --location \
--fail-with-body \
--request POST \
--url https://api.github.com/repos/${{ github.repository }}/releases \
--header "Accept: application/vnd.github+json" \
--header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
--header "X-GitHub-Api-Version: 2022-11-28" \
--data "{
\"tag_name\":\"v${version}\",
\"target_commitish\":\"${{ github.ref }}\",
\"name\":\"v${version}\",
\"draft\":false,
\"prerelease\":false,
\"generate_release_notes\":false
}"
- name: Publish
run: cargo publish --no-verify --token "${CARGO_REGISTRY_TOKEN}"
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
112 changes: 112 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Copyright (C) 2022-2024 The apca Developers
# SPDX-License-Identifier: GPL-3.0-or-later

name: Test

on:
pull_request:
push:
branches:
- '**'
- '!dependabot/**'
workflow_call:

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# Build without debug information enabled to decrease compilation time
# and binary sizes in CI. This option is assumed to only have marginal
# effects on the generated code, likely only in terms of section
# arrangement. See
# https://doc.rust-lang.org/cargo/reference/environment-variables.html
# https://doc.rust-lang.org/rustc/codegen-options/index.html#debuginfo
RUSTFLAGS: '-C debuginfo=0'

jobs:
build:
name: Build [${{ matrix.profile }}, ${{ matrix.args }}]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
profile: [dev, release]
args: ['']
include:
- profile: dev
args: --no-default-features
- profile: dev
args: --all-features
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.profile }}-${{ matrix.args }}
- name: Build ${{ matrix.profile }}
run: cargo build --profile=${{ matrix.profile }} --all-targets ${{ matrix.args }}
build-minimum:
name: Build using minimum versions of dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Nightly Rust
uses: dtolnay/rust-toolchain@nightly
- run: cargo +nightly -Z minimal-versions update
- name: Install minimum Rust
uses: dtolnay/rust-toolchain@master
with:
# Please adjust README and rust-version field in Cargo.toml files when
# bumping version.
toolchain: 1.63.0
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --features=vendored-openssl --locked
test:
name: Test and coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- uses: Swatinem/rust-cache@v2
- name: Test and gather coverage
run: cargo llvm-cov --lcov --output-path lcov.info --ignore-filename-regex=src/api/v2/de.rs
env:
APCA_API_KEY_ID: ${{ secrets.APCA_API_KEY_ID }}
APCA_API_SECRET_KEY: ${{ secrets.APCA_API_SECRET_KEY }}
- name: Upload code coverage results
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: lcov.info
clippy:
name: Lint with clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --no-deps --all-targets --all-features -- -A unknown_lints -D warnings
rustfmt:
name: Check code formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo +nightly fmt -- --check
cargo-doc:
name: Generate documentation
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: '-D warnings'
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: |
cargo doc --no-deps
# Explicitly run doc tests as cargo-llvm-cov currently does not.
cargo test --doc
File renamed without changes.
144 changes: 143 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,145 @@
0.30.0
------
- Added `weighted_average` member to `data::v2::bars::Bar` type
- Bumped `hyper` dependency to `1.0`
- Bumped `websocket-util` dependency to `0.14`
- Bumped `tokio-tungstenite` dependency to `0.26`


0.29.0
------
- Renamed various request related types to follow more uniform naming
scheme
- Added `api::v2::{calendar::ListReqInit,watchlist::CreateReqInit}`
types
- Removed `api::v2::{order::ChangeReqInit,assets::ListReqInit}` types in
favor of `Default` impl for corresponding request types
- Made various types non-exhaustive
- Added `name` attribute to `api::v2::watchlist::Watchlist` type
- Added support for updating a watchlist


0.28.0
------
- Removed `ApiError::code` member after endpoint reported errors stopped
returning it
- Renamed `AuthenticationFailed` variant of endpoint errors to
`NotPermitted`
- This variant is now used to signal a multitude of conditions,
including certain order submission issues
- Bumped minimum supported Rust version to `1.63`
- Bumped `websocket-util` dependency to `0.12`
- Bumped `tokio-tungstenite` dependency to `0.20`


0.27.2
------
- Expanded crate documentation with a high level overview
- Bumped `async-compression` dependency to `0.4`


0.27.1
------
- Exported `api::v2::updates::{Authenticate,Listen}` enums as part of
unofficial unstable API


0.27.0
------
- Added support for overwriting default realtime data bar, quote, and
trade types
- Added support for working with custom v2 realtime data streaming URLs
- Added `FillOrKill` and `ImmediateOrCancel` variants to
`api::v2::order::TimeInForce` type
- Changed various `data::v2::stream::{Bar, Quote, Trade}` members from
`u64` to `Num`
- Switched to using new stream authentication request message format
- Adjusted publish workflow to also create GitHub release and Git tag


0.26.2
------
- Introduced `vendored-openssl` to build with vendored `openssl` library
- Added GitHub Actions workflow for publishing the crate


0.26.1
------
- Made more types serializable/deserializable


0.26.0
------
- Added support for historic trade retrieval via `data::v2::trades`
- Adjusted `data::v2::last_quote` module to work with multiple symbols
and renamed it to `last_quotes`
- Added `client_order_id` member to `api::v2::order::ChangeReq`
- Made `quantity` and `time_in_force` members of
`api::v2::order::ChangeReq` optional
- Added `quantity_available` member to `api::v2::position::Position`
- Bumped minimum supported Rust version to `1.59`
- Bumped `websocket-util` dependency to `0.11`
- Bumped `tokio-tungstenite` dependency to `0.18`


0.25.1
------
- Added optional `price` member to
`api::v2::account_activities::NonTradeActivity` type
- Switched to using GitHub Actions as CI provider
- Bumped minimum supported Rust version to `1.57`


0.25.0
------
- Added `gzip` compression support for transparent API response
compression controlled by default enabled `gzip` feature
- Added support for subscribing to realtime trades
- Reworked symbols related types in `data::v2::stream` module
- Added `class` member to `api::v2::order::Order` type
- Added `symbols` member to `api::v2::orders::OrdersReq` type
- Added `Deserialize` implementation for more types
- Updated `ActivityType` enum to be in sync with upstream variants
- Made `api::v2::position::Position` exhaustive
- Bumped `uuid` dependency to `1.0`


0.24.0
------
- Made more types serializable/deserializable
- Renamed various `Trade*` types to `Order*`
- Removed `#[non_exhaustive]` attribute from various types


0.23.0
------
- Added support for subscribing to realtime quotes in addition to
aggregate bar data
- Adjusted data API request types to include optional data feed to use
- Adjusted `data::v2::last_quote::Get` to accept a `LastQuoteReq` object
- Added `Crypto` variant to `api::v2::asset::Class` enum and made it
non-exhaustive
- Added `Otc` variant to `api::v2::asset::Exchange` enum and made it
non-exhaustive
- Introduced `api::v2::order::Status::is_terminal` method
- Replaced infallible `From<Into<String>>` conversion for
`asset::Symbol` with fallible `TryFrom`
- Made members of `ApiInfo` publicly accessible and added more URL
members
- Renamed various 422 HTTP status error variants to `InvalidInput`
- Changed various limit types to `usize`
- Changed `api::v2::orders::OrdersReq::limit` to be an `Option`
- Added example illustrating how to stream realtime market data


0.22.5
------
- Renamed `data::v2::bars::BarReq` to `BarsReq`
- Deprecated `data::v2::bars::BarReq`
- Introduced `data::v2::bars::BarsReqInit` type
- Introduced `ApiInfo::into_parts` method


0.22.4
------
- Adjusted `Subscribable` trait to make all created futures implement
@@ -222,7 +364,7 @@
0.3.1
-----
- Added support for accessing `/v2/account/configurations` endpoint
- Added support for querying `/v1/bars/<timeframe>` endpoint
- Added support for querying `/v1/bars/{timeframe}` endpoint
- Added support for serializing account & trade events
- Switched from using `log` to `tracing` as a logging/tracing provider
- Switched to using `serde_urlencoded` for encoding query parameters
Loading