binaryoptionstoolsv2 0.1.2__tar.gz → 0.1.4__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.
Files changed (77) hide show
  1. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4/BinaryOptionsToolsV2}/BinaryOptionsToolsV2/asyncronous.py +23 -7
  2. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4/BinaryOptionsToolsV2}/BinaryOptionsToolsV2/syncronous.py +22 -5
  3. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/BinaryOptionsToolsV2/Cargo.lock +106 -63
  4. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/BinaryOptionsToolsV2/Cargo.toml +7 -3
  5. {BinaryOptionsToolsV2-0.1.2/BinaryOptionsToolsV2 → BinaryOptionsToolsV2-0.1.4}/BinaryOptionsToolsV2/asyncronous.py +23 -7
  6. BinaryOptionsToolsV2-0.1.4/BinaryOptionsToolsV2/candles_eurusd_otc.csv +1637 -0
  7. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/BinaryOptionsToolsV2/src/error.rs +23 -23
  8. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/BinaryOptionsToolsV2/src/lib.rs +15 -16
  9. BinaryOptionsToolsV2-0.1.4/BinaryOptionsToolsV2/src/pocketoption.rs +158 -0
  10. BinaryOptionsToolsV2-0.1.4/BinaryOptionsToolsV2/src/runtime.rs +18 -0
  11. {BinaryOptionsToolsV2-0.1.2/BinaryOptionsToolsV2 → BinaryOptionsToolsV2-0.1.4}/BinaryOptionsToolsV2/syncronous.py +22 -5
  12. BinaryOptionsToolsV2-0.1.4/BinaryOptionsToolsV2/tests/test.py +34 -0
  13. BinaryOptionsToolsV2-0.1.4/BinaryOptionsToolsV2/tests/test_sync.py +14 -0
  14. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/BinaryOptionsToolsV2/uv.lock +2 -2
  15. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/PKG-INFO +1 -1
  16. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/Cargo.toml +5 -2
  17. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/error.rs +3 -1
  18. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/general/client.rs +5 -5
  19. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/general/traits.rs +2 -1
  20. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/general/types.rs +2 -1
  21. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/error.rs +6 -2
  22. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/types/base.rs +6 -0
  23. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/types/data.rs +33 -9
  24. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/types/update.rs +52 -30
  25. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/validators.rs +12 -0
  26. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/ws/api.rs +53 -16
  27. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/ws/basic.rs +23 -8
  28. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/ws/listener.rs +1 -1
  29. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/ws/mod.rs +1 -0
  30. BinaryOptionsToolsV2-0.1.4/core/src/pocketoption/ws/stream.rs +63 -0
  31. BinaryOptionsToolsV2-0.1.2/BinaryOptionsToolsV2/candles_eurusd_otc.csv +0 -149
  32. BinaryOptionsToolsV2-0.1.2/BinaryOptionsToolsV2/src/pocketoption.rs +0 -105
  33. BinaryOptionsToolsV2-0.1.2/BinaryOptionsToolsV2/tests/test.py +0 -42
  34. BinaryOptionsToolsV2-0.1.2/BinaryOptionsToolsV2/tests/test_sync.py +0 -11
  35. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/BinaryOptionsToolsV2/.github/workflows/CI.yml +0 -0
  36. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/BinaryOptionsToolsV2/.gitignore +0 -0
  37. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/BinaryOptionsToolsV2/BinaryOptionsToolsV2/__init__.py +0 -0
  38. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/BinaryOptionsToolsV2/Readme.md +0 -0
  39. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/BinaryOptionsToolsV2/__init__.py +0 -0
  40. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/README.md +0 -0
  41. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/readme.md +0 -0
  42. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/general/mod.rs +0 -0
  43. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/lib.rs +0 -0
  44. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/mod.rs +0 -0
  45. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/parser/basic.rs +0 -0
  46. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/parser/message.rs +0 -0
  47. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/parser/mod.rs +0 -0
  48. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/pocket_client.rs +0 -0
  49. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/types/data_v2.rs +0 -0
  50. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/types/info.rs +0 -0
  51. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/types/mod.rs +0 -0
  52. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/types/order.rs +0 -0
  53. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/types/success.rs +0 -0
  54. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/types/user.rs +0 -0
  55. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/utils/basic.rs +0 -0
  56. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/utils/connect.rs +0 -0
  57. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/utils/location.rs +0 -0
  58. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/utils/mod.rs +0 -0
  59. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/ws/connect.rs +0 -0
  60. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/ws/regions.rs +0 -0
  61. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/pocketoption/ws/ssid.rs +0 -0
  62. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/utils/mod.rs +0 -0
  63. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/src/utils/tracing.rs +0 -0
  64. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/tests/assets.txt +0 -0
  65. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/tests/data.json +0 -0
  66. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/tests/load_history_period.json +0 -0
  67. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/tests/load_history_period2.json +0 -0
  68. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/tests/success_open_order.json +0 -0
  69. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/tests/success_update_pending.json +0 -0
  70. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/tests/test.json +0 -0
  71. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/tests/test_close_order.txt +0 -0
  72. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/tests/test_demo.json +0 -0
  73. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/tests/update_close_order.json +0 -0
  74. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/tests/update_closed_deals.txt +0 -0
  75. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/tests/update_history_new.json +0 -0
  76. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/core/tests/update_opened_deals.txt +0 -0
  77. {BinaryOptionsToolsV2-0.1.2 → BinaryOptionsToolsV2-0.1.4}/pyproject.toml +0 -0
