| ig_search_markets | R Documentation |
Search markets by text query. Returns a tibble of matching markets from the IG API.
ig_search_markets(query, auth, mock_response = NULL)
query |
Character. Search string for markets (e.g., "USD/CHF"). |
auth |
List. Authentication details from 'ig_auth()', including 'cst', 'security', 'base_url', 'api_key', and 'acc_number'. |
mock_response |
List or data frame. Optional mock response for testing, bypassing the API call. |
A tibble with market information including epic, instrument name and market status.
## Not run:
# Authenticate and search markets
auth <- ig_auth(
username = "your_username",
password = "your_password",
api_key = "your_api_key",
acc_type = "DEMO",
acc_number = "ABC123"
)
markets <- ig_search_markets("USD/CHF", auth)
print(markets)
# Using mock response
mock_response <- data.frame(
epic = "CS.D.USDCHF.MINI.IP",
instrumentName = "USD/CHF Mini",
marketStatus = "OPEN"
)
markets <- ig_search_markets("USD/CHF", auth, mock_response = mock_response)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.