Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
322cedd
Fixed parsing in get_candle with context for Pocket Option API changes
davidantoon Jul 7, 2025
7fce8fe
Update Cargo.toml
davidantoon Jul 7, 2025
97e145b
Add support for LoadHistoryPeriodFast
frontegg-david Jul 8, 2025
f60a053
Expose get_candles_advanced for retrieve historical by time and offset
frontegg-david Jul 8, 2025
7b14993
Add code suggestion from code review
frontegg-david Jul 8, 2025
cd40441
Add full examples to comments to prevent RustRover IntelliJ syntax er…
frontegg-david Jul 8, 2025
e0ab615
add node_modules and error.log to gitignore
frontegg-david Jul 8, 2025
20d7f4d
Fix jsPublish workflow macos run-on versions to support intel and arm…
frontegg-david Jul 8, 2025
52c7e08
Fix jsPublish workflow macos run-on versions to support intel and arm…
frontegg-david Jul 9, 2025
2958cdd
Merge branch 'ChipaDevTeam:master' into patch-1
davidantoon Jul 9, 2025
2629312
fix branch name
frontegg-david Jul 9, 2025
b8588d9
fix cargo toml
frontegg-david Jul 9, 2025
486070d
Fix cargo toml file
frontegg-david Jul 9, 2025
aae20bf
rename readme file to README.md to fix CI build
frontegg-david Jul 9, 2025
878d054
Add support to trigger js publish workflow
frontegg-david Jul 9, 2025
9078fe1
Update openssl version when targeting armv7
frontegg-david Jul 9, 2025
06d2de3
Fix all readme files name
frontegg-david Jul 9, 2025
2fcf452
Fix ci build
frontegg-david Jul 9, 2025
61a8608
Skip publish if no PyPi api token
frontegg-david Jul 9, 2025
5938c9e
Skip publish if no PyPi api token
frontegg-david Jul 9, 2025
38f284c
Fix openssl for armv7
frontegg-david Jul 9, 2025
33c3bfd
Fix openssl for armv7
frontegg-david Jul 9, 2025
7a50075
Fix openssl for armv7
frontegg-david Jul 9, 2025
05e9fbb
Fix openssl for armv7
frontegg-david Jul 9, 2025
18dee2b
Fix openssl for armv7
frontegg-david Jul 9, 2025
ffa4a70
Fix openssl for armv7
frontegg-david Jul 9, 2025
b4a7680
disable fail fast for testing ci workflow
frontegg-david Jul 9, 2025
4f5f9c1
disable fail fast for testing ci workflow
frontegg-david Jul 9, 2025
21c6269
Ensure all required Perl modules are available for OpenSSL builds
frontegg-david Jul 9, 2025
e7667ce
Ensure all required Perl modules are available for OpenSSL builds
frontegg-david Jul 9, 2025
344351c
Fix CI yaml build
frontegg-david Jul 9, 2025
e0dc909
Fix CI yaml build
frontegg-david Jul 9, 2025
29de217
Fix CI yaml build
frontegg-david Jul 9, 2025
3dc3912
Fix CI yaml build
frontegg-david Jul 9, 2025
cbd4e70
Fix CI yaml build
frontegg-david Jul 9, 2025
75a88fb
Fix CI yaml build
frontegg-david Jul 9, 2025
9988b58
Fix CI yaml build
frontegg-david Jul 9, 2025
e752b58
Merge remote-tracking branch 'origin/master' into patch-1
frontegg-david Jul 9, 2025
fa7f491
Fix CI yaml build
frontegg-david Jul 9, 2025
f4ad01d
Fix CI yaml build
frontegg-david Jul 9, 2025
c3f1a7c
Fix CI yaml build
frontegg-david Jul 9, 2025
eec2d70
Fix CI yaml build
frontegg-david Jul 9, 2025
b0f69c9
Fix v1 history pull
frontegg-david Jul 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 21 additions & 14 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is autogenerated by maturin v1.7.0
# This file is autogenerated by maturin v1.9.1
# To update, run
#
# maturin generate-ci github
Expand All @@ -21,19 +21,20 @@ jobs:
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
fail-fast: false
matrix:
platform:
- runner: ubuntu-latest
- runner: ubuntu-22.04
target: x86_64
- runner: ubuntu-latest
- runner: ubuntu-22.04
target: x86
- runner: ubuntu-latest
- runner: ubuntu-22.04
target: aarch64
- runner: ubuntu-latest
- runner: ubuntu-22.04
target: armv7
- runner: ubuntu-latest
- runner: ubuntu-22.04
target: s390x
- runner: ubuntu-latest
- runner: ubuntu-22.04
target: ppc64le
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -64,13 +65,13 @@ jobs:
strategy:
matrix:
platform:
- runner: ubuntu-latest
- runner: ubuntu-22.04
target: x86_64
- runner: ubuntu-latest
- runner: ubuntu-22.04
target: x86
- runner: ubuntu-latest
- runner: ubuntu-22.04
target: aarch64
- runner: ubuntu-latest
- runner: ubuntu-22.04
target: armv7
steps:
Comment on lines +74 to 76
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

