The Python API is robust and modern for integration with PocketOption, offering a simple and efficient interface for automatic operation.
- 🔐 Secure Authentication: Login via SSID or Browser and robust session management
- 💹 Automated Trading: Programmatic buying and selling operations
- 📊 Real Time Data: WebSocket for quotes and operations
- 📈 Technical Analysis: Access to historical data and indicators
- 🛡️ Stability: Automatic reconnection and error handling
- 🔄 Universal: Demo and real account support
git clone https://github.com/Mastaaa1987/PocketOptionAPI-v2.git
cd PocketOptionAPI-v2
pip install -e .pip install git+https://github.com/Mastaaa1987/PocketOptionAPI-v2.gitfrom pocketoptionapi.stable_api import PocketOption
import time
#### You not need to set the SSID Manual, because the API will get the SSID automatic after you Login into Pocketoption via pywebview!
#### If you want to work with Real Account you only to set demo to False (default demo is set to True ...)
## Session configuration
# ssid = """42["auth",{"session":"asdasdasddsad","isDemo":1,"uid":12345465,"platform":2}]"""
demo = False # True for demo account, False for real account
symbol = "AEDCNY_otc"
period = 60
# Initialize API
api = PocketOption(demo)
# Connect
api.connect()
time.sleep(3)
# Check balance
saldo = api.GetBalance()
print(saldo)
time.sleep(1)
# Get Pairs
pairs = api.GetPairs()
print(pairs)
time.sleep(1)
# Change Symbol
status = api.ChangeSymbol(symbol, period) # api.ChangeSymbol(pair, expirations)
print(status)
time.sleep(1)
# Trade
status, id = api.Buy(5, symbol, 'put', period) # api.Buy(amount, pair, action, expirations)
print(status, id)
time.sleep(1)
# Check Trade
profit, status = api.CheckWin(id)
print(profit, status)
time.sleep(1)
# Get History Data
history = api.GetHistory(symbol) # api.GetHistory(pair)
print("len api.GetHistory: ", len(history))
# Get Live Ticks
for i in range(0, 10):
time.sleep(1)
ticks = api.GetTicks(symbol) # api.GetTicks(pair)
print("len api.GetTicks: ", len(ticks))
time.sleep(1)
print("len global_value.pairs ticks: ", len(global_value.pairs[symbol]['ticks']))
time.sleep(1)
print("len global_value.pairs history: ", len(global_value.pairs[symbol]['history']))
pair = "EURUSD_otc"
period = 60
days = 1
time_start = int(datetime.now().timestamp())
time_end = time_start - 86400 * days
df = api.get_history(
pair,
period,
start_time=time_start,
end_time=time_end)websocket-client>=1.6.1
requests>=2.31.0
python-dateutil>=2.8.2
tzlocal>=5.1
websockets>=15.0
pandas>=2.0.3
colorama>=0.4.6
pywebview>=6.2.1You not need to get the SSID anymore! You can easy login on PocketOption Page via pywebview ...
To get the SSID required for authentication:
1. Log in to the PocketOption platform via browser
2. Open Developer Tools (F12)
3. Go to the "Network" tab
4. Look for WebSocket connections
5. Find the authentication message that contains the SSID
6. Copy the full SSID in the format shown in the example
How To get SSID.docx HERE
Your contribution is very welcome! Follow these steps:
- 🍴 Fork this repository
- 🔄 Create a branch for your feature
git checkout -b feature/MinhaFeature
- 💻 Make your changes
- ✅ Commit using conventional messages
git commit -m "feat: Adds new functionality" - 📤 Push to your branch
git push origin feature/MinhaFeature
- 🔍 Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This project is an unofficial implementation and has no connection with PocketOption. Use at your own risk.
- 📧 Email: [email protected]
- 💬 Telegram: @mastaaa667
- 🌐 Website: mastaaa1987.site
Powered ❤️ by Mastaaa1987
