{"id":13483943,"url":"https://github.com/mccallofthewild/gdax","last_synced_at":"2025-04-21T18:31:22.031Z","repository":{"id":143921634,"uuid":"106465056","full_name":"mccallofthewild/gdax","owner":"mccallofthewild","description":"📈 GDAX REST and WebSocket API wrapper to trade blockchain cryptocurrencies like bitcoin, Litecoin and Ethereum.","archived":false,"fork":false,"pushed_at":"2019-10-05T05:20:37.000Z","size":738,"stargazers_count":7,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T15:10:31.648Z","etag":null,"topics":["blockchain","coinbase","coinbase-api","cryptocurrency","cryptocurrency-exchanges","gdax","gdax-api","trading-api"],"latest_commit_sha":null,"homepage":"https://mccallofthewild.github.io/gdax","language":"Crystal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mccallofthewild.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-10-10T20:02:16.000Z","updated_at":"2020-05-24T15:54:56.000Z","dependencies_parsed_at":"2024-01-27T09:10:14.383Z","dependency_job_id":"31d36f6d-16f7-4b35-842e-37c5066678de","html_url":"https://github.com/mccallofthewild/gdax","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mccallofthewild%2Fgdax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mccallofthewild%2Fgdax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mccallofthewild%2Fgdax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mccallofthewild%2Fgdax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mccallofthewild","download_url":"https://codeload.github.com/mccallofthewild/gdax/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250110939,"owners_count":21376560,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","coinbase","coinbase-api","cryptocurrency","cryptocurrency-exchanges","gdax","gdax-api","trading-api"],"created_at":"2024-07-31T17:01:17.133Z","updated_at":"2025-04-21T18:31:21.493Z","avatar_url":"https://github.com/mccallofthewild.png","language":"Crystal","funding_links":[],"categories":["Third-party APIs"],"sub_categories":[],"readme":"# 📈 GDAX\n\nA Crystal library for interacting with [GDAX](https://www.gdax.com/)'s REST and WebSocket API's.\n\n\n[![Build Status](https://travis-ci.org/mccallofthewild/gdax.svg?branch=master)](https://travis-ci.org/mccallofthewild/gdax) [![Docs](https://img.shields.io/badge/docs-available-brightgreen.svg)](https://mccallofthewild.github.io/gdax/) [![GitHub release](https://img.shields.io/github/release/mccallofthewild/gdax.svg)](https://github.com/mccallofthewild/markov/releases)\n\n\n### Visit the [API Documentation](https://mccallofthewild.github.io/gdax/) for a more in-depth look at the library's functionality.\n\n## Installation\n\nAdd this to your application's `shard.yml`:\n\n```yaml\ndependencies:\n  gdax:\n    github: mccallofthewild/gdax\n```\n\n## Usage\n\nBegin by requiring `\"gdax\"`.\n\n```crystal\nrequire \"gdax\"\n```\n\n### `GDAX::Client`\n\u003e Interact with the GDAX REST API \n\n`GDAX::Client` is derived from [HTTP::Client](https://crystal-lang.org/api/HTTP/Client.html). Use the inherited instance methods, `#get`, `#post`, `#put` and `#delete` to interact with GDAX's API. \nResponses are instances of [HTTP::Client::Response](https://crystal-lang.org/api/HTTP/Client/Response.html).\n\n#### Basic\nTo authenticate, pass named argument, `auth` to the `GDAX::WebSocket` with a `GDAX::Auth` instance.\nSee [ _Authentication_ ](https://docs.gdax.com/#authentication) for help getting your `key`, `secret`, and `passphrase`.\n\nNOTE: For security purposes, it is recommended that you store your `key`, `secret`, and `passphrase` as environment variables.\n\ne.g.\n```crystal\nauth = GDAX::Auth.new ENV[\"CB-ACCESS-KEY\"], ENV[\"API-SECRET\"], ENV[\"PASSPHRASE\"]\nclient = GDAX::Client.new auth\nclient.get \"/products/BTC-USD/trades\" do |response|\n  puts response.body_io.gets_to_end\nend\n```\n\n#### Unauthenticated\nTo instantiate an unauthenticated `Client`, simply don't pass the `auth` argument.\n\ne.g.\n```crystal\nclient = GDAX::Client.new\nclient.get \"/products\" do |response|\n  puts response.body_io.gets_to_end\nend\n```\n\nSee [the API Documentation](https://mccallofthewild.github.io/gdax/GDAX/Client.html) for more information on `GDAX::WebSocket`.\n\n### `GDAX::WebSocket` \n\u003e Interact with the GDAX WebSocket Feed\n\n#### Basic \nIt's recommended that you [spawn a Fiber](https://crystal-lang.org/docs/guides/concurrency.html) around each `GDAX::WebSocket` you instantiate in order to achieve concurrency.\n\nThe following setup will give you access to GDAX's public _ticker_ stream.\n```crystal\nspawn do\n  ws = GDAX::WebSocket.new production: true, subscription: {\n    \"type\" =\u003e \"subscribe\",\n    \"channels\" =\u003e [{ \"name\" =\u003e \"ticker\", \"product_ids\" =\u003e [\"ETH-EUR\"] }]\n  }\n\n  ws.run\nend\nFiber.yield\n```\n\n#### `GDAX::WebSocket#on`\nUse the `#on` method to add event listeners to a `GDAX::WebSocket`.\n\nEvents are based on [ _GDAX's message `type`'s_ ](https://docs.gdax.com/#protocol-overview).\n\n`#on` takes in a `String` of the event to listen for and a block to call when the event is fired.\nThe block is passed two arguments: the first being the `JSON::Any` response data from GDAX, and the second being the event itself.\n\n```crystal \nws.on \"subscriptions\" do |data, event|\n  puts \"subscribed!\"\nend\n```\n\nThough event listeners _can_ be added dynamically on runtime, to avoid missing events, it is recommended that all listeners be added prior to invoking `GDAX::WebSocket#run`.\n\ne.g.\n```crystal\nspawn do\n  ws = GDAX::WebSocket.new production: true, subscription: {\n    \"type\" =\u003e \"subscribe\",\n    \"channels\" =\u003e [{ \"name\" =\u003e \"ticker\", \"product_ids\" =\u003e [\"ETH-EUR\"] }]\n  }\n\n  ws.on \"subscriptions\" do |data, event|\n    puts \"subscribed!\"\n  end\n\n  ws.on \"ticker\" do |data, event|\n    puts data[\"price\"] #=\u003e e.g. 264.10000000\n  end\n\n  ws.run\nend\nFiber.yield\n```\n\n#### Authenticating\nIt is possible to authenticate yourself when subscribing to the websocket feed. See the [GDAX documentation on the subject](https://docs.gdax.com/#subscribe).\n\nTo authenticate, pass named argument, `auth` to the `GDAX::WebSocket` with a `GDAX::Auth` instance.\nSee [ _Authentication_ ](https://docs.gdax.com/#authentication) for help getting your `key`, `secret`, and `passphrase`.\n\nNOTE: For security purposes, it is recommended that you store your `key`, `secret`, and `passphrase` as environment variables.\n\n```crystal\nspawn do\n  auth = GDAX::Auth.new key: ENV[\"CB-ACCESS-KEY\"], secret: ENV[\"API-SECRET\"], passphrase: ENV[\"PASSPHRASE\"]\n\n  ws = GDAX::WebSocket.new production: true, subscription: {  \n    \"type\" =\u003e \"subscribe\",\n    \"channels\" =\u003e [{ \"name\" =\u003e \"ticker\", \"product_ids\" =\u003e [\"ETH-EUR\"] }]\n  }, auth: auth\n  \n  ws.on \"subscriptions\" do |data, event|\n    puts \"subscribed!\"\n  end\n  ws.run\nend\n```\n\nSee [the API Documentation](https://mccallofthewild.github.io/gdax/GDAX/WebSocket.html) for more information on `GDAX::WebSocket`.\n\n\n## Contributing\n\n1. Fork it ( https://github.com/mccallofthewild/gdax/fork )\n2. Create your feature branch (git checkout -b my-new-feature)\n3. Commit your changes (git commit -am 'Add some feature')\n4. Push to the branch (git push origin my-new-feature)\n5. Create a new Pull Request\n\n## Contributors\n\n- [McCall Alexander](https://github.com/mccallofthewild) mccallofthewild - creator, maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmccallofthewild%2Fgdax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmccallofthewild%2Fgdax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmccallofthewild%2Fgdax/lists"}