musllinux job: armv7 lacks cross-compile setup

Unlike the glibc job, the musllinux armv7 leg has no steps to install the Rust target, tool-chain or linker env vars, so it will fail at compile/link time. Mirror the fixes from the Linux job.

πŸ€– Prompt for AI Agents
In .github/workflows/CI.yml around lines 93 to 95, the musllinux job for armv7
is missing the setup steps for cross-compilation such as installing the Rust
target, toolchain, and setting linker environment variables. To fix this, add
the necessary steps to install the Rust armv7 target, configure the appropriate
cross-compilation toolchain, and set the linker environment variables, mirroring
the setup used in the glibc Linux job for armv7.

- uses: actions/checkout@v4
Expand Down Expand Up @@ -124,8 +125,11 @@ jobs:
name: wheels-windows-${{ matrix.platform.target }}
path: BinaryOptionsToolsV2/dist
- name: Publish
if: env.PYPI_API_TOKEN != ''
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run:
maturin publish -u __token__ -p ${{ secrets.PYPI_API_TOKEN }}
maturin publish -u __token__ -p $PYPI_API_TOKEN

Comment on lines 127 to 133
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

if: env.PYPI_API_TOKEN never evaluates as expected

The if: is parsed before this step’s env: block is applied, so env.PYPI_API_TOKEN is empty and the step will always be skipped.
Gate on the secret instead:

-        if: env.PYPI_API_TOKEN != ''
+        if: secrets.PYPI_API_TOKEN != ''

Same issue in the macOS and release jobs below.

πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Publish
if: env.PYPI_API_TOKEN != ''
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run:
maturin publish -u __token__ -p ${{ secrets.PYPI_API_TOKEN }}
maturin publish -u __token__ -p $PYPI_API_TOKEN
- name: Publish
if: secrets.PYPI_API_TOKEN != ''
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run:
maturin publish -u __token__ -p $PYPI_API_TOKEN
πŸ€– Prompt for AI Agents
In .github/workflows/CI.yml around lines 152 to 158, the if condition uses
env.PYPI_API_TOKEN which is not set yet at that point, causing the step to
always skip. To fix this, change the if condition to check the secret directly
using if: secrets.PYPI_API_TOKEN != ''. Apply the same fix to the macOS and
release jobs where this pattern repeats.

macos:
runs-on: ${{ matrix.platform.runner }}
Expand Down Expand Up @@ -158,8 +162,11 @@ jobs:
name: wheels-macos-${{ matrix.platform.target }}
path: BinaryOptionsToolsV2/dist
- name: Publish
if: env.PYPI_API_TOKEN != ''
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run:
maturin publish -u __token__ -p ${{ secrets.PYPI_API_TOKEN }}
maturin publish -u __token__ -p $PYPI_API_TOKEN

