All retrieved OTC candles RED issue
The candles returned from get_candles("GBPJPY_otc", 60, 20) are not real. They donβt reflect the actual chart β all are red or doji.
Looks like something is wrong with how OTC data is fetched or interpreted.
Please check.
2025-07-25 18:02:05.939 | SUCCESS | pocketoptionapi_async.client:_on_json_data:1027 - Candles data received: 96 candles for GBPJPY_otc 2025-07-25 18:02:05.940 | INFO | pocketoptionapi_async.client:get_candles:495 - Retrieved 96 candles for GBPJPY_otc 2025-07-25 18:02:05.947 | INFO | pocketoptionapi_async.client:disconnect:347 - Disconnecting from PocketOption... 2025-07-25 18:02:05.948 | INFO | pocketoptionapi_async.websocket_client:disconnect:296 - Disconnecting from WebSocket 2025-07-25 18:02:05.948 | DEBUG | pocketoptionapi_async.websocket_client:_process_message:565 - Received message: 451-["updateStream",{"_placeholder":true,"num":0}] 2025-07-25 18:02:05.948 | DEBUG | pocketoptionapi_async.client:_on_stream_update:1166 - π‘ Stream update: {'_placeholder': True, 'num': 0} π©π₯ Candle Colors (Oldest β Newest):
- 2025-07-25 18:22:00 | O: 207.84800, C: 207.78500 β Ξ: -0.06300 (-0.03%) π₯ RED
- 2025-07-25 18:23:00 | O: 207.99600, C: 207.99600 β Ξ: +0.00000 (+0.00%) β¬ DOJI
- 2025-07-25 18:24:00 | O: 208.17000, C: 208.02600 β Ξ: -0.14400 (-0.07%) π₯ RED
- 2025-07-25 18:25:00 | O: 208.32900, C: 208.31900 β Ξ: -0.01000 (-0.00%) π₯ RED
- 2025-07-25 18:26:00 | O: 208.47800, C: 208.44800 β Ξ: -0.03000 (-0.01%) π₯ RED
- 2025-07-25 18:27:00 | O: 208.67200, C: 208.66400 β Ξ: -0.00800 (-0.00%) π₯ RED
- 2025-07-25 18:28:00 | O: 208.75900, C: 208.72700 β Ξ: -0.03200 (-0.02%) π₯ RED
- 2025-07-25 18:29:00 | O: 208.89900, C: 208.71600 β Ξ: -0.18300 (-0.09%) π₯ RED
- 2025-07-25 18:30:00 | O: 208.71100, C: 208.61200 β Ξ: -0.09900 (-0.05%) π₯ RED
- 2025-07-25 18:31:00 | O: 208.77900, C: 208.69300 β Ξ: -0.08600 (-0.04%) π₯ RED
- 2025-07-25 18:32:00 | O: 208.87500, C: 208.78900 β Ξ: -0.08600 (-0.04%) π₯ RED
- 2025-07-25 18:33:00 | O: 208.89600, C: 208.68300 β Ξ: -0.21300 (-0.10%) π₯ RED
- 2025-07-25 18:34:00 | O: 208.71500, C: 208.58300 β Ξ: -0.13200 (-0.06%) π₯ RED
- 2025-07-25 18:35:00 | O: 208.58400, C: 208.40600 β Ξ: -0.17800 (-0.09%) π₯ RED
- 2025-07-25 18:36:00 | O: 208.45900, C: 208.23600 β Ξ: -0.22300 (-0.11%) π₯ RED
- 2025-07-25 18:37:00 | O: 208.23700, C: 208.09700 β Ξ: -0.14000 (-0.07%) π₯ RED
- 2025-07-25 18:38:00 | O: 208.14000, C: 208.06300 β Ξ: -0.07700 (-0.04%) π₯ RED
- 2025-07-25 18:39:00 | O: 208.19000, C: 208.19000 β Ξ: +0.00000 (+0.00%) β¬ DOJI
- 2025-07-25 18:40:00 | O: 208.24400, C: 208.03700 β Ξ: -0.20700 (-0.10%) π₯ RED
- 2025-07-25 18:41:00 | O: 208.05400, C: 207.98000 β Ξ: -0.07400 (-0.04%) π₯ RED
My code:
import asyncio
import traceback
from pocketoptionapi_async import AsyncPocketOptionClient
async def check_otc_candle_colors():
ssid = ''
asset = "GBPJPY_otc"
timeframe = 60 # 1-minute candles
count = 10
print(f"\nπ Fetching last {count} 1-minute candles for {asset.upper()}...\n")
client = AsyncPocketOptionClient(
ssid=ssid,
is_demo=False,
uid=107249156,
platform=2,
enable_logging=True
)
try:
await client.connect()
candles = await client.get_candles(asset, timeframe, count)
if not candles:
print("β οΈ No candle data received.")
return
# Reverse for proper order (oldest to newest)
candles = list(reversed(candles))
print("π©π₯ Candle Colors (Oldest β Newest):")
print("-" * 80)
for i, candle in enumerate(candles, 1):
o = candle.open
c = candle.close
delta = c - o
pct = (delta / o * 100) if o else 0
color = "π© GREEN" if c > o else "π₯ RED" if c < o else "β¬ DOJI"
print(
f"{i:>2}. {candle.timestamp.strftime('%Y-%m-%d %H:%M:%S')} | "
f"O: {o:.5f}, C: {c:.5f} β Ξ: {delta:+.5f} ({pct:+.2f}%) {color}"
)
except Exception as e:
print("\nβ Error occurred:")
traceback.print_exc()
finally:
await client.disconnect()
print("\nβ
Disconnected.")
if __name__ == "__main__":
asyncio.run(check_otc_candle_colors())
Bump.
The latest API is BinaryOptionsToolsV2
BinaryOptionsToolsV2
Can you send me link, please?
https://github.com/ChipaDevTeam/BinaryOptionsTools-v2
https://github.com/ChipaDevTeam/BinaryOptionsTools-v2
Finally got it to install. This is my script, and it's not working with my SSID. I did exactly as stated in your doc file to copy AUTH from WS at Network tab. Not sure what I'm doing wrong. Please check.
import asyncio
from BinaryOptionsToolsV2.pocketoption.asyncronous import PocketOptionAsync
SSID = '42["auth",{"session":"a:4:{s:10:\"session_id\";s:32:\"[REDACTED_SESSION_ID]\";s:10:\"ip_address\";s:12:\"[REDACTED_IP]\";s:10:\"user_agent\";s:111:\"[REDACTED_USER_AGENT]\";s:13:\"last_activity\";i:[REDACTED_TIMESTAMP];}[REDACTED_SIGNATURE]","isDemo":0,"uid":[REDACTED_UID],"platform":2,"isFastHistory":true,"isOptimized":true}]'
async def main():
client = PocketOptionAsync(ssid=SSID)
try:
print("π‘ Fetching latest 10 candles for EURUSD_otc...")
candles = await client.get_candles("EURUSD_otc", period=60, offset=10)
print("π Historical 1-Minute Candles (Latest Last):\n")
for c in candles:
print(
f"{c['time']} | Open: {c['open']} | High: {c['high']} | "
f"Low: {c['low']} | Close: {c['close']}"
)
except Exception as e:
print("β Error:", e)
finally:
await asyncio.sleep(1)
print("β
Done.")
# Run the async main
if __name__ == "__main__":
asyncio.run(main())
Traceback (most recent call last): File "C:\Users\user\PycharmProjects\G_Diego\test_ssid.py", line 29, in
asyncio.run(main()) File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 650, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "C:\Users\user\PycharmProjects\G_Diego\test_ssid.py", line 7, in main client = PocketOptionAsync(ssid=SSID) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\PycharmProjects\G_Diego.venv\Lib\site-packages\BinaryOptionsToolsV2\pocketoption\asyncronous.py", line 21, in init self.client = RawPocketOption(ssid) ^^^^^^^^^^^^^^^^^^^^^ ValueError: PocketOptionError, Failed to parse SSID: expected ,or}at line 1 column 24
Try with the demo ssid, I think the format is incorrect of that ssid
Try with the demo ssid, I think the format is incorrect of that ssid
I want to try with real ssid for real trading. How should the format be?
Tried it with demo, doesn't work... Not sure what I'm doing wrong.
import asyncio
from BinaryOptionsToolsV2.pocketoption.asyncronous import PocketOptionAsync
SSID = '42["auth",{"session":"ogkoou7dd7ua8lio0hl4bhbjrk","isDemo":1,"uid":107249156,"platform":2,"isFastHistory":true,"isOptimized":true}]'
async def main():
client = PocketOptionAsync(ssid=SSID)
try:
print("π‘ Fetching latest 10 candles for EURUSD_otc...")
candles = await client.get_candles("EURUSD_otc", period=60, offset=10)
print("π Historical 1-Minute Candles (Latest Last):\n")
for c in candles:
print(
f"{c['time']} | Open: {c['open']} | High: {c['high']} | "
f"Low: {c['low']} | Close: {c['close']}"
)
except Exception as e:
print("β Error:", e)
finally:
await asyncio.sleep(1)
print("β
Done.")
# Run the async main
if __name__ == "__main__":
asyncio.run(main())
π‘ Fetching latest 10 candles for EURUSD_otc... Failded once trying again β Error: PocketOptionError, BinaryOptionsToolsError, Failed to execute 'GetCandles' task before the maximum allowed time of '16s' β Done.
I think get candles does not work, you need to use the subscribe_symbol function
Like this: https://github.com/ChipaDevTeam/BinaryOptionsTools-v2/blob/master/examples%2Fpython%2Fasync%2Fsubscribe_symbol_timed.py
I think get candles does not work, you need to use the subscribe_symbol function
I need to get candles OHCL to determine if it's red/green - latest 10 candles. I do not want to subscribe to websocket. I hope I understood you clearly. I just want it to be like REST API - to query candlesticks.
Sure, we'll, soon @Rick-29 will let you know once it starts working
Try passing the ssid as an input.
Something like
PocketOptionAsync(input("Enter ssid: "))
If that works then the error is on how python processes the strings.
Sure, we'll, soon @Rick-29 will let you know once it starts working
This doesn't work either. Tried demo SSID.
from BinaryOptionsToolsV2.pocketoption import PocketOptionAsync
import pandas as pd
import asyncio
# Main part of the code
async def main(ssid: str):
# The api automatically detects if the 'ssid' is for real or demo account
api = PocketOptionAsync(ssid)
await asyncio.sleep(5)
# Candles are returned in the format of a list of dictionaries
candles = await api.history("EURUSD_otc", 3600)
print(f"Raw Candles: {candles}")
candles_pd = pd.DataFrame.from_dict(candles)
print(f"Candles: {candles_pd}")
if __name__ == '__main__':
ssid = input('Please enter your ssid: ')
asyncio.run(main(ssid))
C:\Users\user\PycharmProjects\G_Diego.venv\Scripts\python.exe C:\Users\user\PycharmProjects\G_Diego\test_ssid2.py Please enter your ssid: 42["auth",{"session":"ogkoou7dd7ua8lio0hl4bhbjrk","isDemo":1,"uid":107249156,"platform":2,"isFastHistory":true,"isOptimized":true}] Failded once trying again Traceback (most recent call last): File "C:\Users\user\PycharmProjects\G_Diego\test_ssid2.py", line 22, in
asyncio.run(main(ssid)) File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 650, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "C:\Users\user\PycharmProjects\G_Diego\test_ssid2.py", line 14, in main candles = await api.history("EURUSD_otc", 3600) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\PycharmProjects\G_Diego.venv\Lib\site-packages\BinaryOptionsToolsV2\pocketoption\asyncronous.py", line 117, in history return json.loads(await self.client.history(asset, period)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: PocketOptionError, BinaryOptionsToolsError, Failed to execute 'History' task before the maximum allowed time of '16s' Process finished with exit code 1
I think this issue is with the history function
the error is very simple to solve, the latest release on pypi is not working. check here for the latest wheels for windows https://github.com/ChipaDevTeam/BinaryOptionsTools-v2/tree/master/wheels
the error is very simple to solve, the latest release on pypi is not working. check here for the latest wheels for windows https://github.com/ChipaDevTeam/BinaryOptionsTools-v2/tree/master/wheels
Uninstalled, and installed a wheel for 3.11 python. 'history' error this time...
Re-tried the code:
from BinaryOptionsToolsV2.pocketoption import PocketOptionAsync
import pandas as pd
import asyncio
# Main part of the code
async def main(ssid: str):
# The api automatically detects if the 'ssid' is for real or demo account
api = PocketOptionAsync(ssid)
await asyncio.sleep(5)
# Candles are returned in the format of a list of dictionaries
candles = await api.history("EURUSD_otc", 3600)
print(f"Raw Candles: {candles}")
candles_pd = pd.DataFrame.from_dict(candles)
print(f"Candles: {candles_pd}")
if __name__ == '__main__':
ssid = input('Please enter your ssid: ')
asyncio.run(main(ssid))
Please enter your ssid: 42["auth",{"session":"ogkoou7dd7ua8lio0hl4bhbjrk","isDemo":1,"uid":107249156,"platform":2,"isFastHistory":true,"isOptimized":true}] Traceback (most recent call last): File "C:\Users\user\PycharmProjects\G_Diego\test_ssid2.py", line 22, in
asyncio.run(main(ssid)) File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 650, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "C:\Users\user\PycharmProjects\G_Diego\test_ssid2.py", line 14, in main candles = await api.history("EURUSD_otc", 3600) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\PycharmProjects\G_Diego.venv\Lib\site-packages\BinaryOptionsToolsV2\pocketoption\asyncronous.py", line 307, in history raise NotImplementedError( NotImplementedError: The history method is not implemented in the PocketOptionAsync class.
@Rick-29 does the get candles work?
It works but for the binaryoptionstoolsv2 library
The history function is not implemented
I'm trying to get latest last 1 min candles for EURUSD_OTC, but the charts do not match with PocketOption demo. Please tell me what's wrong. They're different candles.
from BinaryOptionsToolsV2.pocketoption import PocketOptionAsync
import pandas as pd
import asyncio
import mplfinance as mpf
async def main(ssid: str):
print("π‘ Fetching latest 10 candles for EURUSD_otc...")
api = PocketOptionAsync(ssid)
await asyncio.sleep(5)
try:
# Get 10 x 1-min candles ending now (period = 60s * 10, offset = 60)
candles = await api.get_candles("EURUSD_otc", period=60, offset=600)
print(f"β
Candles received: {len(candles)}")
if not candles or len(candles) < 10:
print("β οΈ Not enough candle data received.")
return
df = pd.DataFrame(candles)
# Fix for either 'time' or 'timestamp' key depending on server output
ts_col = 'timestamp' if 'timestamp' in df.columns else 'time'
df[ts_col] = pd.to_datetime(df[ts_col], unit='s')
df.set_index(ts_col, inplace=True)
df.rename(columns={
'open': 'Open',
'high': 'High',
'low': 'Low',
'close': 'Close'
}, inplace=True)
df.sort_index(inplace=True)
df = df.tail(10)
df.to_csv("latest_10_candles.csv")
print("π Saved to 'latest_10_candles.csv'")
mpf.plot(
df,
type='candle',
style='charles',
title='EURUSD_otc - Last 10 1min Candles',
ylabel='Price',
volume=False
)
except Exception as e:
print("β Error:", e)
if __name__ == '__main__':
ssid = '42["auth",{"session":"ogkoou7dd7ua8lio0hl4bhbjrk","isDemo":1,"uid":107249156,"platform":2,"isFastHistory":true,"isOptimized":true}]'
asyncio.run(main(ssid))