Coder Social home page Coder Social logo

bitcoin-lisp's Introduction

bitcoin-lisp

A Common Lisp client for getting current Bitcoin prices in various world currencies from the Coindesk API.

This library could hardly be any more simple. It has two functions. It can pull the currently Bitcoin price from the Coindesk API in any one of the world currencies, and it can pull a list of those currencies (and their ISO 4217 designators) from the Coindesk site, so you know which ones are valid.

The use of this data in another program is free, but requires attribution to Coindesk. See the following page for details:

https://www.coindesk.com/api/

Example usage:

CL-USER> (bitcoin:bitcoin-price "USD")
((:TIME (:UPDATED . "Sep 7, 2017 01:27:00 UTC")
  (:UPDATED-+ISO+ . "2017-09-07T01:27:00+00:00")
  (:UPDATEDUK . "Sep 7, 2017 at 02:27 BST"))
 (:DISCLAIMER
  . "This data was produced from the CoinDesk Bitcoin Price Index (USD). Non-USD currency data converted using hourly conversion rate from openexchangerates.org")
 (:BPI
  (:+USD+ (:CODE . "USD") (:RATE . "4,561.9150")
   (:DESCRIPTION . "United States Dollar") (:RATE--FLOAT . 4561.915))))
CL-USER> (cdr (assoc :rate--float (cdr (assoc :+usd+ (cdr (assoc :bpi (bitcoin:bitcoin-price "USD")))))))
4561.915
CL-USER> 
CL-USER> (bitcoin:supported-currencies)
(((:CURRENCY . "AED") (:COUNTRY . "United Arab Emirates Dirham"))
 ((:CURRENCY . "AFN") (:COUNTRY . "Afghan Afghani"))
 ((:CURRENCY . "ALL") (:COUNTRY . "Albanian Lek"))
 ((:CURRENCY . "AMD") (:COUNTRY . "Armenian Dram"))
 ((:CURRENCY . "ANG") (:COUNTRY . "Netherlands Antillean Guilder"))
 ((:CURRENCY . "AOA") (:COUNTRY . "Angolan Kwanza"))
 ((:CURRENCY . "ARS") (:COUNTRY . "Argentine Peso"))

	...blah blah blah...

 ((:CURRENCY . "XOF") (:COUNTRY . "CFA Franc BCEAO"))
 ((:CURRENCY . "XPF") (:COUNTRY . "CFP Franc"))
 ((:CURRENCY . "YER") (:COUNTRY . "Yemeni Rial"))
 ((:CURRENCY . "ZAR") (:COUNTRY . "South African Rand"))
 ((:CURRENCY . "ZMK") (:COUNTRY . "Zambian Kwacha (pre-2013)"))
 ((:CURRENCY . "ZMW") (:COUNTRY . "Zambian Kwacha"))
 ((:CURRENCY . "ZWL") (:COUNTRY . "Zimbabwean Dollar")))
CL-USER>

bitcoin-lisp's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.