@@ -1,10 +1,10 @@
1
- from BinaryOptionsToolsV2 import connect, RawPocketOption
1
+ from BinaryOptionsToolsV2 import RawPocketOption
2
2
  import json
3
3
 
4
4
  # This file contains all the async code for the PocketOption Module
5
5
  class PocketOptionAsync:
6
- def __init__(self, client: RawPocketOption):
7
- self.client = client
6
+ def __init__(self, ssid: str):
7
+ self.client = RawPocketOption(ssid)
8
8
 
9
9
  async def buy(self, asset: str, amount: float, time: int, check_win: bool = False):
10
10
  """
@@ -79,7 +79,23 @@ class PocketOptionAsync:
79
79
  return [payout.get(ast) for ast in asset]
80
80
  return payout
81
81
 
82
- async def async_connect(ssid: str, demo: bool) -> PocketOptionAsync:
83
- "Use this function to connect to the server, this works as the initialization for the `PocketOptionAsync` class"
84
- client = await connect(ssid, demo)
85
- return PocketOptionAsync(client)
82
+ async def history(self, asset: str, period: int):
83
+ "Returns a list of dictionaries containing the latest data available for the specified asset starting from 'period', the data is in the same format as the returned data of the 'get_candles' function."
84
+ return json.loads(await self.client.history(asset, period))
85
+
86
+ async def _subscribe_symbol_inner(self, asset: str):
87
+ return await self.client.subscribe_symbol(asset)
88
+
89
+ async def subscribe_symbol(self, asset: str):
90
+ """Returns an async iterator over the associated asset, it will return real time raw candles and will return new candles while the 'PocketOptionAsync' class is loaded if the class is droped then the iterator will fail"""
91
+ return AsyncSubscription(await self._subscribe_symbol_inner(asset))
92
+
93
+ class AsyncSubscription:
94
+ def __init__(self, subscription):
95
+ self.subscription = subscription
96
+
97
+ def __aiter__(self):
98
+ return self
99
+
100
+ async def __anext__(self):
101
+ return json.loads(await anext(self.subscription))
@@ -1,13 +1,12 @@
1
- from BinaryOptionsToolsV2.asyncronous import PocketOptionAsync, async_connect
1
+ import json
2
+ from BinaryOptionsToolsV2.asyncronous import PocketOptionAsync
2
3
  import asyncio
3
4
 
4
5
  class PocketOption:
5
6
  def __init__(self, ssid: str):
6
7
  "Creates a new instance of the PocketOption class"
7
8
  self.loop = asyncio.new_event_loop()
8
- self._client: PocketOptionAsync = self.loop.run_until_complete(
9
- async_connect(ssid)
10
- )
9
+ self._client = PocketOptionAsync(ssid)
11
10
 
12
11
  def __del__(self):
13
12
  self.loop.close()
@@ -58,4 +57,22 @@ class PocketOption:
58
57
 
59
58
  def payout(self, asset: None | str | list[str] = None):
60
59
  "Returns a dict of asset | payout for each asset, if 'asset' is not None then it will return the payout of the asset or a list of the payouts for each asset it was passed"
61
- return self.loop.run_until_complete(self._client.payout(asset))
60
+ return self.loop.run_until_complete(self._client.payout(asset))
61
+
62
+ def history(self, asset: str, period: int):
63
+ "Returns a list of dictionaries containing the latest data available for the specified asset starting from 'period', the data is in the same format as the returned data of the 'get_candles' function."
64
+ return self.loop.run_until_complete(self._client.history(asset, period))
65
+
66
+ def subscribe_symbol(self, asset: str):
67
+ """Returns an async iterator over the associated asset, it will return real time raw candles and will return new candles while the 'PocketOptionAsync' class is loaded if the class is droped then the iterator will fail"""
68
+ return SyncSubscription(self.loop.run_until_complete(self._client._subscribe_symbol_inner(asset)))
69
+
70
+ class SyncSubscription:
71
+ def __init__(self, subscription):
72
+ self.subscription = subscription
73
+
74
+ def __iter__(self):
75
+ return self
76
+
77
+ def __next__(self):
78
+ return json.loads(next(self.subscription))
@@ -4,14 +4,18 @@ version = 3
4
4
 
5
5
  [[package]]
6
6
  name = "BinaryOptionsToolsV2"
7
- version = "0.1.2"
7
+ version = "0.1.4"
8
8
  dependencies = [
9
9
  "binary-option-tools-core",
10
+ "futures-util",
10
11
  "pyo3",
11
- "pyo3-asyncio-0-21",
12
+ "pyo3-async-runtimes",
13
+ "pythonize",
12
14
  "serde",
13
15
  "serde_json",
14
16
  "thiserror",
17
+ "tokio",
18
+ "tracing",
15
19
  "uuid",
16
20
  ]
17
21
 
@@ -51,6 +55,18 @@ version = "1.0.94"
51
55
  source = "registry+https://github.com/rust-lang/crates.io-index"
52
56
  checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7"
53
57
 
58
+ [[package]]
59
+ name = "async-channel"
60
+ version = "2.3.1"
61
+ source = "registry+https://github.com/rust-lang/crates.io-index"
62
+ checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a"
63
+ dependencies = [
64
+ "concurrent-queue",
65
+ "event-listener-strategy",
66
+ "futures-core",
67
+ "pin-project-lite",
68
+ ]
69
+
54
70
  [[package]]
55
71
  name = "async-trait"
56
72
  version = "0.1.83"
@@ -100,11 +116,14 @@ name = "binary-option-tools-core"
100
116
  version = "0.1.0"
101
117
  dependencies = [
102
118
  "anyhow",
119
+ "async-channel",
103
120
  "async-trait",
104
121
  "chrono",
105
122
  "futures-util",
106
123
  "native-tls",
107
124
  "php_serde",
125
+ "pin-project",
126
+ "pin-project-lite",
108
127
  "rand",
109
128
  "reqwest",
110
129
  "serde",
@@ -181,6 +200,15 @@ dependencies = [
181
200
  "windows-targets",
182
201
  ]
183
202
 
203
+ [[package]]
204
+ name = "concurrent-queue"
205
+ version = "2.5.0"
206
+ source = "registry+https://github.com/rust-lang/crates.io-index"
207
+ checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
208
+ dependencies = [
209
+ "crossbeam-utils",
210
+ ]
211
+
184
212
  [[package]]
185
213
  name = "core-foundation"
186
214
  version = "0.9.4"
@@ -206,6 +234,12 @@ dependencies = [
206
234
  "libc",
207
235
  ]
208
236
 
237
+ [[package]]
238
+ name = "crossbeam-utils"
239
+ version = "0.8.21"
240
+ source = "registry+https://github.com/rust-lang/crates.io-index"
241
+ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
242
+
209
243
  [[package]]
210
244
  name = "crypto-common"
211
245
  version = "0.1.6"
@@ -268,6 +302,27 @@ dependencies = [
268
302
  "windows-sys 0.59.0",
269
303
  ]
270
304
 
305
+ [[package]]
306
+ name = "event-listener"
307
+ version = "5.3.1"
308
+ source = "registry+https://github.com/rust-lang/crates.io-index"
309
+ checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba"
310
+ dependencies = [
311
+ "concurrent-queue",
312
+ "parking",
313
+ "pin-project-lite",
314
+ ]
315
+
316
+ [[package]]
317
+ name = "event-listener-strategy"
318
+ version = "0.5.3"
319
+ source = "registry+https://github.com/rust-lang/crates.io-index"
320
+ checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2"
321
+ dependencies = [
322
+ "event-listener",
323
+ "pin-project-lite",
324
+ ]
325
+
271
326
  [[package]]
272
327
  name = "fastrand"
273
328
  version = "2.3.0"
@@ -447,9 +502,9 @@ checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
447
502
 
448
503
  [[package]]
449
504
  name = "heck"
450
- version = "0.4.1"
505
+ version = "0.5.0"
451
506
  source = "registry+https://github.com/rust-lang/crates.io-index"
452
- checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
507
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
453
508
 
454
509
  [[package]]
455
510
  name = "http"
@@ -787,16 +842,6 @@ version = "0.7.4"
787
842
  source = "registry+https://github.com/rust-lang/crates.io-index"
788
843
  checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104"
789
844
 
790
- [[package]]
791
- name = "lock_api"
792
- version = "0.4.12"
793
- source = "registry+https://github.com/rust-lang/crates.io-index"
794
- checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
795
- dependencies = [
796
- "autocfg",
797
- "scopeguard",
798
- ]
799
-
800
845
  [[package]]
801
846
  name = "log"
802
847
  version = "0.4.22"
@@ -946,27 +991,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
946
991
  checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
947
992
 
948
993
  [[package]]
949
- name = "parking_lot"
950
- version = "0.12.3"
951
- source = "registry+https://github.com/rust-lang/crates.io-index"
952
- checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
953
- dependencies = [
954
- "lock_api",
955
- "parking_lot_core",
956
- ]
957
-
958
- [[package]]
959
- name = "parking_lot_core"
960
- version = "0.9.10"
994
+ name = "parking"
995
+ version = "2.2.1"
961
996
  source = "registry+https://github.com/rust-lang/crates.io-index"
962
- checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
963
- dependencies = [
964
- "cfg-if",
965
- "libc",
966
- "redox_syscall",
967
- "smallvec",
968
- "windows-targets",
969
- ]
997
+ checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"
970
998
 
971
999
  [[package]]
972
1000
  name = "percent-encoding"
@@ -985,6 +1013,26 @@ dependencies = [
985
1013
  "smallvec",
986
1014
  ]
987
1015
 
1016
+ [[package]]
1017
+ name = "pin-project"
1018
+ version = "1.1.7"
1019
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1020
+ checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95"
1021
+ dependencies = [
1022
+ "pin-project-internal",
1023
+ ]
1024
+
1025
+ [[package]]
1026
+ name = "pin-project-internal"
1027
+ version = "1.1.7"
1028
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1029
+ checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c"
1030
+ dependencies = [
1031
+ "proc-macro2",
1032
+ "quote",
1033
+ "syn",
1034
+ ]
1035
+
988
1036
  [[package]]
989
1037
  name = "pin-project-lite"
990
1038
  version = "0.2.15"
@@ -1029,15 +1077,15 @@ dependencies = [
1029
1077
 
1030
1078
  [[package]]
1031
1079
  name = "pyo3"
1032
- version = "0.21.2"
1080
+ version = "0.23.3"
1033
1081
  source = "registry+https://github.com/rust-lang/crates.io-index"
1034
- checksum = "a5e00b96a521718e08e03b1a622f01c8a8deb50719335de3f60b3b3950f069d8"
1082
+ checksum = "e484fd2c8b4cb67ab05a318f1fd6fa8f199fcc30819f08f07d200809dba26c15"
1035
1083
  dependencies = [
1036
1084
  "cfg-if",
1037
1085
  "indoc",
1038
1086
  "libc",
1039
1087
  "memoffset",
1040
- "parking_lot",
1088
+ "once_cell",
1041
1089
  "portable-atomic",
1042
1090
  "pyo3-build-config",
1043
1091
  "pyo3-ffi",
@@ -1046,10 +1094,10 @@ dependencies = [
1046
1094
  ]
1047
1095
 
1048
1096
  [[package]]
1049
- name = "pyo3-asyncio-0-21"
1050
- version = "0.21.0"
1097
+ name = "pyo3-async-runtimes"
1098
+ version = "0.23.0"
1051
1099
  source = "registry+https://github.com/rust-lang/crates.io-index"
1052
- checksum = "8fde289486f7d5cee0ac7c20b2637a0657654681079cc5eedc90d9a2a79af1e5"
1100
+ checksum = "977dc837525cfd22919ba6a831413854beb7c99a256c03bf8624ad707e45810e"
1053
1101
  dependencies = [
1054
1102
  "futures",
1055
1103
  "once_cell",
@@ -1060,9 +1108,9 @@ dependencies = [
1060
1108
 
1061
1109
  [[package]]
1062
1110
  name = "pyo3-build-config"
1063
- version = "0.21.2"
1111
+ version = "0.23.3"
1064
1112
  source = "registry+https://github.com/rust-lang/crates.io-index"
1065
- checksum = "7883df5835fafdad87c0d888b266c8ec0f4c9ca48a5bed6bbb592e8dedee1b50"
1113
+ checksum = "dc0e0469a84f208e20044b98965e1561028180219e35352a2afaf2b942beff3b"
1066
1114
  dependencies = [
1067
1115
  "once_cell",
1068
1116
  "target-lexicon",
@@ -1070,9 +1118,9 @@ dependencies = [
1070
1118
 
1071
1119
  [[package]]
1072
1120
  name = "pyo3-ffi"
1073
- version = "0.21.2"
1121
+ version = "0.23.3"
1074
1122
  source = "registry+https://github.com/rust-lang/crates.io-index"
1075
- checksum = "01be5843dc60b916ab4dad1dca6d20b9b4e6ddc8e15f50c47fe6d85f1fb97403"
1123
+ checksum = "eb1547a7f9966f6f1a0f0227564a9945fe36b90da5a93b3933fc3dc03fae372d"
1076
1124
  dependencies = [
1077
1125
  "libc",
1078
1126
  "pyo3-build-config",
@@ -1080,9 +1128,9 @@ dependencies = [
1080
1128
 
1081
1129
  [[package]]
1082
1130
  name = "pyo3-macros"
1083
- version = "0.21.2"
1131
+ version = "0.23.3"
1084
1132
  source = "registry+https://github.com/rust-lang/crates.io-index"
1085
- checksum = "77b34069fc0682e11b31dbd10321cbf94808394c56fd996796ce45217dfac53c"
1133
+ checksum = "fdb6da8ec6fa5cedd1626c886fc8749bdcbb09424a86461eb8cdf096b7c33257"
1086
1134
  dependencies = [
1087
1135
  "proc-macro2",
1088
1136
  "pyo3-macros-backend",
@@ -1092,9 +1140,9 @@ dependencies = [
1092
1140
 
1093
1141
  [[package]]
1094
1142
  name = "pyo3-macros-backend"
1095
- version = "0.21.2"
1143
+ version = "0.23.3"
1096
1144
  source = "registry+https://github.com/rust-lang/crates.io-index"
1097
- checksum = "08260721f32db5e1a5beae69a55553f56b99bd0e1c3e6e0a5e8851a9d0f5a85c"
1145
+ checksum = "38a385202ff5a92791168b1136afae5059d3ac118457bb7bc304c197c2d33e7d"
1098
1146
  dependencies = [
1099
1147
  "heck",
1100
1148
  "proc-macro2",
@@ -1103,6 +1151,16 @@ dependencies = [
1103
1151
  "syn",
1104
1152
  ]
1105
1153
 
1154
+ [[package]]
1155
+ name = "pythonize"
1156
+ version = "0.23.0"
1157
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1158
+ checksum = "91a6ee7a084f913f98d70cdc3ebec07e852b735ae3059a1500db2661265da9ff"
1159
+ dependencies = [
1160
+ "pyo3",
1161
+ "serde",
1162
+ ]
1163
+
1106
1164
  [[package]]
1107
1165
  name = "quote"
1108
1166
  version = "1.0.37"
@@ -1142,15 +1200,6 @@ dependencies = [
1142
1200
  "getrandom",
1143
1201
  ]
1144
1202
 
1145
- [[package]]
1146
- name = "redox_syscall"
1147
- version = "0.5.8"
1148
- source = "registry+https://github.com/rust-lang/crates.io-index"
1149
- checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834"
1150
- dependencies = [
1151
- "bitflags",
1152
- ]
1153
-
1154
1203
  [[package]]
1155
1204
  name = "reqwest"
1156
1205
  version = "0.12.9"
@@ -1282,12 +1331,6 @@ dependencies = [
1282
1331
  "windows-sys 0.59.0",
1283
1332
  ]
1284
1333
 
1285
- [[package]]
1286
- name = "scopeguard"
1287
- version = "1.2.0"
1288
- source = "registry+https://github.com/rust-lang/crates.io-index"
1289
- checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
1290
-
1291
1334
  [[package]]
1292
1335
  name = "security-framework"
1293
1336
  version = "2.11.1"
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "BinaryOptionsToolsV2"
3
- version = "0.1.2"
3
+ version = "0.1.4"
4
4
  edition = "2021"
5
5
  description = "A library to connect to PocketOption using python with async and sync support."
6
6
  license = "BSD License (BSD)"
@@ -13,11 +13,15 @@ name = "BinaryOptionsToolsV2"
13
13
  crate-type = ["cdylib"]
14
14
 
15
15
  [dependencies]
16
- pyo3 = "0.21.0"
16
+ pyo3 = { version = "0.23.3", features = ["experimental-async"] }
17
+ pyo3-async-runtimes = { version = "0.23.0", features = ["tokio-runtime"] }
17
18
 
18
19
  binary-option-tools-core = { path = "../core" }
19
20
  thiserror = "2.0.9"
20
- pyo3-asyncio-0-21 = { version = "0.21.0", features = ["tokio-runtime"] }
21
21
  serde = { version = "1.0.216", features = ["derive"] }
22
22
  serde_json = "1.0.134"
23
23
  uuid = "1.11.0"
24
+ tracing = "0.1.41"
25
+ tokio = "1.42.0"
26
+ futures-util = "0.3.31"
27
+ pythonize = "0.23.0"
@@ -1,10 +1,10 @@
1
- from BinaryOptionsToolsV2 import connect, RawPocketOption
1
+ from BinaryOptionsToolsV2 import RawPocketOption
2
2
  import json
3
3
 
4
4
  # This file contains all the async code for the PocketOption Module
5
5
  class PocketOptionAsync:
6
- def __init__(self, client: RawPocketOption):
7
- self.client = client
6
+ def __init__(self, ssid: str):
7
+ self.client = RawPocketOption(ssid)
8
8
 
9
9
  async def buy(self, asset: str, amount: float, time: int, check_win: bool = False):
10
10
  """
