Quickstart

This guide will get you all set up and ready to use FactIQ. We'll cover how to get started using one of the API clients and how to make your first API request. We'll also look at where to go next to find all the information you need to take full advantage of our GraphQL API.

Choose your client

Before making your first API request, you need to pick which API client you will use. In addition to good ol' cURL HTTP requests, community-supported GraphQL clients for JavaScript, Python, and PHP can also be used and it is the recommended way to access our services. In the following example, you can see how to install each client.

# Install the JavaScript GraphQL client library
npm i graphql-ws

Making your first API request

After picking your preferred client, you are ready to make your first call to FactIQ. Below, you can see how easy it is to send a Query (POST) request to the non_derivative_transaction endpoint to get a list of Form 4,4/A insider transactions in the SEC.

Use queries to access historical data about company fundamentals, the economy, labor market, and much more in order to conduct market research, create strategies, and back-test them to get an edge over other traders and researchers in your field.

curl -X POST https://api.factiq.io/data/fundamentals/us/sec/v1 -H "api-key: <YOUR API KEY>" --data '{"operationName":null,"variables":{},"query":"{\nform_4 {\ntook\ntotal {\nvalue\nrelation\n}\ndata {\nfiling_accession_number\nfiling_form_type\ndocument_data {\nnon_derivative_table {\nnon_derivative_transactions {\ntransaction_date {\nvalue\n}\nsecurity_title {\nvalue\n}\nownership_nature {\ndirect_or_indirect_ownership {\nvalue\n}\n}\ntransaction_amounts {\nacquired_or_disposed {\nvalue\n}\nprice_per_share {\nvalue\n}\nnumber_of_shares_transacted {\nvalue\n}\n}\npost_transaction_amounts {\nvalue_owned_following_transaction {\nvalue\n}\nshares_owned_following_transaction {\nvalue\n}\n}\n}\n}\n}\n}\n}\n}\n"}'

Creating your first stream with subscriptions

Being able to stream fundamental financial data is one of the most sought after features. At FactIQ, streaming is a core product, not an after thought.

Here we will show you how easy it is to start a stream to begin consuming financial data in real-time and get actionable insights to power your trading algorithms and backend systems. New data is parsed at subsecond speeds and distributed to clients as soon as it becomes available.

Your API key is sent in the initial connection payload when subscribing to an endpoint as subscriptions use the websocket protocol. Most client libraries will handle this automatically for you when passing your API key in the headers on client connection.

POST
import { createClient } from 'graphql-ws';

const client = createClient({
url: 'wss://api.factiq.io/data/fundamentals/us/sec/v1/ws',
connectionParams: {"api-key": "<YOUR API KEY>"},
keepAlive: 60000,
});

// subscription
(async () => {
const subscription = client.iterate({
subscription: `subscription {
              form_4 {
                filing_form_type,
                filing_accession_number,
                filing_report_date,
                filing_filing_date,
                document_data {
                  issuer {
                    cik,
                    name
                  },
                  date_of_original_submission,
                  non_derivative_table {
                    non_derivative_transactions {
                      transaction_date {
                        value
                      },
                      security_title {
                        value
                      },
                      transaction_amounts {
                        price_per_share{
                          value
                        },
                        number_of_shares_transacted {
                          value
                        }
                      },
                      post_transaction_amounts {
                        value_owned_following_transaction{
                          value
                        },
                        shares_owned_following_transaction {
                          value
                        }
                      }
                    }
                  }
                }
              }
            }`,
});

for await (const event of subscription) {
let d = new Date();
console.log(d.toTimeString(), event);
}
})();

What's next?

Great, you're now set up with an API client, made your first request to the API, and created your first stream with subscriptions. Here are a few links that might be handy as you venture further into FactIQ: