git clone 'git://'



cryptsy-public-api is an Emacs library for working with the Cryptsy public API. Cryptsy is an exchange for a variety of crypto-currencies, include BitCoin, LiteCoin and Dogecoin.

It's not a particularly useful extension on its own, but can be used to build something more interesting.


As there are no interactive functions in this library, it is not recommended that you install this package directly.

Via Melpa

If you aren't already using Melpa, add the following to your Emacs initialization file:

(setq package-archives '(("gnu" . "")
                         ("marmalade" . "")
                         ("melpa" . "")))


Once Emacs is configured to use Melpa as a source, you can install the package using the following:

M-x package-install crypsty-public-api

Via GitHub

Note - This method is not recommended.

All Emacs installs are a little different, but the basic outline is this:


The two main functions in the API are:


cryptsy-public-api-get-market-data is used to fetch general market data. It can be called either with a market-id, or with :all to fetch all market data.

This will return a JSON object containing the market information, along with recent buy orders, sell orders and recent trades.

The following example fetches the current value of BTC in USD:

(defun get-info-node (response type)
  (assoc-default type (assoc-default 'markets (assoc-default 'return response))))

(let ((response (cryptsy-public-api-get-market-data 2)))
  (assoc-default 'lasttradeprice (get-info-node response 'BTC)))

WARNING : Fetching all market data is extremely slow and memory intensive as the data is around 20MiB. It is not recommended.


cryptsy-public-api-get-orderbook-data is used for fetching order book data. As with cryptsy-public-api-get-market-data it can accept a market-id parameter for narrowing down the return value.

The response is similar to cryptsy-public-api-get-market-data except it does not contain recent trades.

For more information on the public API, see the official documentation:

There are no interactive functions as part of this library.


The library also provides several helper functions to make it easier to extract information from the JSON responses.


Takes a currency identifier, field name and JSON response and returns the value. The earlier example for fetching a currency's value can be rewritten as:

(let ((response (cryptsy-public-api-get-market-data 2)))
  (cryptsy-public-api-get-info-value 'BTC 'lasttradeprice contents))

The following field names can be used:


Takes a currency identifier and JSON response and returns a vector of buy orders. Each buy order consists of three fields:


Takes a currency identifier and JSON response and returns a vector of sell orders. Each sell order consists of three fields:

Things That Use This Library


Copyright (C) 2014 Phil Newton

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.