Code Monkey home page Code Monkey logo

coinx's Introduction

coinx

A command-line tool to interact with multiple crypto-currencies exchanges. Buy, sell, find the best price, and check your exchange balances.

Setup

Usage

Security

Automation

Install

Install it globally on your computer. npm install -g coinx

Upgrade to the latest version

Coinx is currently at version 0.10.0 You can upgrade with npm: npm update -g coinx

Supported Exchanges

Currently: Kraken, Poloniex, Bitfinex, Liqui, Bittrex.

Configure

The tool uses your exchange API keys to make requests and queries. You'll have to get your API keys from each exchange manually, but then you can store it in the tool by using the config command.

$ coinx config kraken
? Kraken API Key abcd
? Kraken API Secret efgh
Saved data for Kraken

Note: Your API Keys and Secrets are stored in your operating system home directory in a coinx directory as a JSON file.

Update

Use coinx update to update coinx with the latest list of coins from coinmarketcap.com.

Coin Price

Get the price of any crypto-currency by using the coin's symbol. Bitcoin is shown in US Dollars, all other coins are shown in BTC and in US Dollars.

For example, to get the price of Bitcoin:

$ coinx price btc
Getting prices for BTC...
Exchange Price in USD
Liqui        $2419.87
Bitfinex     $2429.68
Poloniex     $2431.92
Bittrex      $2442.46
Kraken       $2454.00
                     
Average      $2435.59

Or, to get the price of Etherium:

$ coinx price eth
Getting prices for Ethereum (ETH)...
Exchange Price in BTC Price in USD
Liqui      0.08789270      $208.30
Poloniex   0.08809500      $208.78
Kraken     0.08811500      $208.82
Bitfinex   0.08821900      $209.07
Bittrex    0.08840483      $209.51
                                  
Average    0.08814531      $208.89

Or, for Siacoin:

$ coinx price sc
Getting prices for Siacoin (SC)...
Exchange Price in BTC Price in USD
Bittrex    0.00000335        $0.01
Poloniex   0.00000333        $0.01
                                  
Average    0.00000334        $0.01

Check Exchange Funds

Check your balances on the exchanges.

$ coinx funds
Getting balances...
Poloniex
Name             Symbol          Count Value USD
Bitcoin          BTC        0.03227520    $76.51
Siacoin          SC      2465.11765598    $19.46
NEM              XEM      151.10258763    $18.43
Dash             DASH       0.09817530    $16.94

...

Options:

$ coinx funds --help
Options:

    -e, --exchange [name]  Get balances at the specified exchange.
    -a, --alphabetically   Sort the balance list alphabetically.
    -n, --numerically      Sort the balance list by the number of coins, descending.
    -c, --coin [symbol]    Only get balances for this coin.

For example, to check balances only on Liqui:

$ coinx funds -e poloniex
Getting balances on Liqui...
Liqui
Name                  Symbol        Count Value USD
Bitcoin               BTC      0.02564645    $30.77
Ethereum              ETH      0.08706164    $18.04
Augur                 REP      0.66674308    $13.59
MobileGo              MGO     17.23038495    $13.33
...

Or, to check how many BTC you have on all the exchanges:

$ coinx funds -c btc
Getting balances...
Poloniex
Name    Symbol      Count Value USD
Bitcoin BTC    0.00227520    $6.53
Total                        $6.53
Kraken
Name    Symbol      Count Value USD
Bitcoin BTC    0.00237879    $6.40
Total                        $6.40
Liqui
Name    Symbol      Count Value USD
Bitcoin BTC    0.00256464    $6.81
Total                        $6.81

Buy Coins

Buy a coin by specifying, in US dollars, how much you want to spend. Note that BTC is what will actually be spent! You must have the necessary BTC available on the exchange for the purchase to go through.

Coinx will automatically use the exchange with the best rate, unless you specify an exchange to use via the --exchange option.

Before the purchase goes through, you'll be asked to confirm.

For example, to buy $2 worth of AntShares at the best available price:

$ coinx buy ans -$ 2
Checking AntShares (ANS) on the markets...
Best price found on Bittrex at $8.14

