Skip to content

Commit ede0dbf

Browse files
committed
initial commit
1 parent 8461c0f commit ede0dbf

File tree

15 files changed

+5952
-2
lines changed

15 files changed

+5952
-2
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/*
2+
tmp/*
3+
seed.js

.eslintrc

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"env": {
3+
"node": true,
4+
"es6": true,
5+
"mocha": true
6+
},
7+
8+
"ecmaFeatures": {
9+
"generators": true,
10+
"blockBindings": true,
11+
"templateStrings": true,
12+
"arrowFunctions": true,
13+
"forOf": true,
14+
},
15+
16+
"rules": {
17+
"comma-dangle": 2,
18+
"no-underscore-dangle": 0,
19+
"no-else-return": 2,
20+
"no-self-compare": 2,
21+
"no-throw-literal": 2,
22+
"wrap-iife": [2, "outside"],
23+
"no-catch-shadow": 2,
24+
"indent": [2, "tab"],
25+
"consistent-this": [2, "self"],
26+
"func-names": 2,
27+
"no-inline-comments": 2,
28+
"max-nested-callbacks": [2, 3],
29+
"new-cap": 2,
30+
"new-parens": 2,
31+
"no-array-constructor": 2,
32+
"no-multiple-empty-lines": 2,
33+
"no-nested-ternary": 2,
34+
"one-var": [2, "never"],
35+
"operator-assignment": [2, "always"],
36+
"quotes": [2, "double", "avoid-escape"],
37+
"semi": [2, "always"],
38+
"spaced-comment": [1, "always"],
39+
"keyword-spacing": 2,
40+
"space-infix-ops": 2,
41+
"space-in-parens": [2, "never"],
42+
"space-before-function-paren": [2, "never"],
43+
"space-before-blocks": [2, "always"],
44+
"no-var": 2,
45+
"prefer-const": 1,
46+
"prefer-template": 1,
47+
"require-yield": 1,
48+
"arrow-spacing": 2,
49+
"generator-star-spacing": [2, "after"],
50+
"no-confusing-arrow": 2,
51+
"no-const-assign": 2,
52+
}
53+
}

.gitignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Logs
2+
logs
3+
*.log
4+
5+
# Runtime data
6+
pids
7+
*.pid
8+
*.seed
9+
10+
# Directory for instrumented libs generated by jscoverage/JSCover
11+
lib-cov
12+
13+
# Coverage directory used by tools like istanbul
14+
coverage
15+
16+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17+
.grunt
18+
19+
# node-waf configuration
20+
.lock-wscript
21+
22+
# Compiled binary addons (http://nodejs.org/api/addons.html)
23+
build/Release
24+
25+
# Dependency directory
26+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
27+
node_modules
28+
29+
# For secrets
30+
config.json
31+
config.production.json
32+
config.edge.json
33+
34+
# For deploying
35+
tmp
36+
results

README.md

100644100755
Lines changed: 194 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,194 @@
1-
# coin-signals-trader
2-
A automatic trading bot for cryptocurrencies
1+
# :money_with_wings: Coin Signals Trader
2+
The Coin Signals trader is meant to allow anyone to quickly and easily set up an automated trading bot. This bot relies on __Signals__ which are supplied via Slack in the __Universal Signal Format__. This project doesn't generate it's own signals, it only acts on ones that it receives.
3+
4+
## Donate
5+
This is a free project, so if you're like to thank me for my work, I'd really appreciate that.
6+
7+
BTC - __1E6Vyh84pTEP9v6Sh8Yzm693pBZLvguX3m__
8+
ETH - __0xb2921b476838c8DB9a29d708B3cA8c11959D7c7D__
9+
LTC - __LfkD8jcgv4E2rDta4hA2CUHNMiPGdZL1yr__
10+
11+
## Prerequisites
12+
* [Node.js](https://nodejs.org/en/) (Version 6 and up recommended)
13+
* [Bittrex API Key](https://bittrex.com/Manage#sectionApi)
14+
* [Slack](https://slack.com)
15+
16+
### Installation
17+
18+
* Clone down the repository.
19+
```
20+
git clone https://github.com/snollygolly/coin-signals-trader.git
21+
```
22+
23+
* Install packages (from inside the coin-signals-trader folder).
24+
```
25+
npm install
26+
```
27+
28+
* Create your config. There's a `config.json.example` file in the root. Edit it to include all your values. Refer to the configuration breakdown for more information about what does what. Save it as `config.json` and leave it in the root.
29+
30+
* Run the bot!
31+
```
32+
npm start
33+
```
34+
35+
* Private message the bot in slack to get started
36+
37+
## Universal Signal Format
38+
Signals are sent via Slack and are expected to be in the correct format:
39+
40+
ACTION*PAIR*QUANTITY*PRICE*META
41+
42+
- Action _(Required)_
43+
This is the action you want the trader to take
44+
- BUY
45+
- SELL
46+
47+
- Pair _(Required)_
48+
This is pair you want to trade _(like BTC-LTC)_
49+
50+
- Quantity
51+
This is how many coins you want to affect in this signal. If you'd like the trader bot to use it's defaults, you can pass "A"
52+
53+
- Price
54+
This is the per coin price you want to use for this signal. If you'd like the trader bot to use it's default, you can pass "A"
55+
56+
- Meta
57+
If you'd like to attach addition information to your signal, you may do it here. The symbol * may not be used in meta information though.
58+
59+
### Example
60+
61+
```
62+
BUY*BTC-LTC*1*0.01*0001
63+
```
64+
65+
This signal would buy 1 Litecoin (BTC-LTC) for 0.01 BTC. It would also includes some meta information (0001).
66+
67+
```
68+
SELL*BTC-LTC*A*A*0002
69+
```
70+
71+
This signal would sell the default amount of Litecoins at the default price. It also includes meta information (0002)
72+
73+
### Folder Structure (some files omitted)
74+
75+
```
76+
|-- coin-signals
77+
|-- config
78+
(contains all the settings for customizing the bot's behavior)
79+
|-- services
80+
|-- config.json
81+
(contains all configuration values, more on that later, it must be created)
82+
|-- seed.js
83+
(creates all the needed files [will overwrite your portfolio])
84+
|-- index.js
85+
(this is what you run to actually start auto-trading)
86+
```
87+
88+
### Configuration breakdown
89+
90+
The configuration file for the `bot` project is fairly simple and consists mainly of settings for Slack and Bittrex:
91+
92+
```
93+
{
94+
"name": "Coin Signals Trader",
95+
"bittrex": {
96+
"api_key": "XXX",
97+
"api_secret": "XXX"
98+
},
99+
"slack": {
100+
"url": "XXX",
101+
[the webhook url]
102+
"name": "Coin Trader",
103+
[the name of the bot]
104+
"secret": "XXX",
105+
[from your slack app]
106+
"channel": "signals",
107+
[what channel in slack to join]
108+
"bot": "XXX",
109+
[the id of the bot who's signals you are consuming]
110+
"admin": "XXX"
111+
[the id of the user who can execute commands]
112+
},
113+
"trading": {
114+
"api_key": "XXX",
115+
[your bittrex key for trading]
116+
"api_secret": "XXX"
117+
[your bittrex secret for trading]
118+
}
119+
}
120+
```
121+
122+
### Trading configuration
123+
124+
This configuration lives in `config/trading.js`
125+
126+
```
127+
live: false,
128+
[real money or not]
129+
balance: 0.125,
130+
fee: 0.0025,
131+
[how much is the fee each way]
132+
limits: {
133+
fresh: {
134+
loss: 0.08,
135+
[what amount of loss you will accept at this stage]
136+
profit: 0.05,
137+
[what amount of profit you will target at this stage]
138+
time: 1800000
139+
[how much time (in ms) needs to elapse before this position isn considered fresh]
140+
},
141+
stale: {
142+
loss: 0.06,
143+
[what amount of loss you will accept at this stage]
144+
profit: 0.03,
145+
[what amount of profit you will target at this stage]
146+
time: 3600000
147+
[how much time (in ms) needs to elapse before this position is considered stale]
148+
},
149+
old: {
150+
loss: 0.05,
151+
[what amount of loss you will accept at this stage]
152+
profit: 0.02,
153+
[what amount of profit you will target at this stage]
154+
time: 7200000
155+
[how much time (in ms) needs to elapse before this position is considered old]
156+
}
157+
},
158+
order_parsing: false,
159+
[do we want orderbook parsing enabled or not]
160+
orders: {
161+
spread_ask: 0.01,
162+
[what percentage should the "ask" spread be below for a sell signal to be generated]
163+
spread_ask_insta: 0.001,
164+
[what percentage should the "ask" spread be below to instantly sell]
165+
spread_avg: 0.015,
166+
[what percentage should the "avg" spread be above for a sell signal to be generated]
167+
spread_avg_insta: 0.03
168+
[what percentage should the "avg" spread be above to instantly sell]
169+
},
170+
profit_increase: 0.001,
171+
[when we attempt to lock in profit, how much should our target be above the current price (in percentage)]
172+
profit_slip: 0.001,
173+
[when we attempt to lock in profit, how much should our target be below the current price (in percentage)]
174+
profit_increase_override: 0.01,
175+
[when the profit increases this percent or may over a single tick, sell regardless]
176+
initial_sell_delay: 300000,
177+
[prevents sells if they happen before this many ms has passed]
178+
spread_to_sell: 0.00000001,
179+
[what spread amount (in BTC) to auto sell at]
180+
min_balance: 0.00001,
181+
[minimum balance]
182+
max_position_price: 0.0115,
183+
[maximum price per position]
184+
max_points: 95,
185+
[this many points gets the max position price, lower signals get less of the max position price]
186+
max_positions: 10,
187+
[maximum positions at a time]
188+
max_volitility: -0.02,
189+
[how much volitility to accept from USD/BTC before trading halts]
190+
volitility_timeout: 45 * 60 * 1000,
191+
[how long to halt trading for]
192+
toxic_asset_backoff: 180000
193+
[how long (in ms) to blacklist losing assets for (per point lost)]
194+
```

config.example.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "Coin Signals Trader",
3+
"bittrex": {
4+
"api_key": "XXX",
5+
"api_secret": "XXX"
6+
},
7+
"slack": {
8+
"url": "XXX",
9+
"name": "Coin Trader",
10+
"secret": "XXX",
11+
"channel": "signals",
12+
"bot": "XXX",
13+
"admin": "XXX"
14+
},
15+
"trading": {
16+
"api_key": "XXX",
17+
"api_secret": "XXX"
18+
}
19+
}

config/trading.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
module.exports.config = {
2+
live: false,
3+
balance: 0.25,
4+
fee: 0.0025,
5+
limits: {
6+
fresh: {
7+
loss: 0.07,
8+
profit: 0.04,
9+
time: 1800000
10+
},
11+
stale: {
12+
loss: 0.06,
13+
profit: 0.03,
14+
time: 3600000
15+
},
16+
old: {
17+
loss: 0.05,
18+
profit: 0.02,
19+
time: 7200000
20+
}
21+
},
22+
order_parsing: true,
23+
orders: {
24+
spread_ask: 0.01,
25+
spread_ask_insta: 0.001,
26+
spread_avg: 0.015,
27+
spread_avg_insta: 0.03
28+
},
29+
profit_increase: 0.005,
30+
profit_slip: 0.005,
31+
profit_increase_override: 0.05,
32+
initial_sell_delay: 600000,
33+
spread_to_sell: 0.00000001,
34+
min_balance: 0.00001,
35+
max_position_price: 0.022,
36+
max_points: 95,
37+
max_positions: 10,
38+
max_volitility: 0.0075,
39+
volitility_timeout: 45 * 60 * 1000,
40+
toxic_asset_backoff: 100000
41+
};

0 commit comments

Comments
 (0)