You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+85-80Lines changed: 85 additions & 80 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,58 +1,60 @@
1
-
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2
-
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
1
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3
3
**Table of Contents***generated with [DocToc](https://github.com/thlorenz/doctoc)*
4
-
5
-
-[kraken-grid BETA](#kraken-grid-beta)
6
-
-[Upgrading](#upgrading)
7
-
-[Installation](#installation)
8
-
-[Usage](#usage)
9
-
-[Web UI](#web-ui)
10
-
-[Orders table](#orders-table)
11
-
-[Allocation table](#allocation-table)
12
-
-[Assets table](#assets-table)
13
-
-[Pie Charts](#pie-charts)
14
-
-[Changing your password](#changing-your-password)
15
-
-[Mistyped passwords](#mistyped-passwords)
16
-
-[Command Line Interface](#command-line-interface)
17
-
-[Trading](#trading)
18
-
-[buy](#buy)
19
-
-[sell](#sell)
20
-
-[kill](#kill)
21
-
-[limits](#limits)
22
-
-[less](#less)
23
-
-[more](#more)
24
-
-[delev](#delev)
25
-
-[addlev](#addlev)
26
-
-[Information Gathering](#information-gathering)
27
-
-[assets](#assets)
28
-
-[list [Search]](#list-search)
29
-
-[margin](#margin)
30
-
-[report](#report)
31
-
-[show](#show)
32
-
-[verbose](#verbose)
33
-
-[web](#web)
34
-
-[Bot Management](#bot-management)
35
-
-[adjust](#adjust)
36
-
-[allocate](#allocate)
37
-
-[allocation](#allocation)
38
-
-[asset](#asset)
39
-
-[balance](#balance)
40
-
-[set](#set)
41
-
-[quit](#quit)
42
-
-[risky](#risky)
43
-
-[reset](#reset)
44
-
-[auto](#auto)
45
-
-[manual](#manual)
46
-
-[refnum](#refnum)
47
-
-[safe](#safe)
48
-
-[Experimental features (Not Recommended and not well tested)](#experimental-features-not-recommended-and-not-well-tested)
49
-
-[ws - EXPERIMENTAL](#ws---experimental)
50
-
-[Internals](#internals)
51
-
-[Userref](#userref)
52
-
-[Partial Execution](#partial-execution)
53
-
-[HELP!](#help)
54
-
55
-
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
4
+
5
+
-[kraken-grid BETA](#kraken-grid-beta)
6
+
-[Upgrading](#upgrading)
7
+
-[Installation](#installation)
8
+
-[Usage](#usage)
9
+
-[How the author (Dave) does it for himself and others:](#how-the-author-dave-does-it-for-himself-and-others)
10
+
-[Discussion of the `adjust` command.](#discussion-of-the-adjust-command)
11
+
-[Web UI](#web-ui)
12
+
-[Orders table](#orders-table)
13
+
-[Allocation table](#allocation-table)
14
+
-[Assets table](#assets-table)
15
+
-[Pie Charts](#pie-charts)
16
+
-[Changing your password](#changing-your-password)
17
+
-[Mistyped passwords](#mistyped-passwords)
18
+
-[Command Line Interface](#command-line-interface)
19
+
-[Trading](#trading)
20
+
-[addlev](#addlev)
21
+
-[delev](#delev)
22
+
-[buy](#buy)
23
+
-[sell](#sell)
24
+
-[kill](#kill)
25
+
-[limits](#limits)
26
+
-[less](#less)
27
+
-[more](#more)
28
+
-[Information Gathering](#information-gathering)
29
+
-[assets](#assets)
30
+
-[list [Search]](#list-search)
31
+
-[margin](#margin)
32
+
-[report](#report)
33
+
-[show](#show)
34
+
-[verbose](#verbose)
35
+
-[web](#web)
36
+
-[Bot Management](#bot-management)
37
+
-[adjust](#adjust)
38
+
-[allocate](#allocate)
39
+
-[allocation](#allocation)
40
+
-[asset](#asset)
41
+
-[auto](#auto)
42
+
-[manual](#manual)
43
+
-[balance](#balance)
44
+
-[quit](#quit)
45
+
-[risky](#risky)
46
+
-[refnum](#refnum)
47
+
-[reset](#reset)
48
+
-[safe](#safe)
49
+
-[set](#set)
50
+
-[Experimental features (Not Recommended and not well tested)](#experimental-features-not-recommended-and-not-well-tested)
51
+
-[ws - EXPERIMENTAL](#ws---experimental)
52
+
-[Internals](#internals)
53
+
-[Userref](#userref)
54
+
-[Partial Execution](#partial-execution)
55
+
-[HELP!](#help)
56
+
57
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
56
58
57
59
# kraken-grid BETA
58
60
A bot that extends grid trading once you use it to create a grid using orders with conditional closes.
@@ -102,8 +104,8 @@ If you have 9 cryptos you're balancing (plus cash), your numbers are 10 and 10/9
102
104
`web [on|off] P` This turns the web User Interface on or off, providing the URL. P is the port number, which will default to 8000.
103
105
104
106
This readme is displayed in the web User Interface. It contains `code that looks like this` which you can click to send commands to the bot. If you just tried it, check the console and you will see that it's asking you to "Try code raw"...
105
-
*Answering with anything that starts with a y will send it to kraken which will reject it. The error also causes the bot to abandon [auto](#auto) mode if it was in auto mode.
106
-
*All other answers will cause process.TESTING to be set to the first word of the command ("code" in this case) and also turn on caching, which saves Kraken's responses in cleartext on your machine. To prevent that, send the bot `notest`and answer no to trying it raw. This will set process.TESTING back to false.
107
+
*This is how you can mess around with the bot, which requires coding expertiese, so you should examine the code to see what values you can use and what effect they will have. Just search the code for "TESTING".
108
+
*If you choose to set processTESTING, the bot will also ask if you want to use caching. This causes it to perform much faster by reading from a file instead asking the API to get an answer through the Internet. If there is no answer yet, it will use the API to get one and store it. Requests are indexed by a hash of the result of calling stringify() on the name of the function and the arguments.
107
109
108
110
Three tables and two pie charts are displayed in the web page. Some of the cells in the tables have blue entries because you can click them:
109
111
#### Orders table
@@ -136,6 +138,14 @@ At the prompt that kraken-grid presents (>), you can enter one of these commands
136
138
137
139
138
140
### Trading
141
+
#### addlev
142
+
`addlev Counter`
143
+
The semantics are the same as for [delev](#delev).
144
+
145
+
#### delev
146
+
`delev Counter`
147
+
C _must be_ a `Counter` as shown by executing [list](#list). If the identified order uses leverage, this command will first create an order without any leverage to replace it, and then kill the one identified. The order that was killed will still be in the list, prefixed with `Killed:`*NOTE: The new order often (or always?) appears at the top of `list` after this, so the `Counter`s identifying other orders may change.*
148
+
139
149
#### buy
140
150
`buy Ticker Price Amount ClosePrice`
141
151
If closePrice is not a number but evaluates to true, the code will create this buy with a conditional close at the last price it saw. If it is 1, that might be because you want it to evaluate to true and close at the current price, or because you want to close at 1. The bot plays it safe and closes at the current price. To change that, you can use the [risky](#risky) command (see below). If you don't want the code to place a trade with a conditional close, leave closePrice off or pass `false` for it.
@@ -161,14 +171,6 @@ Example: You have a limit sell order at 45000 for 0.015 BTC and another above th
161
171
`more Counter Amount All`
162
172
Increase the amount of crypto to be traded. Otherwise, this command is the same as less.
163
173
164
-
#### delev
165
-
`delev Counter`
166
-
C _must be_ a `Counter` as shown by executing [list](#list). If the identified order uses leverage, this command will first create an order without any leverage to replace it, and then kill the one identified. The order that was killed will still be in the list, prefixed with `Killed:`*NOTE: The new order often (or always?) appears at the top of `list` after this, so the `Counter`s identifying other orders may change.*
167
-
168
-
#### addlev
169
-
`addlev Counter`
170
-
The semantics are the same as for [delev](#delev).
171
-
172
174
### Information Gathering
173
175
#### assets
174
176
`assets [Filter]`
@@ -251,15 +253,19 @@ To `REMOVE` an entire account, issue `asset REMOVE ACCOUNT [Label]`
251
253
*`Label` is for Label. (optional) This string will be used as an account label. If there is no such account, the bot will create one. If that was a mistake, you can use the REMOVE ACCOUNT feature described above. If you hold cryptos in two different wallets, W1 and W2, you can tell the bot how much is in each one using the two different labels and it will keep separate records for them. The "default" account will be used if `Label` is missing (its label is "default").
252
254
*`Ask` is for Ask. (optional) It must be the string 'false' if it is present because it prevents the bot from asking before overwriting existing data. This is handy if you make your own list of assets and would like to copy/paste it to the bot.
253
255
256
+
#### auto
257
+
`auto [N]`
258
+
This automatically and repeatedly executes the second step of `report` and then waits N seconds. N defaults to 60 but when you call auto with a new value for it, it is updated.
259
+
260
+
#### manual
261
+
This stops the automatic calling of `report`. The bot will do nothing until you give it a new command.
262
+
254
263
#### balance
255
264
`balance Tolerance Ticker`
256
265
Tolerance is the tolerable difference between your desired allocation and your current allocation. If you don't specify Ticker, the bot will identify the most out-of balance asset and propose a trade to balance it. If Ticker is present, it will create a trade to balance that ticker along with a limit buy and a limit sell at prices TOL percent (this is a number between 0.00 and 100.00) above and below the current price. These trades will then be used by the bot (in [auto](#auto) mode) to keep your savings in balance.
257
266
258
-
#### set
259
-
`set [UserRef BuyOrSell Price]`
260
-
This lists the [userref](#userref)s and prices at which buys and sells have been (and will be) placed.
261
-
UserRef _must be_ a userref, BuyOrSell _must be_ either `buy` or `sell`, and P is the price you want to add (or replace) for that grid point. If the bot fails to determine either the buy price or the sell price, it displays a ?, and this will prevent the creation of a new order as described under [refnum](#refnum). This command allows you to fix that so that Step 2.1 under [report](#report) will work properly as described under `refnum`.
262
-
_Collecting profit data:_ If you issue `set ~ [N]` the bot will go through the grid points it knows about from open orders and query the exchange for any userrefs it finds in order to collect all the buys and sells that happened for those two prices. Because the API rate is limited, it will make up to N requests to the exchange, one every 2 seconds until it has exhausted the known userrefs. It remembers the results but will lose them when you terminate the program or run [reset](#reset).
267
+
#### notest
268
+
`notest` sets process.TESTING to false. This is useful in case you want to stop testing.
263
269
264
270
#### quit
265
271
`quit` terminates the program.
@@ -270,25 +276,24 @@ _Collecting profit data:_ If you issue `set ~ [N]` the bot will go through the g
270
276
* Any API call which fails because of "Internal Error", in which case it reports the error and proceeds.
271
277
* Using `1` as the close price (final argument) to `buy` or `sell` to mean "Close at the current price", rather than `true`, which is the safe way to ensure the current price is used as the close price.
272
278
273
-
#### reset
274
-
`reset`
275
-
This erases the list of [userref](#userref)s and prices at which buys and sells will be placed, but that list gets immediately rebuilt because it performs the second step in [report](#report).
276
-
277
-
#### auto
278
-
`auto [N]`
279
-
This automatically and repeatedly executes the second step of `report` and then waits N seconds. N defaults to 60 but when you call auto with a new value for it, it is updated.
280
-
281
-
#### manual
282
-
This stops the automatic calling of `report`. The bot will do nothing until you give it a new command.
283
-
284
279
#### refnum
285
280
`refnum Counter UserReference`
286
281
Counter _must be_ a `Counter` as shown by executing [list](#list), and it must be an order that was entered without a [userref](#Userref). It will cancel the existing order and create a new one with the specified userref `UserReference`. All orders added by the bot (automatically and manually) have a userref. This function is to allow you to enter an order on Kraken's website using the same price and no conditional close so that the bot will include it into the existing grid point with the same userref (use [set](#set) to make sure both the buy and sell prices are known for the userref) as UserReference. If you use `refnum` to assign the reference number of an order that is at a different price, the behavior is undefined.
287
282
283
+
#### reset
284
+
`reset`
285
+
This erases the list of [userref](#userref)s and prices at which buys and sells will be placed, but that list gets immediately rebuilt because it performs the second step in [report](#report).
286
+
288
287
#### safe
289
288
`safe`
290
289
When the bot starts, it is in "safe" mode, which means that it will not __actually__ add or cancel any orders. The idea is that it won't do anything, but instead just show you what it would do if __safe__ were off. Your have to enter `safe` to turn this off so that the bot will actually do things. It allows for startup with a lot less risk with a possibly buggy bot.
291
290
291
+
#### set
292
+
`set [UserRef BuyOrSell Price]`
293
+
This lists the [userref](#userref)s and prices at which buys and sells have been (and will be) placed.
294
+
UserRef _must be_ a userref, BuyOrSell _must be_ either `buy` or `sell`, and P is the price you want to add (or replace) for that grid point. If the bot fails to determine either the buy price or the sell price, it displays a ?, and this will prevent the creation of a new order as described under [refnum](#refnum). This command allows you to fix that so that Step 2.1 under [report](#report) will work properly as described under `refnum`.
295
+
_Collecting profit data:_ If you issue `set ~ [N]` the bot will go through the grid points it knows about from open orders and query the exchange for any userrefs it finds in order to collect all the buys and sells that happened for those two prices. Because the API rate is limited, it will make up to N requests to the exchange, one every 2 seconds until it has exhausted the known userrefs. It remembers the results but will lose them when you terminate the program or run [reset](#reset).
296
+
292
297
### Experimental features (Not Recommended and not well tested)
0 commit comments