#bitcoin #command-line-interface #kraken #com #api #opinionated #script

bin+lib kraken-btc

An opinionated command line interface for buying Bitcoin on Kraken.com

1 unstable release

0.1.0 Jan 14, 2021

#28 in #kraken

MIT license

23KB
546 lines

kraken-btc ๐Ÿ™

An opinionated command line interface for buying Bitcoin on Kraken.com. Written in Rust.

Installation ยท Example ยท API Credentials


This is a simple command line interface for buying Bitcoin on Kraken.com. The idea is to enable setups that make it easy to get your hands on some Bitcoin in an automated way. For example, you could use this in an Auto-DCA script.

I've always wanted to build something in Rust ๐Ÿฆ€ so this was a good opportunity for me to learn how to do that.

๐Ÿ’ฝ Installation

Binaries for macOS are available through Homebrew and GitHub releases. For other platforms, it is recommended to build from source.

Homebrew (macOS)

$ brew tap dnlggr/tap
$ brew install kraken-btc
Expand for uninstall instructions

$ brew untap dnlggr/tap

$ brew uninstall kraken-btc

Download Binary Release (macOS)

You can find binaries for all releases on this repo's releases page.

From Source

To build from source, you must have Rust and Cargo installed.

$ cargo install kraken-btc 

This will install a binary in your Rust installation root's bin directory. Typically, this is $HOME/.cargo/bin.

๐Ÿ’ธ Usage

This is a short example on how to use kraken-btc to spend 100 Euro on Bitcoin.

$ kraken-btc --api-key <...> --api-secret <...> buy --fiat-currency EUR --fiat-amount 100

You'll get a confirmation of your order that looks something like the one below.

๐Ÿ™ Spending 100 EUR on Bitcoin.

๐Ÿ“ฆ ORDER:   buy 0.00531632 XBTEUR @ limit 18810.0
๐ŸŽซ TXID:    ABCDEF-GHIJK-LMNOPQ
๐ŸŽ‰ STATUS:  Order was placed.

Make sure to double check your orders page on Kraken from time to time make sure everything works as expected.

Tip: Pass the optional --dry-run flag to the buy subcommand to test your order without actually placing it.

For more detailed usage information and documentation run kraken-btc help.

๐Ÿ”‘ API Credentials

Create the necessary Kraken API here: API settings page.

To be able to place orders, the generated API credentials must have the Modify Orders permission.

On some pages, the API Key might be referred to as API Public Key. Likewise, the API Secret is also known as API Private Key. It is important to keep these credentials safe and never share them with anyone. It's best to not store them in plain text on your computer but to use a password manager. More information on how to create API credentials can be found in Kraken's documentation.

Dependencies

~13MB
~354K SLoC