sdist:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -201,6 +208,6 @@ jobs:
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run:
run:
uv pip install --upgrade twine
twine upload --skip-existing *
40 changes: 23 additions & 17 deletions .github/workflows/JsPublish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: JS Package Publish
env:
DEBUG: napi:*
APP_NAME: '@rick-29/binary-options-tools'
APP_NAME: 'binary-options-tools'
MACOSX_DEPLOYMENT_TARGET: '10.13'
permissions:
contents: write
Expand All @@ -10,6 +10,7 @@ permissions:
push:
branches:
- main
- master
tags-ignore:
- '**'
paths-ignore:
Expand All @@ -18,15 +19,14 @@ permissions:
- '**/*.gitignore'
- .editorconfig
- docs/**
pull_request: null
workflow_dispatch: null
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
- host: macos-13 # (intel processor)
target: x86_64-apple-darwin
build: yarn build --target x86_64-apple-darwin
- host: windows-latest
Expand All @@ -37,37 +37,37 @@ jobs:
yarn build --target i686-pc-windows-msvc
yarn test
target: i686-pc-windows-msvc
- host: ubuntu-latest
- host: ubuntu-22.04
target: x86_64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
build: yarn build --target x86_64-unknown-linux-gnu
- host: ubuntu-latest
- host: ubuntu-22.04
target: x86_64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: yarn build --target x86_64-unknown-linux-musl
- host: macos-latest
- host: macos-15 # (arm64 processor, Apple Silicon)
target: aarch64-apple-darwin
build: yarn build --target aarch64-apple-darwin
- host: ubuntu-latest
- host: ubuntu-22.04
target: aarch64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
build: yarn build --target aarch64-unknown-linux-gnu
- host: ubuntu-latest
- host: ubuntu-22.04
target: armv7-unknown-linux-gnueabihf
setup: |
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabihf -y
build: yarn build --target armv7-unknown-linux-gnueabihf
- host: ubuntu-latest
- host: ubuntu-22.04
target: armv7-unknown-linux-musleabihf
build: yarn build --target armv7-unknown-linux-musleabihf
- host: ubuntu-latest
- host: ubuntu-22.04
target: aarch64-linux-android
build: yarn build --target aarch64-linux-android
- host: ubuntu-latest
- host: ubuntu-22.04
target: armv7-linux-androideabi
build: yarn build --target armv7-linux-androideabi
- host: ubuntu-latest
- host: ubuntu-22.04
target: aarch64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |-
Expand All @@ -77,7 +77,7 @@ jobs:
- host: windows-latest
target: aarch64-pc-windows-msvc
build: yarn build --target aarch64-pc-windows-msvc
- host: ubuntu-latest
- host: ubuntu-22.04
target: riscv64gc-unknown-linux-gnu
setup: |
sudo apt-get update
Expand Down Expand Up @@ -140,7 +140,13 @@ jobs:
if: ${{ matrix.settings.docker }}
with:
image: ${{ matrix.settings.docker }}
options: '--user 0:0 -v ${{ github.workspace }}/BinaryOptionsToolsJs/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/BinaryOptionsToolsJs/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/BinaryOptionsToolsJs/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}/BinaryOptionsToolsJs:/build -w /build'
options: >
--user 0:0
-v ${{ github.workspace }}/BinaryOptionsToolsJs/.cargo-cache/git/db:/usr/local/cargo/git/db
-v ${{ github.workspace }}/BinaryOptionsToolsJs/.cargo/registry/cache:/usr/local/cargo/registry/cache
-v ${{ github.workspace }}/BinaryOptionsToolsJs/.cargo/registry/index:/usr/local/cargo/registry/index
-v ${{ github.workspace }}:/build
-w /build/BinaryOptionsToolsJs
run: ${{ matrix.settings.build }}
- name: Build
run: ${{ matrix.settings.build }}
Expand Down Expand Up @@ -211,7 +217,7 @@ jobs:
fail-fast: false
matrix:
settings:
- host: macos-latest
- host: macos-13
target: x86_64-apple-darwin
- host: windows-latest
target: x86_64-pc-windows-msvc
Expand Down Expand Up @@ -420,7 +426,7 @@ jobs:
name: Build universal macOS binary
needs:
- build
runs-on: macos-latest
runs-on: macos-15 # (arm64 processor, Apple Silicon)
steps:
- uses: actions/checkout@v4
- name: Setup node
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
/rust/target
/examples/*.log
.qodo
/target
/target
*/errors.log
node_modules

