Skip to content

Dollar-cost averaging for crypto on the command line using Coinbase Pro.

License

Notifications You must be signed in to change notification settings

landakram/hodl-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Usage: hodl-cli [OPTIONS]

  Dollar-cost averaging for crypto on the command line using Coinbase Pro.

  When run, hodl-cli will check whether a deposit needs to be made and, if
  so, initiate the deposit using a linked bank account.

  Then, if there is enough available fiat in the Pro account, hodl-cli will
  buy currencies using the specified fiat amount, given a user-specified
  asset allocation. Currencies are traded at market price at the time the
  script is run.

  hodl-cli is meant to be run as a cron. The cron can be run at any interval
  less than the `interval` -- I recommend daily. The script will ensure that
  deposits and buys are only made every `interval` days irrespective of how
  often it is run. This is done by searching account  history in the past
  `interval` days and ensuring that no deposit or buy for a given amount has
  been executed.

  hodl-cli does *not* protect against concurrency issues. Please make sure
  that only one instance of hodl-cli is running at a time to prevent
  duplicate deposits and buys (PRs welcome).

  In addition to the CLI options, a few environment variables must be
  present:

      COINBASE_PRO_API_KEY
      COINBASE_PRO_API_SECRET
      COINBASE_PRO_PASSPHRASE

  Installation:

      pip install hodl-cli

  Example usage:

      export COINBASE_PRO_API_KEY=<your_api_key>
      export COINBASE_PRO_API_SECRET=<your_api_secret>
      export COINBASE_PRO_PASSPHRASE=<your_passphrase>
      hodl-cli -i 15 -d 100.00 -b 95.00 -a LTC 0.10 -a ETH 0.60 -a BTC 0.30

  Explanation:

      The above invocation will deposit $100.00 every 15 days. In addition,
      if the Pro account has $95.00 available to trade, $95.00 will used to
      buy other currencies as follows:

      10% will be used to buy LTC
      60% will be used to buy ETH
      30% will be used to buy BTC

Options:
  -n, --deposit-account TEXT      Name string used to filter multiple bank
                                  accounts. If not specified, the first
                                  account found with `deposit-account-type` is
                                  used.

  -t, --deposit-account-type TEXT
                                  Account type used in conjunction with
                                  `deposit-account` to find an account from
                                  which to deposit fiat.  [default:
                                  ach_bank_account]

  -d, --deposit-amount DECIMAL    Amount to deposit every `interval` days.
                                  [default: 0.00]

  -i, --interval INTEGER          Interval in days after which a deposit
                                  and/or buy should be made.  [default: 15]

  -b, --buy-amount DECIMAL        The amount of fiat to allocate every
                                  `interval` days.  [default: 0.00]

  -a, --allocation-percentage <TEXT DECIMAL>...
                                  A currency and the percentage of available
                                  funds that should be allocated to it. This
                                  option may be provided multiple times for
                                  different currencies and the total
                                  percentage should add up to 1. If the total
                                  percentage is less than one, the remainder
                                  will be left as fiat.
                                  
                                  Example: -a ETH 0.25 -a BTC 0.25 -a LTC 0.5

  --dry-run                       When present, print what we would have done
                                  but don't actually deposit or buy anything

  -v, --verbose                   When present, print debug logs.
  -h, --help                      Show this message and exit.

About

Dollar-cost averaging for crypto on the command line using Coinbase Pro.

Resources

License

Stars

Watchers

Forks

Packages

No packages published