Skip to content

Conversation

@theshadow76
Copy link
Contributor

@theshadow76 theshadow76 commented Aug 29, 2025

Summary by CodeRabbit

  • New Features
    • Expanded default candle intervals to include additional durations for more flexible data sampling.
  • Bug Fixes
    • Improved validation feedback by listing a comprehensive set of available candle durations when an invalid time is provided.
  • Refactor
    • Switched internal imports to package-relative paths for better modularity; no user-facing changes.
  • Tests
    • Added an example test script demonstrating asynchronous candle streaming for real-time data consumption.
  • Chores
    • Updated ignore rules to exclude local virtual environment directories (.venv).

Copilot AI review requested due to automatic review settings August 29, 2025 19:03
@coderabbitai
Copy link

coderabbitai bot commented Aug 29, 2025

Walkthrough

Updates .gitignore to include .venv. Refactors Python imports in pocketoption async/sync modules to use relative paths. Modifies Rust Asset defaults and validation to use a union of allowed and default candle durations. Adds a new async streaming test script for candle data.

Changes

Cohort / File(s) Summary
VCS ignore rules
\.gitignore
Add .venv to ignored paths; retain existing entries.
Python pocketoption import refactor
BinaryOptionsToolsV2/BinaryOptionsToolsV2/pocketoption/asyncronous.py, BinaryOptionsToolsV2/BinaryOptionsToolsV2/pocketoption/syncronous.py
Switch absolute imports to package-relative imports (..config, ..validator, .. for RawPocketOption, Logger). No logic changes.
Rust asset defaults and validation
crates/binary_options_tools/src/pocketoption/types.rs
Expand DEFAULT_CANDLE_LENGTHS and update Asset::validate to build a sorted, deduplicated union of allowed_candles() and defaults for error reporting/validation logic.
New async streaming test
tests/test-get-data.py
Add example script using PocketOptionAsync to subscribe to timed candle stream (EURUSD_otc, 5s) and print received candles.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Test as tests/test-get-data.py
  participant POA as PocketOptionAsync
  participant Stream as Timed Candle Stream

  User->>Test: Provide ssid
  Test->>POA: init(ssid)
  Test->>POA: subscribe_symbol_timed("EURUSD_otc", 5s)
  POA-->>Test: Stream iterator
  loop For each candle
    Stream-->>POA: Candle data
    POA-->>Test: Candle (dict)
    Test->>Test: print(candle)
  end
Loading
sequenceDiagram
  autonumber
  participant Caller
  participant Asset
  note over Asset: validate(time)
  Caller->>Asset: validate(time)
  rect rgba(200,230,255,0.3)
    Asset->>Asset: allowed = allowed_candles()
    Asset->>Asset: all = sort_dedup(allowed ∪ DEFAULT_CANDLE_LENGTHS)
  end
  alt time ∈ all
    Asset-->>Caller: Ok(())
  else time ∉ all
    Asset-->>Caller: Err(InvalidAsset{ available: all })
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

I thump my paws at streams that flow,
New candles blink—onward they go.
A union of times, neat and bright,
Rust keeps watch through day and night.
Imports hop home, paths align—
I twitch my nose: “All working fine!” 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-vigowalker-0.1.9

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates vigowalker to version 0.1.9, expanding candle duration support and fixing import paths in the Python modules.

  • Expands the default candle durations from 9 to 15 options with additional time intervals
  • Improves error reporting by combining and deduplicating available candle durations
  • Fixes relative import paths in Python modules to use proper relative imports

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

File Description
tests/test-get-data.py Adds a new test file demonstrating async subscription to symbol data
crates/binary_options_tools/src/pocketoption/types.rs Expands candle durations and improves error message formatting
BinaryOptionsToolsV2/BinaryOptionsToolsV2/pocketoption/syncronous.py Updates imports to use relative imports
BinaryOptionsToolsV2/BinaryOptionsToolsV2/pocketoption/asyncronous.py Updates imports to use relative imports

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@@ -1,6 +1,6 @@
from .asyncronous import PocketOptionAsync
Copy link

Copilot AI Aug 29, 2025

Choose a reason for hiding this comment

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

