• TokenSoft

Write Your Own Crypto Price Feed API in 10 Minutes with Nomics and GraphQL

Updated: Jan 14, 2019

by Ron Gierlach, Developer, TokenSoft


Today’s crypto landscape can be daunting. As exchanges and tokens proliferate, keeping up with market data becomes a Sisyphean task.


The following sections give a simple guide to building an API that provides price feed data to your crypto-enabled application.


Nomics and Market Data


Accurately knowing the market price at any given time requires pulling from potentially dozens of exchange API’s and doing a few clever calculations.


Luckily, there is already a free service that has done the legwork for you.


Meet Nomics, the crypto market data API trusted here at TokenSoft. So much so in fact, we became an investor in 2018.


Nomics keeps prices extremely up-to-date, re-calculating every 10 seconds and weighting 24 hour volumes across leading exchanges. For the extra curious, check out an in-depth explanation of Nomic’s pricing methodology.


Here’s what we’ll cover:


1- Setting up the GraphQL server with Node.js and NPM

2- Obtaining a free Nomics API key

3- Pulling (USD) price data from the Nomics API and caching the results

4- Exposing a GraphQL endpoint to query price data


Prerequisites

You should have Node.js and NPM installed on your machine. General JavaScript experience is assumed.


Full source code for this example can be referenced here.

1. Setting Up the GraphQL Server





2. Obtaining a Free Nomics API Key


Head on over to Nomics’ pricing page and select their free tier.


Fill out and submit the registration form.


You should receive an email with your API key shortly!


3. Pulling Price Data From the Nomics API





Final Thoughts

If you’ve made it this far, congratulations!


We’ve covered setting up a GraphQL server with a cached exchange rate endpoint.

Next steps could include supporting fiat pairs other than USD. Additionally, Nomics’ dashboard endpoint is a great place to expand your API to support metrics such as 24-hour volume or price movement. All source code for the above example can be found here.


If you are interested in working with or at TokenSoft Inc, feel free to reach out.

  • medium
  • White Twitter Icon
  • White LinkedIn Icon

Join our mailing list

THIS WEBSITE IS OWNED AND OPERATED BY TOKENSOFT, INC. (“TOKENSOFT”), A TECHNOLOGY COMPANY PROVIDING COMPLIANCE AND BLOCKCHAIN-BASED SERVICES FOR ISSUERS OF SECURITIES OR OTHER DIGITAL ASSETS.  TOKENSOFT IS NOT A BROKER-DEALER, INVESTMENT ADVISER, OR FINANCIAL ADVISOR.  TOKENSOFT IS NOT REGISTERED WITH THE U.S. SECURITIES & EXCHANGE COMMISSION (SEC) NOR ANY OTHER REGULATORY AGENCY OR BODY IN THE UNITED STATES OR INTERNATIONALLY.  TOKENSOFT DOES NOT GIVE INVESTMENT OR LEGAL ADVICE, ENDORSEMENTS, ANALYSIS, OR RECOMMENDATIONS WITH RESPECT TO ANY SECURITIES OR OTHER DIGITAL ASSETS. NOTHING ON THIS WEBSITE SHALL CONSTITUTE OR BE CONSTRUED AS AN OFFERING OF SECURITIES OR AS INVESTMENT ADVICE OR INVESTMENT RECOMMENDATIONS BY TOKENSOFT OR ANY OF ITS AFFILIATES OR A RECOMMENDATION AS TO AN INVESTMENT. ALL THIRD PARTY SECURITIES OFFERINGS AND DIGITAL ASSETS POWERED BY TOKENSOFT’S TECHNOLOGY ARE OFFERED BY, AND ALL INFORMATION RELATED THERETO IS THE RESPONSIBILITY OF, THE APPLICABLE ISSUER OF SUCH SECURITIES OR DIGITAL ASSETS. TOKENSOFT DOES NOT CUSTODY ANY DIGITAL SECURITIES OR DIGITAL ASSETS ON BEHALF OF ANY OF ITS CUSTOMERS OR USERS OF OUR WEBSITE SERVICES.


For information relating to Tokensoft Global Markets, our affiliate broker-dealer, please visit https://www.tokensoftmarkets.com.