peanuts

2.0.0 • Public • Published

Peanuts

A simple (CLI) tool that automatically trades cryptocurrencies based on a defined threshold

Build Status Dependency Status Dependency Status

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.

Peanuts

Requirements

  • Node.js v8+

Installation

npm install -g peanuts

Usage

$ peanuts {OPTIONS}

Configuration

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.)

Options

Due to the fact that there is no all-in-one exchange service that offers all currencies, you can add multiple exchanges to Peanuts.

Purchases

Now that Peanuts is able to perform buys for you, you need to specify what kind of buys you want to be performed.

base

The base currency used for specifying the desired amount.

Example: USD

Default: EUR

currency

The cryptocurrency used for actually buying cryptocurrencies (as most exchanges only accept other cryptocurrencies like Bitcoin for buying altcoins).

Example: ETH

Default: BTC

top

The quantity of currencies you want to check starting at #1 of the CoinMarketCap ranking.

Example: 20 (#1—#20)

Default: 10 (#1—#10)

amount

Amount of your base currency to buy currencies for.

Example: 20

Default: 10

threshold

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

storage

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)

blacklist

List of currencies (= their symbols) that shall be ignored/skipped.

Example: ['BTC', 'ETH']

Default: []

whitelist

List of currencies (= their symbols) that shall be traded without exception. Any other currency will be ignored/skipped.

Example: ['XRP', 'XLM']

Default: []

order

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: []

Exchanges

Peanuts uses ccxt for trades and currently supports the following 101 cryptocurrency exchange markets and trading APIs.

Exchange Required Credentials Documentation
1Broker _1broker_key https://1broker.com/?c=en/content/api-documentation
1BTCXE _1btcxe_key / _1btcxe_secret https://1btcxe.com/api-docs.php
ACX acx_key / acx_secret https://acx.io/documents/api_v2
Allcoin allcoin_key / allcoin_secret https://www.allcoin.com/About/APIReference
ANXPro anxpro_key / anxpro_secret http://docs.anxv2.apiary.io
Bibox bibox_key / bibox_secret https://github.com/Biboxcom/api_reference/wiki/home_en
Binance binance_key / binance_secret https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md
Bit2C bit2c_key / bit2c_secret https://www.bit2c.co.il/home/api
BitBay bitbay_key / bitbay_secret https://bitbay.net/public-api
Bitcoin.co.id bitcoincoid_key / bitcoincoid_secret https://vip.bitcoin.co.id/downloads/BITCOINCOID-API-DOCUMENTATION.pdf
Bitfinex bitfinex_key / bitfinex_secret https://bitfinex.readme.io/v1/docs
Bitfinex v2 bitfinex2_key / bitfinex2_secret https://bitfinex.readme.io/v2/docs
bitFlyer bitflyer_key / bitflyer_secret https://bitflyer.jp/API
Bithumb bithumb_key / bithumb_secret https://www.bithumb.com/u1/US127
Bitlish bitlish_key https://bitlish.com/api
BitMarket bitmarket_key / bitmarket_secret https://www.bitmarket.net/docs.php?file=api_public.html
BitMEX bitmex_key / bitmex_secret https://www.bitmex.com/app/apiOverview
Bitso bitso_key / bitso_secret https://bitso.com/api_info
Bitstamp bitstamp_key / bitstamp_secret / bitstamp_user https://www.bitstamp.net/api
Bitstamp v1 bitstamp1_key / bitstamp1_secret / bitstamp1_user https://www.bitstamp.net/api
Bittrex bittrex_key / bittrex_secret https://bittrex.com/Home/Api
Bit-Z bitz_key / bitz_secret https://www.bit-z.com/api.html
BL3P bl3p_key / bl3p_secret https://github.com/BitonicNL/bl3p-api/tree/master/docs
Bleutrade bleutrade_key / bleutrade_secret https://bleutrade.com/help/API
Braziliex braziliex_key / braziliex_secret https://braziliex.com/exchange/api.php
BtcBox btcbox_key / btcbox_secret https://www.btcbox.co.jp/help/asm
BTCChina btcchina_key / btcchina_secret https://www.btcchina.com/apidocs
BTCExchange btcexchange_key / btcexchange_secret https://github.com/BTCTrader/broker-api-docs
BTC Markets btcmarkets_key / btcmarkets_secret https://github.com/BTCMarkets/API
BtcTrade.im btctradeim_key / btctradeim_secret https://www.btctrade.im/help.api.html
BTC Trade UA btctradeua_key / btctradeua_secret https://docs.google.com/document/d/1ocYA0yMy_RXd561sfG3qEPZ80kyll36HUxvCRe5GbhE/edit
BTCTurk btcturk_key / btcturk_secret https://github.com/BTCTrader/broker-api-docs
BTCX btcx_key / btcx_secret https://btc-x.is/custom/api-document.html
BX.in.th bxinth_key / bxinth_secret https://bx.in.th/info/api
C-CEX ccex_key / ccex_secret https://c-cex.com/?id=api
CEX.IO cex_key / cex_secret / cex_user https://cex.io/cex-api
CHBTC chbtc_key / chbtc_secret https://www.chbtc.com/i/developer
ChileBit chilebit_key / chilebit_secret https://blinktrade.com/docs
COBINHOOD cobinhood_key https://cobinhood.github.io/api-public
coincheck coincheck_key / coincheck_secret https://coincheck.com/documents/exchange/api
CoinEgg coinegg_key / coinegg_secret https://www.coinegg.com/explain.api.html
CoinExchange coinexchange_key / coinexchange_secret https://coinexchangeio.github.io/slate/
coinfloor coinfloor_key / coinfloor_secret / coinfloor_user https://github.com/coinfloor/api
Coingi coingi_key / coingi_secret http://docs.coingi.apiary.io/
CoinMate coinmate_key / coinmate_secret / coinmate_user http://docs.coinmate.apiary.io
Coinsecure coinsecure_key https://api.coinsecure.in
CoinSpot coinspot_key / coinspot_secret https://www.coinspot.com.au/api
CoolCoin coolcoin_key / coolcoin_secret https://www.coolcoin.com/help.api.html
Cryptopia cryptopia_key / cryptopia_secret https://www.cryptopia.co.nz/Forum/Category/45
DSX dsx_key / dsx_secret https://api.dsx.uk
EXMO exmo_key / exmo_secret https://exmo.me/en/api_doc
flowBTC flowbtc_key / flowbtc_secret / flowbtc_user http://www.flowbtc.com.br/api/
FoxBit foxbit_key / foxbit_secret https://blinktrade.com/docs
FYB-SE fybse_key / fybse_secret http://docs.fyb.apiary.io
FYB-SG fybsg_key / fybsg_secret http://docs.fyb.apiary.io
Gatecoin gatecoin_key / gatecoin_secret https://gatecoin.com/api
Gate.io gateio_key / gateio_secret https://gate.io/api2
GDAX gdax_key / gdax_secret / gdax_password https://docs.gdax.com
Gemini gemini_key / gemini_secret https://docs.gemini.com/rest-api
GetBTC getbtc_key / getbtc_secret https://getbtc.org/api-docs.php
HitBTC hitbtc_key / hitbtc_secret https://github.com/hitbtc-com/hitbtc-api/blob/master/APIv1.md
HitBTC v2 hitbtc2_key / hitbtc2_secret https://api.hitbtc.com
Huobi huobi_key / huobi_secret https://github.com/huobiapi/API_Docs_en/wiki
Huobi CNY huobicny_key / huobicny_secret https://github.com/huobiapi/API_Docs/wiki/REST_api_reference
Huobi Pro huobipro_key / huobipro_secret https://github.com/huobiapi/API_Docs/wiki/REST_api_reference
Independent Reserve independentreserve_key / independentreserve_secret https://www.independentreserve.com/API
itBit itbit_key / itbit_secret https://api.itbit.com/docs
jubi.com jubi_key / jubi_secret https://www.jubi.com/help/api.html
Kraken kraken_key / kraken_secret https://www.kraken.com/en-us/help/api
Kucoin kucoin_key / kucoin_secret https://kucoinapidocs.docs.apiary.io
Kuna kuna_key / kuna_secret https://kuna.io/documents/api
LakeBTC lakebtc_key / lakebtc_secret https://www.lakebtc.com/s/api_v2
Liqui liqui_key / liqui_secret https://liqui.io/api
LiveCoin livecoin_key / livecoin_secret https://www.livecoin.net/api?lang=en
luno luno_key / luno_secret https://www.luno.com/en/api
Lykke lykke_key https://hft-api.lykke.com/swagger/ui/
Mercado Bitcoin mercado_key / mercado_secret https://www.mercadobitcoin.com.br/api-doc
MixCoins mixcoins_key / mixcoins_secret https://mixcoins.com/help/api/
Novaexchange nova_key / nova_secret https://novaexchange.com/remote/faq
OKCoin CNY okcoincny_key / okcoincny_secret https://www.okcoin.cn/rest_getStarted.html
OKCoin USD okcoinusd_key / okcoinusd_secret https://www.okcoin.com/rest_getStarted.html
OKEX okex_key / okex_secret https://www.okex.com/rest_getStarted.html
Paymium paymium_key / paymium_secret https://github.com/Paymium/api-documentation
Poloniex poloniex_key / poloniex_secret https://poloniex.com/support/api/
QRYPTOS qryptos_key / qryptos_secret https://developers.quoine.com
QuadrigaCX quadrigacx_key / quadrigacx_secret / quadrigacx_user https://www.quadrigacx.com/api_info
QUOINEX quoinex_key / quoinex_secret https://developers.quoine.com
SouthXchange southxchange_key / southxchange_secret https://www.southxchange.com/Home/Api
SurBitcoin surbitcoin_key / surbitcoin_secret https://blinktrade.com/docs
TheRockTrading therock_key / therock_secret https://api.therocktrading.com/doc/v1/index.html
Tidex tidex_key / tidex_secret https://tidex.com/exchange/public-api
UrduBit urdubit_key / urdubit_secret https://blinktrade.com/docs
Vaultoro vaultoro_key / vaultoro_secret https://api.vaultoro.com
VBTC vbtc_key / vbtc_secret https://blinktrade.com/docs
VirWoX virwox_key / virwox_login / virwox_password https://www.virwox.com/developers.php
WEX wex_key / wex_secret https://wex.nz/api/3/docs
xBTCe xbtce_key / xbtce_secret / xbtce_user https://www.xbtce.com/tradeapi
YoBit yobit_key / yobit_secret https://www.yobit.net/en/api/
YUNBI yunbi_key / yunbi_secret https://yunbi.com/documents/api/guide
Zaif zaif_key / zaif_secret http://techbureau-api-document.readthedocs.io/ja/latest/index.html
ZB zb_key / zb_secret https://www.zb.com/i/developer

Changelog

  • 2.0.0
    • Initial version

Thanks

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.

Disclaimer

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.

License

Copyright (c) 2018 Thomas Rasshofer
Licensed under the MIT license.

See LICENSE for more info.

Readme

Keywords

Package Sidebar

Install

npm i peanuts

Weekly Downloads

2

Version

2.0.0

License

MIT

Unpacked Size

152 kB

Total Files

8

Last publish

Collaborators

  • rasshofer