-
Notifications
You must be signed in to change notification settings - Fork 30
fixed errors caused from conflicts on my last PR #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f60140c
0fe12a3
990c87f
e849a69
7e21d5d
6ee6777
3854f53
28aef69
eff7faa
1d1a535
4b76cfd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,8 +14,6 @@ use pocketoption::{RawPocketOption, RawStreamIterator, StreamIterator, RawHandle | |
| use pyo3::prelude::*; | ||
| use validator::RawValidator; | ||
|
|
||
| use crate::pocketoption::RawHandlerRust; | ||
|
|
||
| #[pymodule(name = "BinaryOptionsToolsV2")] | ||
| fn BinaryOptionsTools(m: &Bound<'_, PyModule>) -> PyResult<()> { | ||
| m.add_class::<StreamLogsIterator>()?; | ||
|
|
@@ -26,8 +24,10 @@ fn BinaryOptionsTools(m: &Bound<'_, PyModule>) -> PyResult<()> { | |
| m.add_class::<StreamIterator>()?; | ||
| m.add_class::<RawStreamIterator>()?; | ||
| m.add_class::<RawValidator>()?; | ||
| m.add_class::<RawHandlerRust>()?; | ||
| // m.add_class::<PyConfig>()?; | ||
| m.add_class::<RawHandle>()?; | ||
| m.add_class::<RawHandler>()?; | ||
| m.add_class::<RawHandle>()?; | ||
| m.add_class::<RawHandler>()?; | ||
|
Comment on lines
+27
to
+30
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove duplicate class registrations.
Proposed fix m.add_class::<RawHandle>()?;
m.add_class::<RawHandler>()?;
- m.add_class::<RawHandle>()?;
- m.add_class::<RawHandler>()?;🤖 Prompt for AI Agents |
||
|
|
||
| m.add_function(wrap_pyfunction!(start_tracing, m)?)?; | ||
| Ok(()) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import asyncio | ||
| import os | ||
| import sys | ||
| from BinaryOptionsToolsV2 import PocketOption | ||
|
|
||
| # Mock SSID (won't connect effectively but allows object creation) | ||
| SSID = r'42["auth",{"session":"mock_session","isDemo":1,"uid":12345,"platform":1}]' | ||
|
|
||
| async def trade_task(api, asset, amount, time, task_id): | ||
| print(f"Task {task_id}: Starting trade...") | ||
| try: | ||
| # buying usually returns a tuple (uuid, deal) | ||
| result = await api.buy(asset, amount, time) | ||
| print(f"Task {task_id}: Trade completed: {result}") | ||
| except Exception as e: | ||
| print(f"Task {task_id}: Trade failed: {e}") | ||
|
|
||
| async def main(): | ||
| # This test assumes we can mock the connection or at least instantiate the client | ||
| # Without a live server or extensive mocking, this script is illustrative. | ||
| # However, if we could run it, it would hang. | ||
|
|
||
| try: | ||
| api = await PocketOption(SSID) | ||
| except Exception as e: | ||
| print(f"Failed to init api (expected if no connection): {e}") | ||
| return | ||
|
|
||
| # Simulate two concurrent trades | ||
| task1 = asyncio.create_task(trade_task(api, "EURUSD_otc", 1.0, 60, 1)) | ||
| task2 = asyncio.create_task(trade_task(api, "EURUSD_otc", 1.0, 60, 2)) | ||
|
|
||
| await asyncio.gather(task1, task2) | ||
|
|
||
| await api.disconnect() | ||
|
|
||
| if __name__ == "__main__": | ||
| asyncio.run(main()) | ||
sixtysixx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of
RawHandlerRustimport is consistent with the refactoring inpocketoption.rswhereRawHandlerRustwas renamed and split intoRawHandleandRawHandler.