-
-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathraw_send.py
More file actions
31 lines (22 loc) · 891 Bytes
/
Copy pathraw_send.py
File metadata and controls
31 lines (22 loc) · 891 Bytes
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
import time
from BinaryOptionsToolsV2.pocketoption import PocketOption
def main(ssid: str):
# Initialize the API client
api = PocketOption(ssid)
time.sleep(5) # Wait for connection to establish
# Example of sending a raw message
try:
# Subscribe to signals
api.raw_send('42["signals/subscribe"]')
print("Sent signals subscription message")
# Subscribe to price updates
api.raw_send('42["price/subscribe"]')
print("Sent price subscription message")
# Custom message example
custom_message = '42["custom/event",{"param":"value"}]'
api.raw_send(custom_message)
print(f"Sent custom message: {custom_message}")
except Exception as e:
print(f"Error sending message: {e}")
if __name__ == "__main__":
ssid = input("Please enter your ssid: ")