1 change: 1 addition & 0 deletions BinaryOptionsToolsJs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ chrono = "0.4.41"
regex = "1.11.1"
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
once_cell = "1.21.3"
openssl = { version = "0.10", features = ["vendored"] }

[build-dependencies]
napi-build = "2.1.6"
Expand Down
22 changes: 22 additions & 0 deletions BinaryOptionsToolsJs/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,26 @@ export declare class PocketOption {
* ```
*/
getCandles(asset: string, period: number, offset: number): Promise<any>
/**
* Retrieves historical candle data for an asset with time
*
* # Arguments
* * `asset` - The trading asset/symbol (e.g., "EUR/USD")
* * `time` - The UNIX timestamp for the start of the candle data
* * `period` - The candle period in seconds
* * `offset` - Time offset for historical data
*
* # Returns
* A JSON string containing the candle data
*
* # Examples
* ```javascript
* const candles = await client.getCandlesAdvanced("EUR/USD", 1751925016, 60, 6000);
* const data = JSON.parse(candles);
* console.log(`Retrieved ${data.length} candles`);
* ```
*/
getCandlesAdvanced(asset: string, time: number, period: number, offset: number): Promise<any>
/**
* Retrieves the current account balance.
*
Expand Down Expand Up @@ -558,6 +578,8 @@ export declare class PocketOption {
* ```
*/
createRawIterator(message: string, validator: Validator, timeout?: number | undefined | null): Promise<RawStreamIterator>
/** Returns the current server time as a UNIX timestamp */
getServerTime(): Promise<number>
}
/**
* A validator for WebSocket messages that provides various matching strategies.
Expand Down
27 changes: 27 additions & 0 deletions BinaryOptionsToolsJs/src/pocketoption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,33 @@ impl PocketOption {
serde_json::to_value(&res).map_err(|e| Error::from_reason(e.to_string()))
}

/// Retrieves historical candle data for an asset with time
///
/// # Arguments
/// * `asset` - The trading asset/symbol (e.g., "EUR/USD")
/// * `time` - The UNIX timestamp for the start of the candle data
/// * `period` - The candle period in seconds
/// * `offset` - Time offset for historical data
///
/// # Returns
/// A JSON string containing the candle data
///
/// # Examples
/// ```javascript
/// const candles = await client.getCandlesAdvanced("EUR/USD", 1751925016, 60, 6000);
/// const data = JSON.parse(candles);
/// console.log(`Retrieved ${data.length} candles`);
/// ```
#[napi]
pub async fn get_candles_advanced(&self, asset: String, time: i64, period: i64, offset: i64) -> Result<Value> {
let res = self
.client
.get_candles_advanced(asset, time, period, offset)
.await
.map_err(|e| Error::from_reason(e.to_string()))?;
serde_json::to_value(&res).map_err(|e| Error::from_reason(e.to_string()))
}

/// Retrieves the current account balance.
///
/// # Returns
Expand Down
3 changes: 2 additions & 1 deletion BinaryOptionsToolsV2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"
description = "A library to connect to PocketOption using python with async and sync support."
license = "BSD License (BSD)"
homepage = "https://github.com/ChipaDevTeam/BinaryOptionsTools-v2"
readme = "Readme.md"
readme = "README.md"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
Expand All @@ -29,3 +29,4 @@ tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
chrono = "0.4.41"
url = "2.5.4"
regex = "1.11.1"
openssl = { version = "0.10", features = ["vendored"] }
File renamed without changes.
Loading