npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

coinbase-cli

v1.2.2

Published

Commandline utility for trading cryptocurrencies on Coinbase

Downloads

58

Readme

coinbase-cli

This is a command-line utility that uses the Coinbase API to trade, deposit and withdraw cryptocurrencies.

On busy days, it has happened that the Coinbase website was down while its underlying API services still worked. This command-line tool is my emergency backup, so that I can trade when everyone else is. Of course, there are many other use cases for a command-line tool such as easily automating trading tasks or inspecting the prices.

Features

  • Interactive mode: commands will nicely ask you to input them during command execution
  • Non-interactive mode: specify all arguments on the command-line
  • Commands (run coinbase help <command> for details):
    • accounts: list your coinbase accounts
    • buy: buy crypto currency with fiat currency
    • buyprice: shows the buy price for a given trade pair
    • paymentmethods: list your coinbase payment methods
    • sell: sell crypto currency for fiat currency
    • sellprice: shows the sell price for a given trade pair
    • spotprice: shows the spot price for a given trade pair
    • time: coinbase server current time
    • withdraw: withdraw fiat currency

Disclaimer

Use this tool at your own risk. Program code can contain bugs - it's open source, so you can check it before you use it.

Installation & Preparation

  • Install Node.JS
  • Install coinbase-cli by running npm install -g coinbase-cli
  • Get your API key and API secret from the Coinbase website
    • Go to Settings - API access and click the 'New API Key' button
    • Ensure you set enough permissions on your key to do what you want to do with the coinbase CLI tool.

Optionally, you can have the CLI tool remember your API key and secret. They will be stored (un-encrypted) in a coinbase.json file in your home directory. If you skip this step, you will have to enter the keys with every command, or pass them on the command-line with every command.

coinbase set api-key "<YOUR_API_KEY>"
coinbase set api-secret "<YOUR_API_SECRET>"

Use

Getting Help

First of all, detailed instructions can be found by executing:

coinbase help
coinbase <command> help

Interactive and Non-interactive mode

For most commands, the tool has two modes: interactive and non-interactive. In interactive mode, you don't provide any command-line arguments except the command you would like to run. The tool then asks you questions on the information it needs.

To use interactive mode, simply type coinbase <command> e.g.:

$ coinbase sell

Please choose an account by typing in its number:
1:   name: BTC Wallet, id: 33452906-0ab7-596a-98bd-5923059312065, balance: 3.40000000 BTC, type: wallet
2:   name: LTC Wallet, id: a3b02e94-73f8-557a-a553-5329056236542, balance: 0.94940530 LTC, type: wallet
>2

Please choose a payment method by typing in its number:
1:   name: USD Wallet, id 453ebbdf-9d09-578f-8fec-532532634156, type: fiat_account, currency: USD
2:   name: EUR Wallet, id 453ebbdf-9d09-578f-8fec-ecfd7e7fed17, type: fiat_account, currency: EUR
>2

Please enter the amount e.g. '30.5', or 'all' to sell all your LTC:
?all

Sell Order:
- amount   : 0.94940530 LTC
- fee      : 4.07 EUR
- subtotal : 273.08 EUR
- total    : 269.01 EUR
- status   : created

> Commit
 Cancel
Done!

Press ESC to cancel while the tool is asking for input. If there is only one option for a choice (e.g. you only have one wallet with a non-zero balance), then the tool won't ask you to choose, it will tell you what the value is.

The other option is to pass all necessary information on the command-line:

coinbase sell --account="a3b02e94-73f8-557a-a553-5329056236542" --payment-method="453ebbdf-9d09-578f-8fec-ecfd7e7fed17" --amount="all"

Troubleshooting

If you get the error request timestamp expired, then your system clock is probably off by more than 30 seconds from the coinbase servers. Run coinbase time to get the time that Coinbase thinks it is.

License

License: MIT, see LICENSE file.

Change log

v1.2.2

  • Update dependencies

v1.2.1

  • Fix vulnerable dependencies

v1.2.0

  • Add accounts command
  • Add paymentmethods command
  • Add spotprice command
  • Add time command
  • Add withdraw command

v1.1.0

  • Add buy command
  • Add buyprice command

v1.0.0

  • Initial version: sell and sellprice commands