Skip to content

R

Uses httr2 and jsonlite.

All examples assume the EA is running on the same computer with default ports. Order examples are for demo accounts.

library(httr2)
q <- request("http://127.0.0.1:81/v1/quote") |>
req_url_query(symbol = "EURUSD") |>
req_perform() |> resp_body_json()
cat(q$SYMBOL, q$BID, q$ASK, "\n")
h <- request("http://127.0.0.1:81/v1/history/prices") |>
req_url_query(symbol = "EURUSD", timeframe = "PERIOD_D1",
from_date = "2026.01.01 00:00:00", to_date = "2026.10.28 00:00:00") |>
req_perform() |> resp_body_json(simplifyVector = TRUE)
rates <- h$RATES
plot(as.POSIXct(rates$TIME, format = "%Y.%m.%d %H:%M:%S"), rates$CLOSE, type = "l")