diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b2734dc --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2020 Dennis Reimann (https://dennisreimann.de) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 043fb25..7a012b4 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,13 @@ First off: Here's to you, [Bittr](https://getbittr.com/) – you will be missed! This script is not a full replacement for the incredible service Bittr offered, but it's a start: Automate your Stacking Sats process by regularly placing buy orders using the [Kraken API](https://www.kraken.com/features/api). +--- + +The original [Bittr is back](https://getbittr.com/press-releases/bittr-is-back)! +This script is still fully working. + +--- + ## ✋ Caveat You need to install the dependency [kraken-api](https://github.com/nothingisdead/npm-kraken-api), which is a third-party package. diff --git a/commands/stack.js b/commands/stack.js index 60ff9ed..b1c9cde 100644 --- a/commands/stack.js +++ b/commands/stack.js @@ -37,6 +37,11 @@ module.exports = async (kraken, validate, { getEnv, getEnvOpt }) => { console.log('📈 Ask:', ask, fiat) console.log('📉 Bid:', bid, fiat, '\n') + if (parseFloat(fiatBalance) < parseFloat(amount)) { + console.log('❌ Insufficient funds') + return + } + // Place order const details = { pair, type: 'buy', ordertype, price, volume } if (validate) details.validate = true diff --git a/package-lock.json b/package-lock.json index 2ad90cf..17205f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,14 +1,17 @@ { "name": "stacking-sats-kraken", - "version": "0.4.3", + "version": "0.4.4", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "0.4.3", + "version": "0.4.4", "license": "MIT", "dependencies": { "kraken-api": "1.0.1" + }, + "funding": { + "url": "https://github.com/dennisreimann/stacking-sats-kraken?sponsor=1" } }, "node_modules/@sindresorhus/is": { @@ -226,9 +229,9 @@ } }, "node_modules/normalize-url": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", - "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", + "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", "engines": { "node": ">=8" } @@ -472,9 +475,9 @@ "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" }, "normalize-url": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", - "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==" + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", + "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==" }, "once": { "version": "1.4.0", diff --git a/package.json b/package.json index 8ea7026..0b621fd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "stacking-sats-kraken", - "version": "0.4.3", + "version": "0.4.4", "description": "Use the Kraken API to stack sats", "author": "Dennis Reimann ", "homepage": "https://github.com/dennisreimann/stacking-sats-kraken",