*Note that the number of coins may change slightly if the market fluctuates*
? Buy about 0.24562982 worth of ANS? Yes
Buying...
Order complete!
Bittrex order number xxxxx-xxxxx-xxxxxxx
Bought 0.2461696 ANS
Worth about $2.00

Or, to buy $2 worth of Ethereum on the Liqui exchange:

$ coinx buy eth -e liqui -$ 2
Checking Ethereum (ETH) on the markets...
Best price found on Liqui at $278.70

*Note that the number of coins may change slightly if the market fluctuates*

? Buy about 0.00717629 worth of ETH? Yes
Buying...
Order complete!
Liqui order number 0
Bought 0.00717629 ETH
Worth about $2.00

The results of all purchases are logged into {home folder}/coinx/log.csv.

Sell Coins

Coming soon.

Lock

Encrypt the file that contains your API keys. Please choose a good password, and don't forget it. If you do forget it, you'll have to delete the coinx.json file in your {homedir}/coinx folder, and rerun coinx config for each exchange.

coinx lock password

After you lock your config, you will not be able to use coinx until you unlock it.

Unlock

Decrypt your API key file.

coinx unlock password

Actions

Actions are a way to automate steps in coinx.

Buy all the Coins!

Lets you buy the top crypto coins by market cap. Specify how much you want to spend per coin (-$), and how many coins you want to buy (-t, default is 50).

You can exclude coins by putting their symbol into the exclude_coins.txt in the actions/buyallthecoins folder.

$ coinx action buyallthecoins -$ 2 -t 50
Buy all the coins!
Spend per coin: $2
Coins to buy: 50
Maximum spend: $100 (assumes all coins available to buy)
Will not buy:  BTC, USDT, BCC, VERI
? Proceed? Yes
Getting latest Market Cap list...
Got list...
Skipping excluded coin Bitcoin.

Buying Ethereum.
Checking Ethereum (ETH) on the markets...
Best price found on Bittrex at $228.64
Buying 0.00874752 Ethereum on Bittrex
Order complete!
Bittrex order number e2fffabd-915b-4d13-bf37-af534cf82af8
Bought 0.00874747 ETH at 0.08268905 BTC per coin
Worth about $2.00

Buying Ripple.
Checking Ripple (XRP) on the markets...
Best price found on Bittrex at $0.20
...

coinx's People

Contributors

alexandrfox avatar johntitus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coinx's Issues

Add a total to: "coinx funds" command

The "coinx funds" command breaks down your funds to each separate exchange, add a new table to collate all the results:

Poloniex
Coin Count
BTC 1.0
ETH 1.0

Kraken
Coin Count
BTC 1.0
ETH 1.0

TOTAL
Coin Count
BTC 2.0
ETH 2.0

Support coin names

It would be nice if you could use the coin name instead of the symbol. Also, when doing a buy, it should spit out the name of the coin AND the symbol, just to be safe.

SyntaxError: Unexpected token =

