[STEEM BOUNTY] CoinGecko: Implement public websocket API connections for Coinbase ProsteemCreated with Sketch.

in #utopian-io6 years ago (edited)

Utopian for CoinGecko:

Utopian.io is running this task request on behalf of CoinGecko.com

img

GitHub Repository

https://github.com/coingecko/cryptoexchange

Project Background

Cryptoexchange is a rubygem that allows Ruby developers to interact with over 240+ cryptocurrency exchange market data APIs in a single library. This rubygem is used to power CoinGecko. It is open source under the terms of the MIT License.

Task Specification

For the existing HTTP API, this rubygem has established a pretty good abstraction which allows developers to easily contribute new exchanges.

The websocket API feature, however, is a new addition to this rubygem. As such, we are still figuring out the best abstraction/structure.

This merged pull request https://github.com/coingecko/cryptoexchange/pull/1008 contains the initial proof-of-concept, which supports connecting with Bitfinex ticker, order book, and trade websocket API.

We are looking for candidate's to complete the following tasks:

  • [ ] Implement public websocket API connections for Coinbase Pro (Ticker, OrderBook, Trade)
  • [ ] Suggest ways to improve upon the rubygem websocket connection design. (See *notes below)
  • [ ] Suggest ways to spec/test external websocket API connection. (See *notes below)

*Notes

  • The Bitfinex websocket API requires us to make only ONE connection for ONE trading pair. For example, only one websocket connection of BTC/USDT is needed in order to obtain stream data corresponding to that pairing. As such, the existing structure in place for Bitfinex leverages on Threads in order to handle multiple streams.
  • There may be a case where some websocket API (such as Coinbase Pro) require only ONE connection for MULTIPLE trading pairs. You may need to introduce additional abstractions to handle this situation.
  • The HTTP API implementation of this rubygem uses VCR in order to mock API responses to ensure we can run an end-to-end integration test. VCR does not appear to work with websocket. We are considering manually mocking the websocket response but this can turn out to be unscalable when response changes.
  • Feel free to suggest ways to streamline this abstraction.

Additional Notes for Coinbase Pro Implementation

I have looked into the Coinbase Pro websocket API documentation.

Here is a code you can use to get started making websocket connection for testing purposes in ruby console.

EM.run do
  ws = WebSocket::EventMachine::Client.connect(uri: 'wss://ws-feed.pro.coinbase.com')

  ws.onopen do
    ws.send({
    "type": "subscribe",
    "product_ids": [
        "ETH-USD",
        "ETH-EUR"
    ],
    "channels": [
        "level2",
        "matches",
        "heartbeat",
        {
            "name": "ticker",
            "product_ids": [
                "ETH-BTC",
                "ETH-USD"
            ]
        }
    ]
}.to_json)
  end

  ws.onmessage do |message, _|
    begin
      message = JSON.parse(message)
      puts message
    rescue Exception => e
      puts e
    end
  end

  ws.onclose do
    onclose.call if onclose
  end
end

The following channels on Coinbase Pro correspond to the data we want to capture:

  • ticker (Ticker)
  • level2 (OrderBook)
  • matches (Trade)

How to get started?

  1. Navigate to the repository on Github https://github.com/coingecko/cryptoexchange
  2. Be sure to check out the README on its usages to familiarize yourself with the gem and contributing guide.
  3. https://github.com/coingecko/cryptoexchange/wiki/Implementing-a-New-Exchange-(Websocket-API) will likely be useful to you to get started.
  4. When you begin work, we suggest creating a Pull Request with a WIP headline so we can commence discussion there.

Deadline

2 weeks. Set to start upon candidate selection.

Communication

Please register your interest at https://discord.gg/pKGV9sp, CoinGecko's official Discord server in the "utopian-io" channel.

You may contact us directly for further information via email at [email protected] or in our Discord developer discussion hub.

Github

https://github.com/coingecko

Rewards Information

Rewards generated by this task request will be sent as liquid STEEM to the task solver once the task is completed, as decided by the project owner.

The task will be considered considered completed after it has been merged by CoinGecko developement team and when the solver published a Steemit post, explaining what they did in order to solve the task.

Special Reward

As this previous task wasn't attended by any candidate, we are offering the amount of STU available here https://steemit.com/utopian-io/@utopian.tasks/steem-bounty-public-websocket-api-connections-for-exchanges for the solver of this task, in addition to the value loaded on this post and the potential reward you may get by publishing your solution via Utopian.

Sort:  

We have already started the scouting process. If you wish to contribute to the solution of this task get in touch with CoinGecko or Utopian on our Discord server https://discord.gg/azdmM3v

Coin Marketplace

STEEM 0.18
TRX 0.13
JST 0.029
BTC 58625.96
ETH 3101.66
USDT 1.00
SBD 2.41