Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/andresilvasantos/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
supershwa committed May 2, 2018
2 parents 9e1ba42 + c724af8 commit 0fd445e
Show file tree
Hide file tree
Showing 30 changed files with 1,602 additions and 423 deletions.
28 changes: 28 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
### Prerequisites

* [ ] Are you running the latest version?
* [ ] Are you reporting to the correct repository?
* [ ] Did you search the current opened issues?


### Description

[Description of the bug or feature]

### Steps to Reproduce

1. [First Step]
2. [Second Step]
3. [and so on...]

**Expected behavior:** [What you expected to happen]

**Actual behavior:** [What actually happened]

### Versions

Bitprophet version: [version]

NPM version: [version]

You can get this information from executing `npm version`.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
node_modules/
package-lock.json
19 changes: 19 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
MIT License

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.
94 changes: 69 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![NPM](https://nodei.co/npm/bitprophet.png?compact=true)](https://npmjs.org/package/bitprophet)

# BitProphet
BitProphet is a node crypto trading platform for Binance exchange that uses Telegram as its interface. Its main purpose is the automation of trading techniques, but it can also be used as a simple order notification tracker or as an alert system for the most used technical indicators.
BitProphet is a node crypto trading platform for Binance exchange that uses chat bots as its interface. Its main purpose is the automation of trading techniques, but it can also be used as a simple order notification tracker or as an alert system for the most used technical indicators.
Suggestions and pull requests are very welcome!

#### Features
Expand All @@ -10,7 +10,7 @@ Suggestions and pull requests are very welcome!
* Stop loss and trailing profits
* Paper trading
* Create your own strategies
* Be notified anywhere
* Be notified anywhere with Telegram or Discord

![Telegram Interface](https://github.com/andresilvasantos/bitprophet/raw/master/pres/chat_example.png)

Expand All @@ -19,21 +19,27 @@ Suggestions and pull requests are very welcome!
npm install bitprophet --save
```

#### Setting Up Telegram
#### Setting Up Telegram Bot
First, you'll need to create a bot for Telegram. Just talk to [BotFather](https://telegram.me/botfather) and follow simple steps until it gives you a token for it.
You'll also need to create a Telegram group, the place where you and BitProphet will communicate. After creating it, add the bot as administrator (make sure to uncheck "All Members Are Admins").

#### Retrieving Telegram's Group ID
In order to find out the group id you've just created, run node with the following code and then just say something in the group. The bot will reply with the chat id.
#### Setting Up Discord Bot (optional)
Create a server and follow [these simple steps](https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token) until you have a token and added the bot to the server you've just created.

#### Retrieving Chat IDs
In order to find out the chat id where your bot was added to, run node with the following code and then just say something in the group/server. The bot will reply with the chat id.

```javascript
const bitprophet = require('bitprophet')
bitprophet.options({
telegram: {
token: "YOUR_TELEGRAM_BOT_TOKEN"
},
discord: {
token: "YOUR_DISCORD_BOT_TOKEN"
}
})
bitprophet.listenToTelegramChatId()
bitprophet.listenToChatId()
```

![Chat ID](https://github.com/andresilvasantos/bitprophet/raw/master/pres/chat_id.png)
Expand All @@ -51,15 +57,19 @@ bitprophet.options({
telegram: {
chatId: "YOUR_TELEGRAM_GROUP_ID",
token: "YOUR_TELEGRAM_BOT_TOKEN"
},
discord: {
chatId: "YOUR_DISCORD_CHANNEL_ID",
token: "YOUR_DISCORD_BOT_TOKEN"
}
})

bitprophet.start()
```

You should now see a message in Telegram telling you BitProphet has started.
You should now see a message in Telegram/Discord telling you BitProphet has started.

In Telegram type __list__ and you'll see all the available strategies listed with the respective ids.
In Telegram/Discord type __list__ and you'll see all the available strategies listed with the respective ids.
If a strategy listed has the [PT] prefix, it means it has Paper Trading active.
To start a strategy, just type __start strategy_id__. For example, __start buydip__.

Expand Down Expand Up @@ -97,7 +107,8 @@ module.exports = {
buyAmountMarket: 0.012,
profitTarget: 1.4,
maxTradingPairs: 8,
targetMarket: "BTC"
targetMarket: "BTC",
excludeTokens: ["NEO", "TRX"]
},
//...
}
Expand All @@ -106,20 +117,53 @@ module.exports = {

Create your strategies based on the examples.

#### Telegram BitProphet Cheat Sheet

* __status__ / __st__ - Check BitProphet's version and status
* __account__ / __total__ / __ttl__ - Total balance in BTC and USDT, plus BNB amount
* __btc__ - BTC value
* __profits__ / __%__ - Profits
* __profits +__ / __% +__ - Profits detailed
* __left__ / __l__ - Trades left
#### Chat Bots Commands

* __help__ | __h__ - Show all available commands
* __status__ | __st__ - Show version and status
* __account__ | __total__ | __ttl__ - Show total balance in BTC and USDT, plus BNB amount
* __profits__ | __%__ - Show profits
* __profits +__ | __% +__ - Show profits per pair
* __left__ | __l__ - Show trades left
* __sell token__ | __exit token__ - Sell token, if it's currently trading
* __sell token price__ | __exit token price__ - Sell token@price, if it's currently trading
* __cancel token__ - Cancel currently trading token
* __orders__ | __o__ - Show open orders
* __orders token__ | __o token__ - Show open orders for the given token
* __start strategyId__ - Start strategy
* __stop strategyId__ - Stop strategy
* __list__ - Show available strategies
* __list strategyId__ - Show valid / trading pairs for the given strategy
* __token__ | __tokenmarket__ - Show price for the specified token, BTC market default. (e.g. ada, adaeth)
* __pause__ - Pause system (ongoing trades won't be paused)
* __exit token__ / __sell token__ - Sells token, if it's currently trading
* __exit token price__ / __sell token price__ - Sells token@price, if it's currently trading
* __cancel token__ / __ignore token__ - Cancel currently trading token
* __start strategyId__ - Starts strategy
* __stop strategyId__ - Stops strategy
* __list__ - Lists all strategies
* __list strategyId__ - Lists all valid / trading pairs for the given strategy
* __restart__ - Kills the platform. Useful when using a keep alive process manager like [pm2](https://github.com/Unitech/pm2).
* __restart__ - Kill BitProphet's process. Useful when using a keep alive process manager like [pm2](https://github.com/Unitech/pm2).

![Profits Discord](https://github.com/andresilvasantos/bitprophet/raw/master/pres/chat_profits.png)

#### Adding Custom Commands
Add the following option naming a new directory for your commands.

```javascript
bitprophet.options({
commandsCustomDir: "./path/my/commands"
})
```

Create *index.js* inside that folder with the configuration for all your commands
```javascript
module.exports = {
commands: {
test: {
triggers: ["test", "t"]
description: "Just a test command"
},
//...
}
}
```

Create in the same directory *test.js* and code it based on the examples.

---

Thank you to all contributors: [supershwa](https://github.com/supershwa), [ionutgalita](https://github.com/ionutgalita)
10 changes: 5 additions & 5 deletions bitprophet.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,17 @@ module.exports = function() {
indicators: indicators,
options: function(opt) {
if(typeof opt.strategiesDir === "string") options.strategiesDir = opt.strategiesDir
if(typeof opt.commandsCustomDir === "string") options.commandsCustomDir = opt.commandsCustomDir
if(typeof opt.mainLoopTimer === "number") options.mainLoopTimer = opt.mainLoopTimer
if(typeof opt.pauseDangerBTC === "boolean") options.pauseDangerBTC = opt.pauseDangerBTC
if(typeof opt.verbose === "boolean") options.verbose = opt.verbose
options.binance = opt.binance
options.telegram = opt.telegram
options.telegram = opt.telegram || {}
options.discord = opt.discord || {}
vars.options = options
},
listenToTelegramChatId: function() {
listenToChatId: function() {
console.log("WTF")
chatBot.init(true)
},
start: function(next) {
Expand Down Expand Up @@ -281,9 +284,6 @@ module.exports = function() {

vars.pairs["BTCUSDT"].addWatcherChartUpdates(btcIntervalsWatch)

//TODO load previous active strategies
//TODO load previous trading pairs

chatBot.sendMessage(":traffic_light: BitProphet started: " + utils.formatDate(new Date(), true, true) + "\nTotal: " +
vars.startBTCAmount + "BTC | " + balance.usdtTotal.toFixed(2) + "$")

Expand Down
Loading

0 comments on commit 0fd445e

Please sign in to comment.