@@ -79,7 +79,23 @@ class PocketOptionAsync:
79
79
  return [payout.get(ast) for ast in asset]
80
80
  return payout
81
81
 
82
- async def async_connect(ssid: str, demo: bool) -> PocketOptionAsync:
83
- "Use this function to connect to the server, this works as the initialization for the `PocketOptionAsync` class"
84
- client = await connect(ssid, demo)
85
- return PocketOptionAsync(client)
82
+ async def history(self, asset: str, period: int):
83
+ "Returns a list of dictionaries containing the latest data available for the specified asset starting from 'period', the data is in the same format as the returned data of the 'get_candles' function."
84
+ return json.loads(await self.client.history(asset, period))
85
+
86
+ async def _subscribe_symbol_inner(self, asset: str):
87
+ return await self.client.subscribe_symbol(asset)
88
+
89
+ async def subscribe_symbol(self, asset: str):
90
+ """Returns an async iterator over the associated asset, it will return real time raw candles and will return new candles while the 'PocketOptionAsync' class is loaded if the class is droped then the iterator will fail"""
91
+ return AsyncSubscription(await self._subscribe_symbol_inner(asset))
92
+
93
+ class AsyncSubscription:
94
+ def __init__(self, subscription):
95
+ self.subscription = subscription
96
+
97
+ def __aiter__(self):
98
+ return self
99
+
100
+ async def __anext__(self):
101
+ return json.loads(await anext(self.subscription))