Thanks to visit codestin.com
Credit goes to github.com

Skip to content

All retrieved OTC candles RED issue #36

@Anon666999

Description

@Anon666999

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):

  1. 2025-07-25 18:22:00 | O: 207.84800, C: 207.78500 → Δ: -0.06300 (-0.03%) 🟥 RED
  2. 2025-07-25 18:23:00 | O: 207.99600, C: 207.99600 → Δ: +0.00000 (+0.00%) ⬛ DOJI
  3. 2025-07-25 18:24:00 | O: 208.17000, C: 208.02600 → Δ: -0.14400 (-0.07%) 🟥 RED
  4. 2025-07-25 18:25:00 | O: 208.32900, C: 208.31900 → Δ: -0.01000 (-0.00%) 🟥 RED
  5. 2025-07-25 18:26:00 | O: 208.47800, C: 208.44800 → Δ: -0.03000 (-0.01%) 🟥 RED
  6. 2025-07-25 18:27:00 | O: 208.67200, C: 208.66400 → Δ: -0.00800 (-0.00%) 🟥 RED
  7. 2025-07-25 18:28:00 | O: 208.75900, C: 208.72700 → Δ: -0.03200 (-0.02%) 🟥 RED
  8. 2025-07-25 18:29:00 | O: 208.89900, C: 208.71600 → Δ: -0.18300 (-0.09%) 🟥 RED
  9. 2025-07-25 18:30:00 | O: 208.71100, C: 208.61200 → Δ: -0.09900 (-0.05%) 🟥 RED
  10. 2025-07-25 18:31:00 | O: 208.77900, C: 208.69300 → Δ: -0.08600 (-0.04%) 🟥 RED
  11. 2025-07-25 18:32:00 | O: 208.87500, C: 208.78900 → Δ: -0.08600 (-0.04%) 🟥 RED
  12. 2025-07-25 18:33:00 | O: 208.89600, C: 208.68300 → Δ: -0.21300 (-0.10%) 🟥 RED
  13. 2025-07-25 18:34:00 | O: 208.71500, C: 208.58300 → Δ: -0.13200 (-0.06%) 🟥 RED
  14. 2025-07-25 18:35:00 | O: 208.58400, C: 208.40600 → Δ: -0.17800 (-0.09%) 🟥 RED
  15. 2025-07-25 18:36:00 | O: 208.45900, C: 208.23600 → Δ: -0.22300 (-0.11%) 🟥 RED
  16. 2025-07-25 18:37:00 | O: 208.23700, C: 208.09700 → Δ: -0.14000 (-0.07%) 🟥 RED
  17. 2025-07-25 18:38:00 | O: 208.14000, C: 208.06300 → Δ: -0.07700 (-0.04%) 🟥 RED
  18. 2025-07-25 18:39:00 | O: 208.19000, C: 208.19000 → Δ: +0.00000 (+0.00%) ⬛ DOJI
  19. 2025-07-25 18:40:00 | O: 208.24400, C: 208.03700 → Δ: -0.20700 (-0.10%) 🟥 RED
  20. 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())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions