Be sure to contact [email protected] to enable API access on your account before getting started.
The Omega Point platform provides developers with comprehensive access to the data available within its application suite. Data is fetched via secure HTTP requests that leverage a simple query language, while offering the following benefits over a traditional REST API:
easily understand the comprehensive data library;
request only the data needed;
retrieve multiple resources in a single request;
utilize powerful browser-based developer tools (click here for a quick showcase).
GraphQL
The API is implemented in GraphQL, a new API standard open-sourced by Facebook that enables declarative data fetching from a single endpoint. GraphQL allows you to write custom queries inside each of your requests so that you always retrieve exactly what you asked for (and nothing else).
If you're not already familiar with GraphQL, you should get yourself acquainted. The GraphQL web site provides an excellent introduction, as well as access to additional documentation.
Application Management
Once your account has been set up with API access, you will find a link to “Platform” beneath “Portfolios” inside the Omega Point dashboard. Your account is automatically provided with two tokens, labeled “Test” and “Production” (as examples for separating development environments).
Each token has a set of four actions:
Copy to clipboard: the token ID is copied to your clipboard, ready to be pasted into your code
Rename: Rename the token into something more meaningful to the organization
GraphiQL: open a GraphiQL session to interactively test queries in browser utilizing the selected token (see section below on “Testing Queries with GraphiQL”)
Delete token: delete this token (WARNING: the token cannot be retrieved after it has been deleted)
Below your tokens, you will find a + button for generating new tokens for your application. You may generate a total of four tokens.
Testing Queries with GraphiQL
Inside the Omega Point platform you have access to a GraphQL client (“GraphiQL”) that helps you write queries and display the shape of the resulting data. Click on the test in client link within a token row (see above). The GraphiQL client allows you to easily browse through the schema by clicking on “Docs” in the upper right of the screen.
Below is a sample query that you can copy into the GraphiQL client in order to help get familiar with writing queries — be sure to use an actual model ID (see “Ready to Code?” > “Models” for help with obtaining model IDs):
{
model(id: "xxxxx-xx") {
factors(category: "style") {
id
name
mtdPerf: performance(from: "2017-02-01", to: "2017-02-21") {
date
percentPriceChangeCumulative
}
ytdPerf: performance(from: "2017-01-01", to: "2017-02-21") {
date
percentPriceChangeCumulative
}
}
}
}
Things to Keep In Mind
Dates must be in ISO 8601 standard format (for example, February 1, 2017 should be entered (in quotes) as “2017-02-01”).
Percent values returned in your query results are labeled with the prefix of “percent” to clarify that these numbers are the result of percent calculations. The value itself is the raw value, as opposed to an actual percentage value (e.g. a value of “0.01” in your query results is equal to 1%).
GraphiQL Query History
GraphiQL includes a built in history tab that automatically saves your last 20 previously used queries. In addition, saving favorite queries and naming queries are two ways to organize this history panel. This panel helps you retrieve queries for quick reference.
Saving Queries
While hovering over a previous query, starring a query will move the query to the top of the history list. These "starred" queries will persist over time, allowing favorite queries to be more easily accessible.
Naming Queries
Each query can also be given a name a query increases the visibility of each query. While hovering over a previous query, select the pencil icon and provide a short name for this query.
Named queries goes hand-in-hand with favorite queries to turn graphiQL from a debugging tool into a repo of useful queries.
Ready to Code?
Use the following API endpoint to formulate your requests:
https://api.ompnt.com/graphql
Models
To get started, find out which models are available for your account. You will need to select a model ID from the output to be used in your subsequent queries. Modify the code block below to insert your token in the Authorization section and run in a terminal window:
curl \
-XPOST \
-H "Content-Type:application/json" \
-H "Authorization: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
-d '{"query": "{ models { id } }"}' \
https://api.ompnt.com/graphql
To retrieve additional information about the models, the following cURL command will return your account's models and the metadata for each model (including id, name, and the date range of available factor data):
curl \
-XPOST \
-H "Content-Type:application/json" \
-H "Authorization: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
-d '{"query": "{ models { id, name, availability { currentDate, factorsStartDate } } }"}' \
https://api.ompnt.com/graphql
To fetch all factor IDs for a particular model, run the following (after inserting the appropriate model ID and token):
curl \
-XPOST \
-H "Content-Type:application/json" \
-H "Authorization: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
-d '{"query": "{ model(id: \"xxxxx-xx\") { id, factors { id } } }"}' \
https://api.ompnt.com/graphql
Similarly, use the following to fetch the MTD single day and cumulative factor returns from February 1, 2017 through February 21, 2017, along with each factor's ID and name:
curl \
-XPOST \
-H "Content-Type:application/json" \
-H "Authorization: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
-d '{"query": "{ model(id: \"xxxxx-xx\") { id, factors(category: \"style\") { id, name, mtdPerf: performance(from: \"2017-02-01\", to: \"2017-02-21\") { date, percentPriceChange1Day, percentPriceChangeCumulative } } } }"}' \
https://api.ompnt.com/graphql
For additional examples of Omega Point query structures and sample responses, please see: Making Web Requests to the API.
Programming Languages
There is support for GraphQL from a wide variety of programming languages. Find more details on GraphQL support in your language of choice. Even if you do not find any helpful frameworks or libraries, the GraphQL API is an HTTP endpoint for implementing standard POST or GET requests and will return JSON-formatted responses.
Have Questions?
Please get in touch with us if you need assistance. The easiest way is to contact us is via the messenger widget on the lower right of this screen to start a conversation. In the meantime, happy coding!