Fetches current price(s) for the given market epic from the IG API using the `/markets/{epic}` endpoint.
Value
A tibble with price information, including columns like `marketStatus`, `bid`, `offer`, `high`, `low`, `updateTime`, and others as returned by the IG API `/markets/{epic}` endpoint.
Examples
if (FALSE) { # \dontrun{
# Authenticate and get price
auth <- ig_auth(
username = "your_username",
password = "your_password",
api_key = "your_api_key",
acc_type = "DEMO",
acc_number = "ABC123"
)
price <- ig_get_price("CS.D.USDCHF.CFD.IP", auth)
print(price)
# Using mock response for testing
mock_response <- list(
snapshot = data.frame(
marketStatus = "TRADEABLE",
bid = 0.798,
offer = 0.798,
high = 0.801,
low = 0.797,
updateTime = "2025/09/26 21:58:57",
binaryOdds = NA
)
)
price <- ig_get_price("CS.D.USDCHF.CFD.IP", auth, mock_response = mock_response)
} # }