2.0.0 • Published 6 years ago

peanuts v2.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

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.

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.

ExchangeRequired CredentialsDocumentation
1Broker_1broker_keyhttps://1broker.com/?c=en/content/api-documentation
1BTCXE_1btcxe_key / _1btcxe_secrethttps://1btcxe.com/api-docs.php
ACXacx_key / acx_secrethttps://acx.io/documents/api_v2
Allcoinallcoin_key / allcoin_secrethttps://www.allcoin.com/About/APIReference
ANXProanxpro_key / anxpro_secrethttp://docs.anxv2.apiary.io
Biboxbibox_key / bibox_secrethttps://github.com/Biboxcom/api_reference/wiki/home_en
Binancebinance_key / binance_secrethttps://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md
Bit2Cbit2c_key / bit2c_secrethttps://www.bit2c.co.il/home/api
BitBaybitbay_key / bitbay_secrethttps://bitbay.net/public-api
Bitcoin.co.idbitcoincoid_key / bitcoincoid_secrethttps://vip.bitcoin.co.id/downloads/BITCOINCOID-API-DOCUMENTATION.pdf
Bitfinexbitfinex_key / bitfinex_secrethttps://bitfinex.readme.io/v1/docs
Bitfinex v2bitfinex2_key / bitfinex2_secrethttps://bitfinex.readme.io/v2/docs
bitFlyerbitflyer_key / bitflyer_secrethttps://bitflyer.jp/API
Bithumbbithumb_key / bithumb_secrethttps://www.bithumb.com/u1/US127
Bitlishbitlish_keyhttps://bitlish.com/api
BitMarketbitmarket_key / bitmarket_secrethttps://www.bitmarket.net/docs.php?file=api_public.html
BitMEXbitmex_key / bitmex_secrethttps://www.bitmex.com/app/apiOverview
Bitsobitso_key / bitso_secrethttps://bitso.com/api_info
Bitstampbitstamp_key / bitstamp_secret / bitstamp_userhttps://www.bitstamp.net/api
Bitstamp v1bitstamp1_key / bitstamp1_secret / bitstamp1_userhttps://www.bitstamp.net/api
Bittrexbittrex_key / bittrex_secrethttps://bittrex.com/Home/Api
Bit-Zbitz_key / bitz_secrethttps://www.bit-z.com/api.html
BL3Pbl3p_key / bl3p_secrethttps://github.com/BitonicNL/bl3p-api/tree/master/docs
Bleutradebleutrade_key / bleutrade_secrethttps://bleutrade.com/help/API
Braziliexbraziliex_key / braziliex_secrethttps://braziliex.com/exchange/api.php
BtcBoxbtcbox_key / btcbox_secrethttps://www.btcbox.co.jp/help/asm
BTCChinabtcchina_key / btcchina_secrethttps://www.btcchina.com/apidocs
BTCExchangebtcexchange_key / btcexchange_secrethttps://github.com/BTCTrader/broker-api-docs
BTC Marketsbtcmarkets_key / btcmarkets_secrethttps://github.com/BTCMarkets/API
BtcTrade.imbtctradeim_key / btctradeim_secrethttps://www.btctrade.im/help.api.html
BTC Trade UAbtctradeua_key / btctradeua_secrethttps://docs.google.com/document/d/1ocYA0yMy_RXd561sfG3qEPZ80kyll36HUxvCRe5GbhE/edit
BTCTurkbtcturk_key / btcturk_secrethttps://github.com/BTCTrader/broker-api-docs
BTCXbtcx_key / btcx_secrethttps://btc-x.is/custom/api-document.html
BX.in.thbxinth_key / bxinth_secrethttps://bx.in.th/info/api
C-CEXccex_key / ccex_secrethttps://c-cex.com/?id=api
CEX.IOcex_key / cex_secret / cex_userhttps://cex.io/cex-api
CHBTCchbtc_key / chbtc_secrethttps://www.chbtc.com/i/developer
ChileBitchilebit_key / chilebit_secrethttps://blinktrade.com/docs
COBINHOODcobinhood_keyhttps://cobinhood.github.io/api-public
coincheckcoincheck_key / coincheck_secrethttps://coincheck.com/documents/exchange/api
CoinEggcoinegg_key / coinegg_secrethttps://www.coinegg.com/explain.api.html
CoinExchangecoinexchange_key / coinexchange_secrethttps://coinexchangeio.github.io/slate/
coinfloorcoinfloor_key / coinfloor_secret / coinfloor_userhttps://github.com/coinfloor/api
Coingicoingi_key / coingi_secrethttp://docs.coingi.apiary.io/
CoinMatecoinmate_key / coinmate_secret / coinmate_userhttp://docs.coinmate.apiary.io
Coinsecurecoinsecure_keyhttps://api.coinsecure.in
CoinSpotcoinspot_key / coinspot_secrethttps://www.coinspot.com.au/api
CoolCoincoolcoin_key / coolcoin_secrethttps://www.coolcoin.com/help.api.html
Cryptopiacryptopia_key / cryptopia_secrethttps://www.cryptopia.co.nz/Forum/Category/45
DSXdsx_key / dsx_secrethttps://api.dsx.uk
EXMOexmo_key / exmo_secrethttps://exmo.me/en/api_doc
flowBTCflowbtc_key / flowbtc_secret / flowbtc_userhttp://www.flowbtc.com.br/api/
FoxBitfoxbit_key / foxbit_secrethttps://blinktrade.com/docs
FYB-SEfybse_key / fybse_secrethttp://docs.fyb.apiary.io
FYB-SGfybsg_key / fybsg_secrethttp://docs.fyb.apiary.io
Gatecoingatecoin_key / gatecoin_secrethttps://gatecoin.com/api
Gate.iogateio_key / gateio_secrethttps://gate.io/api2
GDAXgdax_key / gdax_secret / gdax_passwordhttps://docs.gdax.com
Geminigemini_key / gemini_secrethttps://docs.gemini.com/rest-api
GetBTCgetbtc_key / getbtc_secrethttps://getbtc.org/api-docs.php
HitBTChitbtc_key / hitbtc_secrethttps://github.com/hitbtc-com/hitbtc-api/blob/master/APIv1.md
HitBTC v2hitbtc2_key / hitbtc2_secrethttps://api.hitbtc.com
Huobihuobi_key / huobi_secrethttps://github.com/huobiapi/API_Docs_en/wiki
Huobi CNYhuobicny_key / huobicny_secrethttps://github.com/huobiapi/API_Docs/wiki/REST_api_reference
Huobi Prohuobipro_key / huobipro_secrethttps://github.com/huobiapi/API_Docs/wiki/REST_api_reference
Independent Reserveindependentreserve_key / independentreserve_secrethttps://www.independentreserve.com/API
itBititbit_key / itbit_secrethttps://api.itbit.com/docs
jubi.comjubi_key / jubi_secrethttps://www.jubi.com/help/api.html
Krakenkraken_key / kraken_secrethttps://www.kraken.com/en-us/help/api
Kucoinkucoin_key / kucoin_secrethttps://kucoinapidocs.docs.apiary.io
Kunakuna_key / kuna_secrethttps://kuna.io/documents/api
LakeBTClakebtc_key / lakebtc_secrethttps://www.lakebtc.com/s/api_v2
Liquiliqui_key / liqui_secrethttps://liqui.io/api
LiveCoinlivecoin_key / livecoin_secrethttps://www.livecoin.net/api?lang=en
lunoluno_key / luno_secrethttps://www.luno.com/en/api
Lykkelykke_keyhttps://hft-api.lykke.com/swagger/ui/
Mercado Bitcoinmercado_key / mercado_secrethttps://www.mercadobitcoin.com.br/api-doc
MixCoinsmixcoins_key / mixcoins_secrethttps://mixcoins.com/help/api/
Novaexchangenova_key / nova_secrethttps://novaexchange.com/remote/faq
OKCoin CNYokcoincny_key / okcoincny_secrethttps://www.okcoin.cn/rest_getStarted.html
OKCoin USDokcoinusd_key / okcoinusd_secrethttps://www.okcoin.com/rest_getStarted.html
OKEXokex_key / okex_secrethttps://www.okex.com/rest_getStarted.html
Paymiumpaymium_key / paymium_secrethttps://github.com/Paymium/api-documentation
Poloniexpoloniex_key / poloniex_secrethttps://poloniex.com/support/api/
QRYPTOSqryptos_key / qryptos_secrethttps://developers.quoine.com
QuadrigaCXquadrigacx_key / quadrigacx_secret / quadrigacx_userhttps://www.quadrigacx.com/api_info
QUOINEXquoinex_key / quoinex_secrethttps://developers.quoine.com
SouthXchangesouthxchange_key / southxchange_secrethttps://www.southxchange.com/Home/Api
SurBitcoinsurbitcoin_key / surbitcoin_secrethttps://blinktrade.com/docs
TheRockTradingtherock_key / therock_secrethttps://api.therocktrading.com/doc/v1/index.html
Tidextidex_key / tidex_secrethttps://tidex.com/exchange/public-api
UrduBiturdubit_key / urdubit_secrethttps://blinktrade.com/docs
Vaultorovaultoro_key / vaultoro_secrethttps://api.vaultoro.com
VBTCvbtc_key / vbtc_secrethttps://blinktrade.com/docs
VirWoXvirwox_key / virwox_login / virwox_passwordhttps://www.virwox.com/developers.php
WEXwex_key / wex_secrethttps://wex.nz/api/3/docs
xBTCexbtce_key / xbtce_secret / xbtce_userhttps://www.xbtce.com/tradeapi
YoBityobit_key / yobit_secrethttps://www.yobit.net/en/api/
YUNBIyunbi_key / yunbi_secrethttps://yunbi.com/documents/api/guide
Zaifzaif_key / zaif_secrethttp://techbureau-api-document.readthedocs.io/ja/latest/index.html
ZBzb_key / zb_secrethttps://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.