Skip to content

Instantly share code, notes, and snippets.

@2-am-zzz
Created November 14, 2016 22:56
Show Gist options
  • Save 2-am-zzz/ac66482244afca9f2b745f61fa0695ec to your computer and use it in GitHub Desktop.
Save 2-am-zzz/ac66482244afca9f2b745f61fa0695ec to your computer and use it in GitHub Desktop.
Describing the API required to make conversions happen.

Introduction for MVP

For MetaMask, the minimum basic functionality we'd want from a conversion API is as follows:

One endpoint for converting Ether into a fiat currency

  • GET ethconversion/:symbol

Where :symbol indicates the abbreviated symbol used to represent the target fiat, such as USD, EUR, JPY, etc.

The JSON output would have to have these fields:

  • price number
  • success boolean

Expanded Functionality

An option to select a specific exchange, for example: GET ethconversion/:exchange/:symbol where :exchange is a string such as poloniex or kraken. This could also be implemented as a parameter.

Expand :symbol to include other cryptocurrencies and/or tokens, such as BTC, DOGE, ZEC, etc. (get it?)

Including timestamp in the response: The last time the API updated in UTC time.

In order to reduce request volume, perhaps design a separate 'most popular' endpoint that packages the queries for 10 or so of the most popular exchange requests. For example, ethconversion/popular. We can then cache this response and reduce the number of requests switching from say, USD to BTC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment