Socketrade

Quickstart · 5 minutes

Demo connected. First order closed.

Paste five calls. No terminal, no VPS, no EA. When the last one returns, you have a working connection and a closed trade.

What you need

A demo MT5 account

Deriv, Trade245 or Razor. Create it at the broker; no live money is needed.

An account here

Sign up, then take one demo seat. A demo seat is the cheapest way to test.

Your API key

Shown on the dashboard. Send it as X-API-Key on every call.

1. Create an account and take a demo seat

Sign up, then open the dashboard. One seat covers one MT5 account. Start with a demo.

2. Check the key

Your key is on the dashboard. Put it in the X-API-Key header. This call proves the key works and shows your seats.

curl https://api.socketrade.com/v2/usage \
  -H "X-API-Key: $SOCKETRADE_KEY"

{ "seats": 1, "seatsUsed": 0 }

3. Add a demo account

Use the broker's server name exactly as it appears in MetaTrader, for exampleDeriv-Demoor Trade245Global-Live. The password is encrypted before storage.

curl -X POST https://api.socketrade.com/v2/accounts \
  -H "X-API-Key: $SOCKETRADE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "accountNumber": "41299492",
    "accountPassword": "your-demo-password",
    "accountServerHost": "Deriv-Demo",
    "name": "My demo"
  }'

{ "id": "acc_…", "status": "starting" }

4. Connect and wait for ready

A new account starts as starting. Wait for ready before sending an order. On Deriv the first login can take up to a minute while it syncs.

curl -X POST https://api.socketrade.com/v2/accounts/acc_…/connect \
  -H "X-API-Key: $SOCKETRADE_KEY"
curl https://api.socketrade.com/v2/acc_…/status \
  -H "X-API-Key: $SOCKETRADE_KEY"

{
  "status": "ready",
  "account": { "login": 41299492, "balance": 20000.00,
               "equity": 20000.00, "currency": "USD",
               "tradeAllowed": true },
  "broker": { "connected": true, "server": "Deriv-Demo" }
}

5. Place and close an order

Weekend or not, check the symbol is in Market Watch first. Use 0.01 lots on a demo.

# operation 0 buys, 1 sells
curl -X POST https://api.socketrade.com/v2/acc_…/OrderSend \
  -H "X-API-Key: $SOCKETRADE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "symbol": "EURUSD", "operation": 0, "volume": 0.01 }'

{ "ticket": 4789544305, "symbol": "EURUSD", "volume": 0.01 }

Close it with the ticket from the response.

curl -X POST https://api.socketrade.com/v2/acc_…/PositionClose \
  -H "X-API-Key: $SOCKETRADE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "ticket": 4789544305 }'

6. Read, and stream

Positions carry live profit. History carries closed deals. The WebSocket pushes live bid/ask ticks for up to 64 symbols on one connection.

curl https://api.socketrade.com/v2/acc_…/positions -H "X-API-Key: $SOCKETRADE_KEY"
curl https://api.socketrade.com/v2/acc_…/history   -H "X-API-Key: $SOCKETRADE_KEY"

# live bid/ask ticks (gateway host; API host is REST only)
wss://win-vi96ovqi4i6.taile61f2a.ts.net/v2/acc_…/ws

If it fails

401Missing or wrong key. Copy it again from the dashboard.
402No free seat. Add a seat, or remove an account you no longer use.
404The account id is wrong, or it belongs to another client.
409That account is already added. Use the id you already have.
No priceThe symbol is not in Market Watch yet. Select it first, or use a synthetic on weekends.
Weekend forexEURUSD is closed from Friday night to Sunday. Test with a synthetic index.