The filename 'asyncronous.py' contains a spelling error. It should be 'asynchronous.py'. Update the import to match the correct spelling: from .asynchronous import PocketOptionAsync

Suggested change
from .asyncronous import PocketOptionAsync
from .asynchronous import PocketOptionAsync

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +3
from ..validator import Validator
from ..config import Config
from .. import RawPocketOption, Logger
Copy link

Copilot AI Aug 29, 2025

Choose a reason for hiding this comment

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

The filename 'asyncronous.py' contains a spelling error. It should be 'asynchronous.py' to correctly spell 'asynchronous'.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Rick-29 will fix this later

Comment on lines +1 to +3
from ..validator import Validator
from ..config import Config
from .. import RawPocketOption, Logger
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Rick-29 will fix this later

Copy link
Contributor Author

Choose a reason for hiding this comment

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

la verdad no me cambia que uses el 60 * ...

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
BinaryOptionsToolsV2/BinaryOptionsToolsV2/pocketoption/syncronous.py (2)

232-264: Typo in public API: timout → timeout (breaking).

Rename the method to the correct spelling and keep a backward-compat alias if this is already published.

-    def create_raw_order_with_timout(self, message: str, validator: Validator, timeout: timedelta) -> str:
+    # Back-compat alias; consider deprecating in a future minor.
+    def create_raw_order_with_timout(self, message: str, validator: Validator, timeout: timedelta) -> str:
+        return self.create_raw_order_with_timeout(message, validator, timeout)
+
+    def create_raw_order_with_timeout(self, message: str, validator: Validator, timeout: timedelta) -> str:
         """
-        Similar to create_raw_order but with a timeout.
+        Similar to create_raw_order but with a timeout.
@@
-        return self.loop.run_until_complete(self._client.create_raw_order_with_timeout(message, validator, timeout))
+        return self.loop.run_until_complete(self._client.create_raw_order_with_timeout(message, validator, timeout))

192-205: Implement or disable send_raw_message wrapper
The sync send_raw_message delegates to PocketOptionAsync.send_raw_message, which currently always raises NotImplementedError (see pocketoption/asyncronous.py:386–396), so this call will crash at runtime. Either implement the async method or remove/disable the sync API until it’s functional.

BinaryOptionsToolsV2/BinaryOptionsToolsV2/pocketoption/asyncronous.py (1)

67-87: Bug: wrong variable passed to RawPocketOption.

When config is dict/str, you build self.config but pass the original config variable, breaking type expectations.

-                self.client = RawPocketOption(ssid, config)
+                self.client = RawPocketOption(ssid, self.config)
🧹 Nitpick comments (7)
.gitignore (1)

5-6: Scope ignores more precisely (optional).

Consider scoping to the repo root and using trailing slashes to avoid accidental matches in nested folders.

-/target
-.venv
+/target/
+/.venv/
BinaryOptionsToolsV2/BinaryOptionsToolsV2/pocketoption/syncronous.py (1)

283-301: Doc/example uses raw_validator but API accepts Validator.

Align examples with the actual type you pass downstream (Validator vs validator.raw_validator) once async methods are implemented to avoid confusion.

crates/binary_options_tools/src/pocketoption/types.rs (1)

378-389: Better error context by union of durations: nice improvement.

Minor micro-opt: use sort_unstable() for primitive sorting.

-            all_available.sort();
+            all_available.sort_unstable();
             all_available.dedup();
BinaryOptionsToolsV2/BinaryOptionsToolsV2/pocketoption/asyncronous.py (1)

60-66: Docnote contradicts code (Config support).

The class does parse and store Config; update the note to reflect reality.

-            Warning: This class is designed for asynchronous operations and should be used within an async context.
-            This version doesn't support the `Config` class.
+            Warning: This class is designed for asynchronous operations and should be used within an async context.
+            This version supports the `Config` class (Config|dict|JSON) and locks it after first use.
tests/test-get-data.py (3)

1-3: Import may fail unless re-exported.

Either export PocketOptionAsync from BinaryOptionsToolsV2/pocketoption/init.py or import the module path directly.

-from BinaryOptionsToolsV2.pocketoption import PocketOptionAsync
+from BinaryOptionsToolsV2.pocketoption.asyncronous import PocketOptionAsync

18-21: Avoid echoing credentials; use getpass.

Prevent SSID from showing on screen.

-if __name__ == '__main__':
-    ssid = input('Please enter your ssid: ')
-    asyncio.run(main(ssid))
+if __name__ == '__main__':
+    import getpass
+    ssid = getpass.getpass('Please enter your ssid: ')
+    asyncio.run(main(ssid))

14-16: Non-terminating stream under tests/.

Since this runs indefinitely, consider moving to examples/ or marking clearly as a manual smoke test to avoid confusion with automated test suites.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3528db8 and 7eb1c4a.

📒 Files selected for processing (5)
  • .gitignore (1 hunks)
  • BinaryOptionsToolsV2/BinaryOptionsToolsV2/pocketoption/asyncronous.py (1 hunks)
  • BinaryOptionsToolsV2/BinaryOptionsToolsV2/pocketoption/syncronous.py (1 hunks)
  • crates/binary_options_tools/src/pocketoption/types.rs (2 hunks)
  • tests/test-get-data.py (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
BinaryOptionsToolsV2/BinaryOptionsToolsV2/pocketoption/asyncronous.py (3)
BinaryOptionsToolsV2/BinaryOptionsToolsV2/validator.py (1)
  • Validator (3-272)
BinaryOptionsToolsV2/BinaryOptionsToolsV2/config.py (1)
  • Config (62-193)
BinaryOptionsToolsV2/BinaryOptionsToolsV2/tracing.py (1)
  • Logger (48-92)
tests/test-get-data.py (2)
BinaryOptionsToolsV2/BinaryOptionsToolsV2/pocketoption/asyncronous.py (1)
  • subscribe_symbol_timed (344-363)
BinaryOptionsToolsV2/BinaryOptionsToolsV2/tracing.py (1)
  • start_logs (25-45)
BinaryOptionsToolsV2/BinaryOptionsToolsV2/pocketoption/syncronous.py (2)
BinaryOptionsToolsV2/BinaryOptionsToolsV2/config.py (1)
  • Config (62-193)
BinaryOptionsToolsV2/BinaryOptionsToolsV2/validator.py (1)
  • Validator (3-272)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: stable - aarch64-unknown-linux-musl - node@20
  • GitHub Check: stable - i686-pc-windows-msvc - node@20
  • GitHub Check: stable - aarch64-pc-windows-msvc - node@20
  • GitHub Check: stable - riscv64gc-unknown-linux-gnu - node@20
  • GitHub Check: stable - armv7-linux-androideabi - node@20
  • GitHub Check: stable - aarch64-unknown-linux-gnu - node@20
  • GitHub Check: stable - armv7-unknown-linux-musleabihf - node@20
  • GitHub Check: stable - armv7-unknown-linux-gnueabihf - node@20
  • GitHub Check: stable - x86_64-pc-windows-msvc - node@20
  • GitHub Check: stable - x86_64-unknown-linux-gnu - node@20
  • GitHub Check: Build FreeBSD
  • GitHub Check: macos (macos-13, x86_64)
  • GitHub Check: macos (macos-14, aarch64)
  • GitHub Check: windows (windows-latest, x64)
  • GitHub Check: windows (windows-latest, x86)
🔇 Additional comments (4)
BinaryOptionsToolsV2/BinaryOptionsToolsV2/pocketoption/syncronous.py (1)

2-3: Relative imports: good change.

crates/binary_options_tools/src/pocketoption/types.rs (1)

337-353: Expanded default candle lengths: LGTM.

Broader coverage is helpful and non-breaking.

BinaryOptionsToolsV2/BinaryOptionsToolsV2/pocketoption/asyncronous.py (2)

1-3: Relative imports: good change.


386-488: Delegate raw WebSocket and order methods to client, defer iterator

  • Replace the NotImplementedError in send_raw_message, create_raw_order, create_raw_order_with_timeout, and create_raw_order_with_timeout_and_retry with direct calls to await self.client.<method>(…).
  • Keep create_raw_iterator raising NotImplementedError (the Rust binding in src/pocketoption.rs still returns NotAllowed) and adjust the sync wrapper to reflect that it’s unavailable until the Rust API implements it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants