Stream prices and positions

Published on August 2026

Reading Time: 5 Minutes

By Coinpes Team

Open a demo wallet and trade the same 1.95× payout rules — no slideware.

Introduction

REST is enough to place a trade. For a live book — ticks, open P/L, and position changes — you typically use two feeds. Chart ticks come from the public market socket /ws/markets (same as Trade, no OAuth). Account, position, and contract updates for the signed-in user come from the Partner WebSocket after you have an access token.

The Partner WebSocket is scoped to that authorized user. It is not a feed of every referred trader. Partner-wide fills and commissions belong on webhooks.

Bootstrap the socket

For index candles and last price, open wss://api.coinpes.com/ws/markets (locally ws://localhost:8082/ws/markets) and subscribe with { "action": "subscribe", "symbol": "VOL75" }. That path is public.

  1. For the authorized user, POST /v1/ws-token with the Bearer token. The response includes a short-lived bootstrap token and ws_url.
  2. Open that URL. Locally the gateway is often port 8001; production typically uses wss:// on the API host.
  3. Subscribe only to the channels the screen needs (quotes for the visible symbol, account, positions). Unused channels waste battery and make reconnects heavier.

What to show in your UI

  • Mid, bid, and ask for the symbol on screen.
  • Open CFD positions and live P/L.
  • Open contracts until they settle.
  • Wallet balance after fills and settlements.

Prefer socket updates for animation. After any gap, trust REST for the official list of positions and balances so a missed tick cannot leave a ghost row.

Reconnects

Treat the socket as ephemeral. If it drops, mint a fresh ws-token and reconnect. Do not reuse an expired bootstrap token. Then reconcile: list positions and accounts over REST so you do not miss a fill that happened while disconnected.

Back off on repeated failures. A tight reconnect loop will hit rate limits and look like an outage to the user.

Webhooks vs the socket

If you also run a partner backend, do not expect this connection to tell you that a referred trader on another device just settled a contract. Subscribe to contract.settled (and Test it in Referrals) for that.

The WebSocket is for the authorized user, not a dump of every referred trader. Partner-wide events belong on webhooks.

Message shapes: WebSocket reference.

Frequently asked questions

Can I reuse a ws-token after disconnect?
No. Call POST /v1/ws-token again and open the new ws_url. Treat bootstrap tokens as one-shot.
Does the socket include every referred trader?
No. It is scoped to the authorized user. Partner-wide fills and commissions arrive on webhooks.
What should I do after a drop?
Reconnect with a fresh ws-token, then reconcile open positions and balances with REST so you do not miss a fill.

Contact us

Get help with Coinpes trading and accounts

Whether you are learning contracts on demo, funding a live wallet, or need help with positions and payouts, tell us what you need and our team will follow up.

By submitting this form, you agree to Coinpes's Terms of Use and acknowledge our privacy information.