binaryoptionstoolsv2 0.2.14__tar.gz → 0.2.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/BinaryOptionsToolsV2/BinaryOptionsToolsV2.pyi +18 -10
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/BinaryOptionsToolsV2/__init__.py +27 -4
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/BinaryOptionsToolsV2/closeoption/__init__.py +1 -1
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/BinaryOptionsToolsV2/closeoption/asynchronous.py +32 -22
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/BinaryOptionsToolsV2/closeoption/synchronous.py +92 -19
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/BinaryOptionsToolsV2/config.py +1 -1
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/BinaryOptionsToolsV2/pocketoption/__init__.py +3 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/BinaryOptionsToolsV2/pocketoption/asynchronous.py +487 -471
- binaryoptionstoolsv2-0.2.16/BinaryOptionsToolsV2/pocketoption/models.py +61 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/BinaryOptionsToolsV2/pocketoption/synchronous.py +361 -159
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/Cargo.lock +383 -384
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/PKG-INFO +29 -23
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/README.md +28 -22
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/Cargo.toml +2 -2
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/Readme.md +0 -1
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/closeoption/client.rs +409 -77
- binaryoptionstoolsv2-0.2.16/crates/binary_options_tools/src/closeoption/connect.rs +565 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/closeoption/error.rs +6 -2
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/closeoption/mod.rs +1 -1
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/closeoption/state.rs +23 -11
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/closeoption/types.rs +236 -32
- binaryoptionstoolsv2-0.2.16/crates/binary_options_tools/src/closeoption/utils.rs +169 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/error.rs +4 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/lib.rs +10 -3
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/candle.rs +3 -6
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/connect.rs +7 -5
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/error.rs +1 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/mod.rs +3 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/modules/assets.rs +14 -23
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/modules/balance.rs +26 -23
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/modules/deals.rs +75 -130
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/modules/get_candles.rs +408 -149
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/modules/historical_data.rs +61 -47
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/modules/keep_alive.rs +20 -40
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/modules/pending_trades.rs +96 -81
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/modules/raw.rs +15 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/modules/subscriptions.rs +180 -26
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/pocket_client.rs +152 -16
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/ssid.rs +234 -6
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/state.rs +1 -1
- binaryoptionstoolsv2-0.2.16/crates/binary_options_tools/src/pocketoption/try_demo.rs +140 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/types.rs +13 -25
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/utils.rs +158 -258
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/utils/mod.rs +49 -10
- binaryoptionstoolsv2-0.2.16/crates/binary_options_tools/tests/closeoption_test.rs +212 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/tests/common/mod.rs +9 -47
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/tests/comprehensive_pocketoption_tests.rs +0 -1
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/tests/concurrency.rs +1 -20
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/tests/deals_module_cleanup.rs +6 -1
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/tests/deals_tests.rs +14 -14
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/tests/history_verification_tests.rs +10 -5
- binaryoptionstoolsv2-0.2.16/crates/binary_options_tools/tests/pending_trades_tests.rs +1135 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/bindings_pyo3/Cargo.toml +2 -2
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/bindings_pyo3/Readme.md +1 -2
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/bindings_pyo3/src/closeoption.rs +75 -47
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/bindings_pyo3/src/config.rs +0 -1
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/bindings_pyo3/src/error.rs +5 -2
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/bindings_pyo3/src/lib.rs +7 -3
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/bindings_pyo3/src/pocketoption.rs +51 -36
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/Cargo.toml +6 -1
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/src/client.rs +2 -4
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/src/lib.rs +1 -0
- binaryoptionstoolsv2-0.2.16/crates/core/src/transport.rs +378 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/tests/runner_command_tests.rs +2 -1
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/macros/ActionImpl_README.md +1 -1
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/macros/Cargo.toml +1 -1
- binaryoptionstoolsv2-0.2.14/crates/binary_options_tools/src/closeoption/connect.rs +0 -260
- binaryoptionstoolsv2-0.2.14/crates/binary_options_tools/src/closeoption/utils.rs +0 -323
- binaryoptionstoolsv2-0.2.14/crates/binary_options_tools/tests/pending_trades_tests.rs +0 -1152
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/BinaryOptionsToolsV2/pocketoption/tools/__init__.py +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/BinaryOptionsToolsV2/pocketoption/tools/login.py +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/BinaryOptionsToolsV2/tracing.py +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/BinaryOptionsToolsV2/validator.py +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/Cargo.toml +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/LICENSE +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/.gitignore +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/LICENSE +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/data/expert_options_regions.json +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/data/pocket_options_regions.json +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/examples/pending_trades_example.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/examples/test_demo.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/mkds/README.md +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/config.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/expertoptions/action.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/expertoptions/client.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/expertoptions/connect.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/expertoptions/error.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/expertoptions/mod.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/expertoptions/modules/keep_alive.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/expertoptions/modules/mod.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/expertoptions/modules/profile.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/expertoptions/regions.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/expertoptions/state.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/expertoptions/types.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/framework/market.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/framework/mod.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/framework/virtual_market.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/modules/mod.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/modules/server_time.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/modules/trades.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/pocketoption/regions.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/traits.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/utils/serialize.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/src/validator.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/tests/mod.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/tests/pending_trades_cleanup.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/tests/resilient_parsing_tests.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/tests/test_ssid_debug.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/binary_options_tools/tests/trade_state_regression.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/bindings_pyo3/LICENSE +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/bindings_pyo3/build.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/bindings_pyo3/src/framework.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/bindings_pyo3/src/logs.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/bindings_pyo3/src/runtime.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/bindings_pyo3/src/stream.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/bindings_pyo3/src/validator.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/.gitignore +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/LICENSE +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/README.md +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/diagrams/architecture.txt +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/diagrams/diagram.txt +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/docs/testing-framework.md +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/examples/echo_client.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/examples/middleware_example.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/examples/testing_echo_client.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/macros/Cargo.toml +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/macros/LICENSE +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/macros/src/lib.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/macros/src/modules/lightweight.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/macros/src/modules/mod.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/macros/src/rule.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/src/builder.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/src/callback.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/src/connector.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/src/error.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/src/message.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/src/middleware.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/src/reimports.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/src/rules.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/src/signals.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/src/statistics.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/src/testing.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/src/traits.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/src/utils/mod.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/src/utils/stream.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/src/utils/time.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/src/utils/tracing.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/tests/middleware_tests.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/tests/rule_macro_tests.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/tests/stream_tests.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/tests/testing_wrapper_tests.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/core/tests/two_step_standalone.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/macros/.gitignore +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/macros/Cargo.lock +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/macros/LICENSE +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/macros/src/action.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/macros/src/lib.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/macros/src/region.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/crates/macros/src/timeout.rs +0 -0
- {binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/pyproject.toml +0 -0
|
@@ -5,15 +5,19 @@ class Action:
|
|
|
5
5
|
Put: "Action"
|
|
6
6
|
|
|
7
7
|
class PyConfig:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
# The Rust constructor takes no arguments; fields are read/written through
|
|
9
|
+
# properties. Defaults mirror `binary_options_tools::config::Config`.
|
|
10
|
+
def __init__(self) -> None: ...
|
|
11
|
+
max_allowed_loops: int
|
|
12
|
+
sleep_interval: int
|
|
13
|
+
reconnect_time: int
|
|
14
|
+
connection_initialization_timeout_secs: int
|
|
15
|
+
timeout_secs: int
|
|
16
|
+
urls: List[str]
|
|
17
|
+
proxy: Optional[str]
|
|
18
|
+
user_agent: Optional[str]
|
|
19
|
+
origin: Optional[str]
|
|
20
|
+
sec_websocket_extensions: Optional[str]
|
|
17
21
|
|
|
18
22
|
class RawValidator:
|
|
19
23
|
@staticmethod
|
|
@@ -72,6 +76,10 @@ class RawPocketOption:
|
|
|
72
76
|
def new_with_config(ssid: str, config: PyConfig) -> "RawPocketOption": ...
|
|
73
77
|
@staticmethod
|
|
74
78
|
async def create_with_config(ssid: str, config: PyConfig) -> "RawPocketOption": ...
|
|
79
|
+
@staticmethod
|
|
80
|
+
def new_try_demo(token: Optional[str] = None) -> "RawPocketOption": ...
|
|
81
|
+
@staticmethod
|
|
82
|
+
async def create_try_demo(token: Optional[str] = None) -> "RawPocketOption": ...
|
|
75
83
|
async def wait_for_assets(self, timeout_secs: float) -> None: ...
|
|
76
84
|
def is_demo(self) -> bool: ...
|
|
77
85
|
async def buy(self, asset: str, amount: float, time: int) -> List[str]: ...
|
|
@@ -87,7 +95,7 @@ class RawPocketOption:
|
|
|
87
95
|
open_type: int,
|
|
88
96
|
amount: float,
|
|
89
97
|
asset: str,
|
|
90
|
-
open_time:
|
|
98
|
+
open_time: str,
|
|
91
99
|
open_price: float,
|
|
92
100
|
timeframe: int,
|
|
93
101
|
min_payout: int,
|
{binaryoptionstoolsv2-0.2.14 → binaryoptionstoolsv2-0.2.16}/BinaryOptionsToolsV2/__init__.py
RENAMED
|
@@ -8,13 +8,21 @@ from .pocketoption import (
|
|
|
8
8
|
PocketOptionAsync as PocketOptionAsync,
|
|
9
9
|
PocketOption as PocketOption,
|
|
10
10
|
RawHandler as RawHandler,
|
|
11
|
+
RawHandlerSync as RawHandlerSync,
|
|
12
|
+
Trade as Trade,
|
|
13
|
+
TradeResult as TradeResult,
|
|
11
14
|
Validator as Validator,
|
|
15
|
+
login as login,
|
|
16
|
+
login_async as login_async,
|
|
12
17
|
__all__ as __pocket_all__,
|
|
13
18
|
)
|
|
14
19
|
from .closeoption import (
|
|
15
20
|
CloseOptionAsync as CloseOptionAsync,
|
|
16
21
|
CloseOption as CloseOption,
|
|
17
|
-
|
|
22
|
+
AsyncRawSubscription as AsyncRawSubscription,
|
|
23
|
+
AsyncSubscription as AsyncSubscription,
|
|
24
|
+
SyncRawSubscription as SyncRawSubscription,
|
|
25
|
+
SyncSubscription as SyncSubscription,
|
|
18
26
|
__all__ as __close_all__,
|
|
19
27
|
)
|
|
20
28
|
|
|
@@ -56,10 +64,25 @@ _rust_exported_names = [
|
|
|
56
64
|
__rust_all__ = [n for n in _rust_exported_names if n in globals()]
|
|
57
65
|
|
|
58
66
|
__all__ = list(
|
|
59
|
-
|
|
67
|
+
dict.fromkeys(
|
|
60
68
|
__pocket_all__
|
|
61
69
|
+ __close_all__
|
|
62
|
-
+ [
|
|
70
|
+
+ [
|
|
71
|
+
"tracing",
|
|
72
|
+
"validator",
|
|
73
|
+
"PocketOptionAsync",
|
|
74
|
+
"PocketOption",
|
|
75
|
+
"CloseOptionAsync",
|
|
76
|
+
"CloseOption",
|
|
77
|
+
"RawHandler",
|
|
78
|
+
"Trade",
|
|
79
|
+
"TradeResult",
|
|
80
|
+
"Validator",
|
|
81
|
+
]
|
|
63
82
|
+ __rust_all__
|
|
64
83
|
)
|
|
65
|
-
)
|
|
84
|
+
)
|
|
85
|
+
# The subpackage `__all__` lists include submodule names (e.g. "asynchronous")
|
|
86
|
+
# that only exist there. Expose just the names this package actually resolves,
|
|
87
|
+
# so `from BinaryOptionsToolsV2 import *` works instead of raising AttributeError.
|
|
88
|
+
__all__ = [name for name in __all__ if name in globals()]
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import asyncio
|
|
2
1
|
import json
|
|
3
|
-
import re
|
|
4
2
|
import sys
|
|
5
|
-
import
|
|
6
|
-
from datetime import timedelta
|
|
7
|
-
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union, AsyncGenerator
|
|
3
|
+
from typing import TYPE_CHECKING, List, Optional, Tuple, Union, AsyncGenerator
|
|
8
4
|
|
|
9
5
|
from ..config import Config
|
|
10
6
|
from ..validator import Validator
|
|
11
7
|
|
|
12
8
|
if TYPE_CHECKING:
|
|
13
|
-
from ..BinaryOptionsToolsV2 import Logger
|
|
9
|
+
from ..BinaryOptionsToolsV2 import Logger
|
|
14
10
|
|
|
15
11
|
if sys.version_info < (3, 10):
|
|
16
12
|
|
|
@@ -86,11 +82,11 @@ def sanitize_and_validate_ssid(ssid: str, logger: "Logger") -> str:
|
|
|
86
82
|
ssid = ssid.strip()
|
|
87
83
|
|
|
88
84
|
# Try to parse as JSON first
|
|
89
|
-
if ssid.startswith(
|
|
85
|
+
if ssid.startswith("{") and ssid.endswith("}"):
|
|
90
86
|
try:
|
|
91
87
|
data = json.loads(ssid)
|
|
92
88
|
if isinstance(data, dict):
|
|
93
|
-
required = [
|
|
89
|
+
required = ["token", "sid"]
|
|
94
90
|
if all(k in data for k in required):
|
|
95
91
|
logger.debug("SSID parsed as JSON with token and sid")
|
|
96
92
|
return ssid
|
|
@@ -98,7 +94,7 @@ def sanitize_and_validate_ssid(ssid: str, logger: "Logger") -> str:
|
|
|
98
94
|
pass
|
|
99
95
|
|
|
100
96
|
# Try pipe-delimited format: token|sid|demo|public_code|hidden_code
|
|
101
|
-
parts = ssid.split(
|
|
97
|
+
parts = ssid.split("|")
|
|
102
98
|
if len(parts) >= 3:
|
|
103
99
|
logger.debug(f"SSID parsed as pipe-delimited with {len(parts)} parts")
|
|
104
100
|
return ssid
|
|
@@ -111,31 +107,31 @@ def sanitize_and_validate_ssid(ssid: str, logger: "Logger") -> str:
|
|
|
111
107
|
def parse_ssid(ssid: str) -> Tuple[str, str, bool, str, str]:
|
|
112
108
|
"""Parse SSID into token, sid, demo, public_code, hidden_code."""
|
|
113
109
|
# Try JSON first
|
|
114
|
-
if ssid.startswith(
|
|
110
|
+
if ssid.startswith("{") and ssid.endswith("}"):
|
|
115
111
|
try:
|
|
116
112
|
data = json.loads(ssid)
|
|
117
113
|
if isinstance(data, dict):
|
|
118
|
-
token = data.get(
|
|
119
|
-
sid = data.get(
|
|
120
|
-
demo = data.get(
|
|
121
|
-
public_code = data.get(
|
|
122
|
-
hidden_code = data.get(
|
|
114
|
+
token = data.get("token", "")
|
|
115
|
+
sid = data.get("sid", "")
|
|
116
|
+
demo = data.get("demo", False)
|
|
117
|
+
public_code = data.get("public_code", "")
|
|
118
|
+
hidden_code = data.get("hidden_code", "")
|
|
123
119
|
return token, sid, demo, public_code, hidden_code
|
|
124
120
|
except json.JSONDecodeError:
|
|
125
121
|
pass
|
|
126
122
|
|
|
127
123
|
# Try pipe-delimited
|
|
128
|
-
parts = ssid.split(
|
|
124
|
+
parts = ssid.split("|")
|
|
129
125
|
if len(parts) >= 3:
|
|
130
126
|
token = parts[0]
|
|
131
127
|
sid = parts[1]
|
|
132
|
-
demo = parts[2].lower() in (
|
|
133
|
-
public_code = parts[3] if len(parts) > 3 else
|
|
134
|
-
hidden_code = parts[4] if len(parts) > 4 else
|
|
128
|
+
demo = parts[2].lower() in ("true", "1", "yes", "demo") if len(parts) > 2 else False
|
|
129
|
+
public_code = parts[3] if len(parts) > 3 else ""
|
|
130
|
+
hidden_code = parts[4] if len(parts) > 4 else ""
|
|
135
131
|
return token, sid, demo, public_code, hidden_code
|
|
136
132
|
|
|
137
133
|
# Fallback: treat as token only
|
|
138
|
-
return ssid,
|
|
134
|
+
return ssid, "", False, "", ""
|
|
139
135
|
|
|
140
136
|
|
|
141
137
|
# This file contains all the async code for the CloseOption Module
|
|
@@ -157,6 +153,11 @@ class CloseOptionAsync:
|
|
|
157
153
|
self._raw_handler = None
|
|
158
154
|
self._connected = False
|
|
159
155
|
|
|
156
|
+
@property
|
|
157
|
+
def is_connected(self) -> bool:
|
|
158
|
+
"""Whether the connection to CloseOption has been established."""
|
|
159
|
+
return self._connected
|
|
160
|
+
|
|
160
161
|
async def __aenter__(self):
|
|
161
162
|
await self.connect()
|
|
162
163
|
return self
|
|
@@ -179,7 +180,9 @@ class CloseOptionAsync:
|
|
|
179
180
|
raise ValueError("SSID must contain token and sid")
|
|
180
181
|
|
|
181
182
|
if not public_code or not hidden_code:
|
|
182
|
-
raise ValueError(
|
|
183
|
+
raise ValueError(
|
|
184
|
+
"SSID must contain public_code and hidden_code (format: token|sid|demo|public_code|hidden_code)"
|
|
185
|
+
)
|
|
183
186
|
|
|
184
187
|
# Build URL with sid
|
|
185
188
|
if self._url:
|
|
@@ -187,8 +190,9 @@ class CloseOptionAsync:
|
|
|
187
190
|
else:
|
|
188
191
|
ws_url = f"wss://www.closeoption.com:8443/socket.io/?EIO=3&transport=websocket&sid={sid}"
|
|
189
192
|
|
|
193
|
+
logger.info("CloseOption: connecting to WebSocket")
|
|
190
194
|
self._client = RawCloseOption(token, sid, public_code, hidden_code, demo, ws_url, self._config.pyconfig)
|
|
191
|
-
|
|
195
|
+
logger.info("CloseOption: WebSocket connection established")
|
|
192
196
|
self._connected = True
|
|
193
197
|
|
|
194
198
|
async def _ensure_connected(self):
|
|
@@ -231,6 +235,12 @@ class CloseOptionAsync:
|
|
|
231
235
|
result = await self._client.get_candles(asset, period, count)
|
|
232
236
|
return json.loads(result)
|
|
233
237
|
|
|
238
|
+
async def get_ticks(self, asset: str) -> List[dict]:
|
|
239
|
+
"""Get tick series for an asset."""
|
|
240
|
+
await self._ensure_connected()
|
|
241
|
+
result = await self._client.get_ticks(asset)
|
|
242
|
+
return json.loads(result)
|
|
243
|
+
|
|
234
244
|
async def get_candles_live(self, asset: str, period: int) -> AsyncGenerator[dict, None]:
|
|
235
245
|
"""Get live candle updates."""
|
|
236
246
|
await self._ensure_connected()
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
-
import json
|
|
3
2
|
import threading
|
|
4
3
|
import sys
|
|
5
|
-
import
|
|
6
|
-
from
|
|
7
|
-
from typing import Dict, List, Optional, Tuple, Union
|
|
4
|
+
import concurrent.futures
|
|
5
|
+
from typing import List, Optional, Union
|
|
8
6
|
from ..config import Config
|
|
9
7
|
from ..validator import Validator as Validator
|
|
10
8
|
from .asynchronous import CloseOptionAsync as CloseOptionAsync
|
|
11
9
|
|
|
12
10
|
if sys.version_info < (3, 10):
|
|
11
|
+
|
|
13
12
|
async def anext(iterator):
|
|
14
13
|
"""Polyfill for anext for Python < 3.10"""
|
|
15
14
|
return await iterator.__anext__()
|
|
@@ -29,9 +28,7 @@ class SyncSubscription:
|
|
|
29
28
|
|
|
30
29
|
def __next__(self):
|
|
31
30
|
if self._loop is not None and self._loop.is_running():
|
|
32
|
-
future = asyncio.run_coroutine_threadsafe(
|
|
33
|
-
anext(self.subscription), self._loop
|
|
34
|
-
)
|
|
31
|
+
future = asyncio.run_coroutine_threadsafe(anext(self.subscription), self._loop)
|
|
35
32
|
try:
|
|
36
33
|
return future.result()
|
|
37
34
|
except StopAsyncIteration:
|
|
@@ -48,9 +45,7 @@ class SyncCandleLiveIterator:
|
|
|
48
45
|
return self
|
|
49
46
|
|
|
50
47
|
def __next__(self):
|
|
51
|
-
future = asyncio.run_coroutine_threadsafe(
|
|
52
|
-
self._get_next(), self.loop
|
|
53
|
-
)
|
|
48
|
+
future = asyncio.run_coroutine_threadsafe(self._get_next(), self.loop)
|
|
54
49
|
try:
|
|
55
50
|
return future.result()
|
|
56
51
|
except StopAsyncIteration:
|
|
@@ -60,7 +55,6 @@ class SyncCandleLiveIterator:
|
|
|
60
55
|
return await anext(self.async_gen)
|
|
61
56
|
|
|
62
57
|
|
|
63
|
-
|
|
64
58
|
class RawHandlerSync:
|
|
65
59
|
"""Synchronous handler for advanced raw WebSocket message operations."""
|
|
66
60
|
|
|
@@ -86,7 +80,7 @@ class RawHandlerSync:
|
|
|
86
80
|
"""Wait for a specific event from the server."""
|
|
87
81
|
return self._run(self._handler.wait_for(event, timeout))
|
|
88
82
|
|
|
89
|
-
def subscribe(self, event: str) ->
|
|
83
|
+
def subscribe(self, event: str) -> "SyncRawSubscription":
|
|
90
84
|
"""Subscribe to a specific event type."""
|
|
91
85
|
sub = self._run(self._handler.subscribe(event))
|
|
92
86
|
return SyncRawSubscription(sub)
|
|
@@ -120,9 +114,7 @@ class SyncRawSubscription:
|
|
|
120
114
|
|
|
121
115
|
def __next__(self):
|
|
122
116
|
if self._loop is not None and self._loop.is_running():
|
|
123
|
-
future = asyncio.run_coroutine_threadsafe(
|
|
124
|
-
anext(self.subscription), self._loop
|
|
125
|
-
)
|
|
117
|
+
future = asyncio.run_coroutine_threadsafe(anext(self.subscription), self._loop)
|
|
126
118
|
try:
|
|
127
119
|
return future.result()
|
|
128
120
|
except StopAsyncIteration:
|
|
@@ -131,7 +123,14 @@ class SyncRawSubscription:
|
|
|
131
123
|
|
|
132
124
|
|
|
133
125
|
class CloseOption:
|
|
134
|
-
def __init__(
|
|
126
|
+
def __init__(
|
|
127
|
+
self,
|
|
128
|
+
ssid: str,
|
|
129
|
+
url: Optional[str] = None,
|
|
130
|
+
config: Union[Config, dict, str] = None,
|
|
131
|
+
connect_on_init: bool = True,
|
|
132
|
+
**_,
|
|
133
|
+
):
|
|
135
134
|
"""
|
|
136
135
|
Initialize CloseOption synchronous client.
|
|
137
136
|
|
|
@@ -139,6 +138,9 @@ class CloseOption:
|
|
|
139
138
|
ssid: Session ID in format "token|sid|demo|public_code|hidden_code" or JSON
|
|
140
139
|
url: WebSocket URL (optional, defaults to CloseOption)
|
|
141
140
|
config: Configuration object (optional)
|
|
141
|
+
connect_on_init: Whether to establish the connection eagerly in the
|
|
142
|
+
constructor (default True). Set to False to inspect the client
|
|
143
|
+
API without connecting (e.g. offline demo mode).
|
|
142
144
|
"""
|
|
143
145
|
self._ssid = ssid
|
|
144
146
|
self._url = url
|
|
@@ -155,16 +157,59 @@ class CloseOption:
|
|
|
155
157
|
self._thread = threading.Thread(target=self._run_loop, daemon=True)
|
|
156
158
|
self._thread.start()
|
|
157
159
|
self._closed = False
|
|
160
|
+
if connect_on_init:
|
|
161
|
+
# Establish the connection eagerly so the constructor fails fast on bad
|
|
162
|
+
# credentials and later operations don't race an implicit first connect.
|
|
163
|
+
try:
|
|
164
|
+
self._connect()
|
|
165
|
+
except Exception:
|
|
166
|
+
# Stop the background loop and join its thread before propagating
|
|
167
|
+
# so a failed construction leaves no orphaned thread behind.
|
|
168
|
+
try:
|
|
169
|
+
self.shutdown()
|
|
170
|
+
except Exception:
|
|
171
|
+
pass
|
|
172
|
+
raise
|
|
173
|
+
|
|
158
174
|
def _run_loop(self):
|
|
159
175
|
asyncio.set_event_loop(self._loop)
|
|
160
176
|
self._loop.run_forever()
|
|
161
177
|
|
|
162
178
|
def _run(self, coro):
|
|
179
|
+
"""Run a coroutine on the background loop and block for its result.
|
|
180
|
+
|
|
181
|
+
No timeout is applied here: operation futures (buy/sell/check_win/...)
|
|
182
|
+
only resolve once the underlying RawCloseOption action has finished (or
|
|
183
|
+
raised), so a retry can never re-issue an order that already went
|
|
184
|
+
through. connection_initialization_timeout_secs is applied only by
|
|
185
|
+
_connect()/_ensure_connected() while establishing the connection.
|
|
186
|
+
"""
|
|
163
187
|
future = asyncio.run_coroutine_threadsafe(coro, self._loop)
|
|
164
188
|
return future.result()
|
|
165
189
|
|
|
190
|
+
def _connect(self):
|
|
191
|
+
"""Establish the connection, bounded by the connection initialization
|
|
192
|
+
timeout. CloseOptionAsync.connect() is a no-op once connected."""
|
|
193
|
+
future = asyncio.run_coroutine_threadsafe(self._async_client.connect(), self._loop)
|
|
194
|
+
try:
|
|
195
|
+
return future.result(timeout=self._config.connection_initialization_timeout_secs)
|
|
196
|
+
except concurrent.futures.TimeoutError as exc:
|
|
197
|
+
future.cancel()
|
|
198
|
+
raise TimeoutError("CloseOption connection timed out") from exc
|
|
199
|
+
|
|
200
|
+
def _ensure_connected(self):
|
|
201
|
+
"""Connect on demand through the bounded _connect() path.
|
|
202
|
+
|
|
203
|
+
Used for deferred connections (e.g. connect_on_init=False): without this,
|
|
204
|
+
the async client would connect lazily inside the operation coroutine,
|
|
205
|
+
bypassing the Python-side connection initialization timeout.
|
|
206
|
+
"""
|
|
207
|
+
if self._async_client is not None and not self._async_client.is_connected:
|
|
208
|
+
self._connect()
|
|
209
|
+
|
|
166
210
|
def __enter__(self):
|
|
167
|
-
|
|
211
|
+
# Connection is established in __init__; no per-operation timeout applies.
|
|
212
|
+
print("CloseOption: connected")
|
|
168
213
|
return self
|
|
169
214
|
|
|
170
215
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
@@ -172,73 +217,95 @@ class CloseOption:
|
|
|
172
217
|
|
|
173
218
|
def buy(self, asset: str, amount: float, time: int) -> dict:
|
|
174
219
|
"""Place a BUY (CALL) order."""
|
|
220
|
+
self._ensure_connected()
|
|
175
221
|
return self._run(self._async_client.buy(asset, amount, time))
|
|
176
222
|
|
|
177
223
|
def sell(self, asset: str, amount: float, time: int) -> dict:
|
|
178
224
|
"""Place a SELL (PUT) order."""
|
|
225
|
+
self._ensure_connected()
|
|
179
226
|
return self._run(self._async_client.sell(asset, amount, time))
|
|
180
227
|
|
|
181
228
|
def check_win(self, order_id: str) -> dict:
|
|
182
229
|
"""Check the result of a trade."""
|
|
230
|
+
self._ensure_connected()
|
|
183
231
|
return self._run(self._async_client.check_win(order_id))
|
|
184
232
|
|
|
185
233
|
def balance(self) -> float:
|
|
186
234
|
"""Get current balance."""
|
|
235
|
+
self._ensure_connected()
|
|
187
236
|
return self._run(self._async_client.balance())
|
|
188
237
|
|
|
189
238
|
def candles(self, asset: str, period: int) -> List[dict]:
|
|
190
239
|
"""Get historical candles."""
|
|
240
|
+
self._ensure_connected()
|
|
191
241
|
return self._run(self._async_client.candles(asset, period))
|
|
192
242
|
|
|
193
243
|
def get_candles(self, asset: str, period: int, count: int = 100) -> List[dict]:
|
|
194
244
|
"""Get historical candles with count."""
|
|
245
|
+
self._ensure_connected()
|
|
195
246
|
return self._run(self._async_client.get_candles(asset, period, count))
|
|
196
247
|
|
|
248
|
+
def get_ticks(self, asset: str) -> List[dict]:
|
|
249
|
+
"""Get tick series for an asset."""
|
|
250
|
+
self._ensure_connected()
|
|
251
|
+
return self._run(self._async_client.get_ticks(asset))
|
|
252
|
+
|
|
197
253
|
def get_candles_live(self, asset: str, period: int) -> SyncCandleLiveIterator:
|
|
198
254
|
"""Get live candle updates."""
|
|
255
|
+
self._ensure_connected()
|
|
199
256
|
async_gen = self._run(self._async_client.get_candles_live(asset, period))
|
|
200
257
|
return SyncCandleLiveIterator(async_gen, self._loop)
|
|
201
258
|
|
|
202
259
|
def subscribe_symbol(self, symbol: str) -> SyncSubscription:
|
|
203
260
|
"""Subscribe to price updates for a symbol."""
|
|
261
|
+
self._ensure_connected()
|
|
204
262
|
sub = self._run(self._async_client.subscribe_symbol(symbol))
|
|
205
263
|
return SyncSubscription(sub, self._loop)
|
|
206
264
|
|
|
207
265
|
def subscribe_raw(self) -> SyncRawSubscription:
|
|
208
266
|
"""Subscribe to all raw messages."""
|
|
267
|
+
self._ensure_connected()
|
|
209
268
|
sub = self._run(self._async_client.subscribe_raw())
|
|
210
269
|
return SyncRawSubscription(sub, self._loop)
|
|
211
270
|
|
|
212
271
|
def send_raw(self, message: str) -> None:
|
|
213
272
|
"""Send a raw message."""
|
|
273
|
+
self._ensure_connected()
|
|
214
274
|
self._run(self._async_client.send_raw(message))
|
|
215
275
|
|
|
216
276
|
def active_assets(self) -> List[dict]:
|
|
217
277
|
"""Get list of active assets."""
|
|
278
|
+
self._ensure_connected()
|
|
218
279
|
return self._run(self._async_client.active_assets())
|
|
219
280
|
|
|
220
281
|
def payout(self, asset: str) -> float:
|
|
221
282
|
"""Get payout for an asset."""
|
|
283
|
+
self._ensure_connected()
|
|
222
284
|
return self._run(self._async_client.payout(asset))
|
|
223
285
|
|
|
224
286
|
def history(self, limit: int = 100) -> List[dict]:
|
|
225
287
|
"""Get trade history."""
|
|
288
|
+
self._ensure_connected()
|
|
226
289
|
return self._run(self._async_client.history(limit))
|
|
227
290
|
|
|
228
291
|
def opened_deals(self) -> List[dict]:
|
|
229
292
|
"""Get opened deals."""
|
|
293
|
+
self._ensure_connected()
|
|
230
294
|
return self._run(self._async_client.opened_deals())
|
|
231
295
|
|
|
232
296
|
def closed_deals(self) -> List[dict]:
|
|
233
297
|
"""Get closed deals."""
|
|
298
|
+
self._ensure_connected()
|
|
234
299
|
return self._run(self._async_client.closed_deals())
|
|
235
300
|
|
|
236
301
|
def get_server_time(self) -> int:
|
|
237
302
|
"""Get server time."""
|
|
303
|
+
self._ensure_connected()
|
|
238
304
|
return self._run(self._async_client.get_server_time())
|
|
239
305
|
|
|
240
306
|
def raw_handler(self) -> RawHandlerSync:
|
|
241
307
|
"""Get raw handler for advanced operations."""
|
|
308
|
+
self._ensure_connected()
|
|
242
309
|
handler = self._run(self._async_client.raw_handler())
|
|
243
310
|
return RawHandlerSync(handler)
|
|
244
311
|
|
|
@@ -248,10 +315,16 @@ class CloseOption:
|
|
|
248
315
|
return
|
|
249
316
|
self._closed = True
|
|
250
317
|
if self._async_client:
|
|
251
|
-
|
|
318
|
+
try:
|
|
319
|
+
self._run(self._async_client.shutdown())
|
|
320
|
+
except Exception:
|
|
321
|
+
pass
|
|
252
322
|
self._async_client = None
|
|
253
323
|
if self._loop and self._loop.is_running():
|
|
254
324
|
self._loop.call_soon_threadsafe(self._loop.stop)
|
|
325
|
+
if self._thread and self._thread.is_alive():
|
|
326
|
+
self._thread.join(timeout=5.0)
|
|
327
|
+
|
|
255
328
|
def reconnect(self) -> None:
|
|
256
329
|
"""Reconnect to the server."""
|
|
257
|
-
return self._run(self._async_client.reconnect())
|
|
330
|
+
return self._run(self._async_client.reconnect())
|
|
@@ -24,7 +24,7 @@ class Config:
|
|
|
24
24
|
max_allowed_loops: int = 100
|
|
25
25
|
sleep_interval: int = 100
|
|
26
26
|
reconnect_time: int = 5
|
|
27
|
-
connection_initialization_timeout_secs: int =
|
|
27
|
+
connection_initialization_timeout_secs: int = 120
|
|
28
28
|
timeout_secs: int = 30
|
|
29
29
|
urls: List[str] = field(default_factory=list)
|
|
30
30
|
proxy: str = None
|
|
@@ -14,8 +14,11 @@ __all__ = [
|
|
|
14
14
|
"RawHandler",
|
|
15
15
|
"RawHandlerSync",
|
|
16
16
|
"Validator",
|
|
17
|
+
"Trade",
|
|
18
|
+
"TradeResult",
|
|
17
19
|
]
|
|
18
20
|
from .tools.login import login, login_async
|
|
19
21
|
from . import asynchronous, synchronous as synchronous
|
|
20
22
|
from .asynchronous import PocketOptionAsync, RawHandler, Validator
|
|
21
23
|
from .synchronous import PocketOption, RawHandlerSync
|
|
24
|
+
from .models import Trade, TradeResult
|