forked from ChipaDevTeam/BinaryOptionsTools-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathraw_send.py
More file actions
41 lines (31 loc) · 1.38 KB
/
raw_send.py
File metadata and controls
41 lines (31 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import asyncio
from BinaryOptionsToolsV2.pocketoption import PocketOptionAsync
async def main(ssid: str):
# Initialize the API client
async with PocketOptionAsync(ssid) as api:
# Example of sending a raw message
try:
# Subscribe to signals
await api.send_raw_message('42["signals/subscribe"]')
print("Sent signals subscription message")
# Subscribe to price updates
await api.send_raw_message('42["price/subscribe"]')
print("Sent price subscription message")
# Custom message example
custom_message = '42["custom/event",{"param":"value"}]'
await api.send_raw_message(custom_message)
print(f"Sent custom message: {custom_message}")
# Multiple messages in sequence
messages = [
'42["chart/subscribe",{"asset":"EURUSD"}]',
'42["trades/subscribe"]',
'42["notifications/subscribe"]',
]
for msg in messages:
await api.send_raw_message(msg)
print(f"Sent message: {msg}")
await asyncio.sleep(1) # Small delay between messages
except Exception as e:
print(f"Error sending message: {e}")
if __name__ == "__main__":
ssid = input("Please enter your ssid: ")