A simple (CLI) tool that automatically trades cryptocurrencies based on a defined threshold
Diversification is a common investment technique of spreading investments around to reduce the volatility of a portfolio over time. Peanuts allows building a diversified cryptocurrency portfolio by buying coins you don’t have already and selling those you have based on defined thresholds. It all happens automatically and is supposed to be configured as a cronjob that is executed once per minute/hour/day.
- Node.js v8+
npm install -g peanuts
$ peanuts {OPTIONS}
Peanuts is configured using the following options via a configuration file, environment variables, and/or command-line arguments.
First of all, Peanuts looks for a JSON file called peanuts.json
within the current working directory.
{
"base": "eur",
"currency": "btc",
"top": "10",
"amount": "50",
"threshold": "150",
"order": [
"binance"
],
"blacklist": [
"btc",
"eth",
"ltc"
]
}
Afterwards, Peanuts will take environment variables into account.
base=eur currency=btc top=20 amount=20 threshold=150 peanuts
Concluding, Peanuts will take command-line arguments into account.
peanuts --base=eur --currency=btc --top=20 --amount=20 --threshold=150 --blacklist=BTC --blacklist=ETH --blacklist=LTC
(All options are merged into a single configuration using the hierarchy described above.)
Due to the fact that there is no all-in-one exchange service that offers all currencies, you can add multiple exchanges to Peanuts.
Now that Peanuts is able to perform buys for you, you need to specify what kind of buys you want to be performed.
The base currency used for specifying the desired amount.
Example: USD
Default: EUR
The cryptocurrency used for actually buying cryptocurrencies (as most exchanges only accept other cryptocurrencies like Bitcoin for buying altcoins).
Example: ETH
Default: BTC
The quantity of currencies you want to check starting at #1 of the CoinMarketCap ranking.
Example: 20
(#1—#20)
Default: 10
(#1—#10)
Amount of your base currency to buy currencies for.
Example: 20
Default: 10
Growth rate to sell currencies at expressed as a percentage based on (and including) the buying price (= 100%). For instance 200
equals 200% and means that your currencies are sold as soon as they doubled in value.
Example: 150
Default: 200
Temporary storage (= JSON file) where your portfolio (currencies held including their buying cost) is stored.
Example: /Users/johndoe/Desktop/portfolio.json
Default: storage.json
(within the current working directory)
List of currencies (= their symbols) that shall be ignored/skipped.
Example: ['BTC', 'ETH']
Default: []
List of currencies (= their symbols) that shall be traded without exception. Any other currency will be ignored/skipped.
Example: ['XRP', 'XLM']
Default: []
Ranking of your preferred exchange services. For instance ['kraken', 'bitfinex']
would always try to buy/sell your portfolio using Kraken but fall back on Bitfinex in case Kraken does not support the respective currency.
Example: ['kraken', 'bitfinex']
Default: []
Peanuts uses ccxt for trades and currently supports the following 101 cryptocurrency exchange markets and trading APIs.
- 2.0.0
- Initial version
Special thanks to Robert Kowalski for handing over the peanuts
package name on npm to me. Please check out robertkowalski/peanuts in case you’re looking for the code of versions <2.0.0.
You use Peanuts at your own risk. I would only recommend trying out Peanuts with small amounts you are willing to lose for educational purposes. Running a bot (and trading in general) requires careful study of the risks and parameters. Wrong settings can cause a major loss. Peanuts relies on 3rd party APIs which may fail at any time and is experimental software which also may fail at any time. Thus never leave Peanuts un-monitored for long periods of time. Be prepared to stop it if too much loss occurs. You alone are responsible for anything that happens when you’re live-trading.
Copyright (c) 2018 Thomas Rasshofer
Licensed under the MIT license.
See LICENSE for more info.