when I try to config kraken, i got this error, do you know what might have happen?
[email protected]:~$ coinx config kraken
/usr/local/lib/node_modules/coinx/node_modules/bitfinex-api-node/index.js:11
constructor (apiKey, apiSecret, opts = { version: 1, transform: false, nonceGenerator: false }) {
^

SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object. (/usr/local/lib/node_modules/coinx/lib/bitfinex.js:4:13)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at /usr/local/lib/node_modules/coinx/commands/coinx-core.js:29:20
at Array.forEach (native)

price btc get unhandled promise reject warning

(node:46296) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'last' of undefined


(node:46296) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

while getting other coins' price is perfectly working. why?
node version 8.7

How to automatically select top 50 coins by market cap and buy instead of having to confirm purchase a coin one by one each time?

Hi! First off, love the idea of buying the top 50 coins! Great idea!

I'm not a techie guy and am having a bit of a difficult time trying to figure how when I want to make my weekly $100 buy, instead of having to type out each coin's symbol and buy each coin one by one and specifying yes to each transaction, is there a way where I can lump together a bunch of coins i want to buy and then specify to buy $2 of each?

The latter way I feel like can save a lot of time.

Error: Kraken API returned error: General:Invalid arguments:volume

Trying to buy either single coin or all the coins gives me that error. Note that querying works just fine. I'm on Windows (tried with git bash and normal command prompt and result is the same). I'm using the latest version.

tonip@JAARA MINGW64 /c/coinsim
$ coinx buy eth -$ 2
Buying...
Checking Ethereum (ETH) on the markets...
Best price found on Kraken at $293.82

*Note that the number of coins may change slightly if the market fluctuates*

? Buy about 0.00680695 worth of ETH? (Y/n) y
? Buy about 0.00680695 worth of ETH? Yes
Buying...
An error occurred.
{ Error: Kraken API returned error: General:Invalid arguments:volume
    at Request._callback (C:\Users\tonip\AppData\Roaming\npm\node_modules\coinx\node_modules\kraken-api\kraken.js:156:34)
    at Request.self.callback (C:\Users\tonip\AppData\Roaming\npm\node_modules\coinx\node_modules\request\request.js:188:22)
    at emitTwo (events.js:125:13)
    at Request.emit (events.js:213:7)
    at Request.<anonymous> (C:\Users\tonip\AppData\Roaming\npm\node_modules\coinx\node_modules\request\request.js:1171:10)
    at emitOne (events.js:115:13)
    at Request.emit (events.js:210:7)
    at IncomingMessage.<anonymous> (C:\Users\tonip\AppData\Roaming\npm\node_modules\coinx\node_modules\request\request.js:1091:12)
    at Object.onceWrapper (events.js:314:30)
    at emitNone (events.js:110:20)
    at IncomingMessage.emit (events.js:207:7)
    at endReadableNT (_stream_readable.js:1045:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  cause:
   Error: Kraken API returned error: General:Invalid arguments:volume
       at Request._callback (C:\Users\tonip\AppData\Roaming\npm\node_modules\coinx\node_modules\kraken-api\kraken.js:156:34)
       at Request.self.callback (C:\Users\tonip\AppData\Roaming\npm\node_modules\coinx\node_modules\request\request.js:188:22)
       at emitTwo (events.js:125:13)
       at Request.emit (events.js:213:7)
       at Request.<anonymous> (C:\Users\tonip\AppData\Roaming\npm\node_modules\coinx\node_modules\request\request.js:1171:10)
       at emitOne (events.js:115:13)
       at Request.emit (events.js:210:7)
       at IncomingMessage.<anonymous> (C:\Users\tonip\AppData\Roaming\npm\node_modules\coinx\node_modules\request\request.js:1091:12)
       at Object.onceWrapper (events.js:314:30)
       at emitNone (events.js:110:20)
       at IncomingMessage.emit (events.js:207:7)
       at endReadableNT (_stream_readable.js:1045:12)
       at _combinedTickCallback (internal/process/next_tick.js:138:11)
       at process._tickCallback (internal/process/next_tick.js:180:9),
  isOperational: true }


Error: Cannot find module 'C:\index-config'

I just installed coinx and when trying to configure it with my API keys, I get the following error message:

C:\>coinx config poloniex
module.js:487
    throw err;
    ^

Error: Cannot find module 'C:\index-config'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Function.Module.runMain (module.js:605:10)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:575:3

Add encryption to protect API keys

At the moment JSON file with API keys is stored in plain-text format. I think it would be nice to offer optional (?) encryption to protect its contents.

Poloniex spits out too much

Buying...
lowest ask 0.00004336
num coins to buy 46.27226291
{ orderNumber: '27717540783',
resultingTrades:
[ { amount: '46.27226291',
date: '2017-07-07 20:27:55',
rate: '0.00004335',
total: '0.00200590',
tradeID: '2210499',
type: 'buy' } ] }
Order complete!
Poloniex order number xxxxx

Bittrex orders that aren't instantly filled

Best price found on Bittrex at $2.40

Note that the number of coins may change slightly if the market fluctuates

? Buy about 2.08758769 worth of PIVX? Yes
Buying...
(node:21616) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'Quantity' of undefined

Order was placed but not instantly filled.

TypeError: Object.values is not a function

What is wrong with my installation? I can successfully get my funds from kraken but i can't buy anything or check specific prices:

coinx price btc
/usr/local/lib/node_modules/coinx/commands/coinx-price.js:12
const exchanges = Object.values(coinx.exchanges());
^

TypeError: Object.values is not a function
at Object. (/usr/local/lib/node_modules/coinx/commands/coinx-price.js:12:26)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3

Cannot read property 'length'?

Hi, I'm getting this issue when I try and buy some eth off of any market. I'm also unable to check my balance correctly. I know I have funds in the exchanges but it always returns the value as $0.00.

Any suggestions?

An error occurred.
TypeError: Cannot read property 'length' of undefined
at api.returnTickerAsync.then.then.orderData (C:\Users\William\AppData\Roaming\npm\node_modules\coinx\lib\poloniex.js:90:34)
at tryCatcher (C:\Users\William\AppData\Roaming\npm\node_modules\coinx\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\William\AppData\Roaming\npm\node_modules\coinx\node_modules\bluebird\js\release\promise.js:512:31)
at Promise._settlePromise (C:\Users\William\AppData\Roaming\npm\node_modules\coinx\node_modules\bluebird\js\release\promise.js:569:18)
at Promise._settlePromise0 (C:\Users\William\AppData\Roaming\npm\node_modules\coinx\node_modules\bluebird\js\release\promise.js:614:10)
at Promise._settlePromises (C:\Users\William\AppData\Roaming\npm\node_modules\coinx\node_modules\bluebird\js\release\promise.js:693:18)
at Promise._fulfill (C:\Users\William\AppData\Roaming\npm\node_modules\coinx\node_modules\bluebird\js\release\promise.js:638:18)
at C:\Users\William\AppData\Roaming\npm\node_modules\coinx\node_modules\bluebird\js\release\nodeback.js:42:21
at Request._callback (C:\Users\William\AppData\Roaming\npm\node_modules\coinx\node_modules\poloniex.js\lib\poloniex.js:79:7)
at Request.self.callback (C:\Users\William\AppData\Roaming\npm\node_modules\coinx\node_modules\poloniex.js\node_modules\request\request.js:122:22)
at emitTwo (events.js:125:13)
at Request.emit (events.js:213:7)
at Request. (C:\Users\William\AppData\Roaming\npm\node_modules\coinx\node_modules\poloniex.js\node_modules\request\request.js:888:14)
at emitOne (events.js:120:20)
at Request.emit (events.js:210:7)
at IncomingMessage. (C:\Users\William\AppData\Roaming\npm\node_modules\coinx\node_modules\poloniex.js\node_modules\request\request.js:839:12)
at emitNone (events.js:110:20)
at IncomingMessage.emit (events.js:207:7)
at endReadableNT (_stream_readable.js:1059:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)

Add a "coinx transfer" command

This command will transfer btc from one exchange to another to aid in "buying" from the destination exchange to aid "insufficient funds" issue.

coinx transfer btc -$ 200 -e poloniex kraken

This will transfer $200 dollars of btc from poloniex to kraken

What happens when there are no funds in your account?

From the README, the script assumes you have funds in these exchanges to buy that many coins. How are you going about ensuring that funds are there for you to buy these coins? Is this script buying via fiat and then buying BTC which can be used to but the altcoin. Do you have any goals to add this to the roadmap if this is not part of the plan?

Show how much $ was saved when buying

It already chooses the best price when buying, so lets say the best price was on poloniex.

In the output, show something like Saved $1.20 over buying on liqui

Add a "coinx status" command

This command will check the market status of a given coin:

coinx status coins
ETH is currently -10% since yesterday
BTC is currently +12% since yesterday

coinx status coins eth
ETH is currently -10% since yesterday

Problem with setting up config to exchanges

Hi,

I am new to cmd line programs but I would like to give this a try. I have the program running now, but when I try to run the config command it gives the following error.

$ coinx config poloniex
module.js:471
throw err;
^

Error: Cannot find module 'C:[pagthway to coinx-master folder here]\index-config'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3

Would you be able to tell from this error what is going wrong? I am using Cygwin terminal on windows.

Warn if there is insufficient funds with the exchange during a buy operation

When trying to buy from any exchange, you get the best possible price - however, if you have insufficient funds at that address you receive an error:

(node:21547) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Invalid order: not enough exchange balance for 0.00837328 ETHBTC at 0.095131
(node:21547) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

This should be replaced with: "Insufficient funds at the $exchange exchange, buy from the second most convenient $convenientExchange exchange?"

#12 can be invoked

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.