Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
94 changes: 94 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Connectors CI/CD

on:
pull_request:
branches-ignore:
- rc-**
workflow_dispatch:

jobs:
detect-targets:
runs-on: ubuntu-latest
outputs:
modified_targets: ${{ steps.filter.outputs.modified_targets }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Detect modified targets
id: filter
run: |
MODIFIED_TARGETS=()

# Ensure HEAD^ exists
if git rev-parse --verify HEAD^ >/dev/null 2>&1; then
BASE_COMMIT="HEAD^"
else
BASE_COMMIT=$(git rev-list --max-parents=0 HEAD) # First commit
fi

# Check each client dynamically
for client in src/*; do
CLIENT_NAME=$(basename "$client")
[ -d "$client" ] || continue

if ! git diff --quiet "$BASE_COMMIT" HEAD -- "$client"; then
echo "Changes detected in $CLIENT_NAME"
MODIFIED_TARGETS+=("$CLIENT_NAME")
fi
done

# Convert to JSON array format
MODIFIED_TARGETS_JSON=$(printf '%s\n' "${MODIFIED_TARGETS[@]}" | jq -R -s -c 'split("\n") | map(select(. != ""))')

echo "Detected modified targets: $MODIFIED_TARGETS_JSON"
echo "modified_targets=$MODIFIED_TARGETS_JSON" >> $GITHUB_ENV
echo "::set-output name=modified_targets::$MODIFIED_TARGETS_JSON"

build-target:
runs-on: ubuntu-latest
needs: detect-targets
if: ${{ needs.detect-targets.outputs.modified_targets != '[]' }}
strategy:
matrix:
target: ${{ fromJson(needs.detect-targets.outputs.modified_targets) }}
rust-version: [1.86.0]
max-parallel: 1
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Rust ${{ matrix.rust-version }}
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.rust-version }}
components: rustfmt, clippy
rustflags: ""

- name: Cache cargo registry & build
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Format Check
run: |
if [ -d "examples/${{ matrix.target }}" ]; then \
find examples/${{ matrix.target }} -name "*.rs" -exec rustfmt --check -- {} +; \
fi
if [ -d "src/${{ matrix.target }}" ]; then \
find src/${{ matrix.target }} -name "*.rs" -exec rustfmt --check -- {} +; \
fi

- name: Lint Check
run: cargo clippy --all-targets $( [ "${{ matrix.target }}" = "common" ] || echo "--features ${{ matrix.target }}" )

- name: Test
run: cargo test $( [ "${{ matrix.target }}" = "common" ] || echo "--features ${{ matrix.target }} ${{ matrix.target }}" )
63 changes: 63 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Release Rust Connector

on:
push:
branches:
- master
paths:
- 'Cargo.toml'
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Compare versions
id: version
run: |
old_version=$(git show HEAD^:Cargo.toml | grep '^version' | head -1 | sed -E 's/version = "(.*)"/\1/')
new_version=$(grep '^version' Cargo.toml | head -1 | sed -E 's/version = "(.*)"/\1/')

if [ "$old_version" = "$new_version" ]; then
echo "::error ::Version was not bumped in Cargo.toml — skipping release"
exit 1
fi

- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.86.0
components: rustfmt, clippy
rustflags: ""

- name: Cache cargo registry & build
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Run Format
run: |
find examples/ -name "*.rs" -exec rustfmt --check -- {} +
find src/ -name "*.rs" -exec rustfmt --check -- {} +

- name: Run Lint
run: cargo clippy --all-targets --all-features

- name: Run Tests
run: cargo test --all-features

- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish --token $CARGO_REGISTRY_TOKEN
33 changes: 0 additions & 33 deletions .github/workflows/rust.yaml

This file was deleted.

5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rust-analyzer.cargo.allFeatures": true,
"rust-analyzer.cargo.loadOutDirsFromCheck": true,
"rust-analyzer.procMacro.enable": true
}
97 changes: 2 additions & 95 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,98 +1,5 @@
# Changelog

## 1.3.0 - 2024-10-31
### Added
- Market endpoints
- `GET /api/v3/ticker/tradingDay`
- `GET /api/v3/uiKlines`
## 1.0.0 - 2025-06-12

- Trade endpoints
- `GET /api/v3/myAllocations`
- `GET /api/v3/account/commission`
- `GET /api/v3/myPreventedMatches`

- Wallet endpoints
- `GET /sapi/v1/account/info`
- `GET /sapi/v1/asset/wallet/balance`
- `GET /sapi/v1/spot/delist-schedule`
- `GET /sapi/v1/capital/deposit/address/list`
- `POST /sapi/v1/capital/deposit/credit-apply`
- `GET /sapi/v1/asset/custody/transfer-history`

- WebsocketStream:
- `<symbol>@avgPrice`

### Updated
- Updated deprecated trade endpoint `POST /api/v3/order/oco` to `POST /api/v3/orderList/oco`
- Added parameters `permissions`, `showPermissionSets` and `symbolStatus` to endpoint `GET /api/v3/exchangeInfo`
- Added parameter `time_zone` to endpoint `GET /api/v3/klines`
- Added parameter `type` to endpoints `GET /api/v3/ticker` and `GET /api/v3/ticker/24hr`
- Added parameter `omitZeroBalances` to endpoint `GET /api/v3/account`
- Added parameter `computeCommissionRates` to endpoint `POST /api/v3/order/test`
- Updated `ed25519` and `hmac` signature to allow the function to handle any error type that implements the `Error` trait, including `ed25519_dalek::pkcs8::Error`, without needing explicit conversions between error types.

## 1.2.1 - 2024-10-03
### Updated
- Updated url links

## 1.2.0 - 2024-06-26

### Added
- Margin endpoints
- `POST /sapi/v1/margin/borrow-repay`
- `GET /sapi/v1/margin/borrow-repay`
- Implemented subscription from slice of Streams
- Added features `futures-util` and `tokio` to `enable-tokio-tungstenite`
- Enabled `binance_tokio_client` to be used within `async` context and `Tokio::Spawn` runtime

### Updated
- Upgraded following dependencies:
- `strum` to version `0.26.2`
- `base64` to version `0.22.1`
- `tungstenite` to version `0.23.0`
- `env_logger` to version `0.11.3`
- `cargo-audit` to version `0.20.0`
- Margin endpoints
- `GET /sapi/v1/margin/transfer`: add parameter `isolatedSymbol`
- `GET /sapi/v1/margin/allAssets`: add parameter `asset`
- `GET /sapi/v1/margin/allPairs`: add parameter `symbol`
- `GET /sapi/v1/margin/isolated/allPairs`: add parameter `symbol`


### Deleted
- Margin endpoints
- `POST /sapi/v1/margin/transfer`
- `POST /sapi/v1/margin/isolated/transfer`
- `POST /sapi/v1/margin/loan`
- `POST /sapi/v1/margin/repay`
- `GET /sapi/v1/margin/isolated/transfer`
- `GET /sapi/v1/margin/asset`
- `GET /sapi/v1/margin/pair`
- `GET /sapi/v1/margin/isolated/pair`
- `GET /sapi/v1/margin/loan`
- `GET /sapi/v1/margin/repay`
- `GET /sapi/v1/margin/dribblet`
- `GET /sapi/v1/margin/dust`
- `POST /sapi/v1/margin/dust`

## 1.1.0 - 2023-12-21

### Updated
- Remove `rsa` due to Marvin Attack vulnerability
- Add `ed25519` signature
- Upgraded `signature` to version `2.2.0`

## 1.0.2 - 2023-09-28

### Updated
- Upgraded `tungstenite` to version 0.20.1

## 1.0.1 - 2023-06-28

### Added
- Added User-Agent header

## 1.0.0 - 2022-12-06

### Added
- First release of the Binance Spot API connector.
- Initial release.
Loading