Username: Password:

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - cw

Pages: [1]
1
Kraken launched a new coin - EOS and there surely will be a lot of profitable trading that I want to get on top of ASAP.  Read more on their blog post.

Launching kraken with "./gunthy-linuxx64 BTC_EOS kraken" just like my other kraken pairs but I get

Code: [Select]
2017/07/01 15:12:45 Error: Kraken API returned error: Query:Unknown asset pair.
Generally I have all the Kraken bots using ALLPAIRS and nothing in the per-pair... just a blank file.

So I tried different Kraken_asset_pair values in the kraken-BTC_EOS-config.js based on what Kraken publishes in their Asset Pairs Documentation.

Code: [Select]
   KRAKEN_ASSET_PAIR:'XXBTEOS'
   KRAKEN_ASSET_PAIR:'XXBTXEOS'
   KRAKEN_ASSET_PAIR:'EOSXBT'

Does gunbot itself need to be updated to support this?  Or is it possible that Kraken's API just isn't updated?






2
I read the Post about Re: Error Insuficient ZEUR funds on kraken and the Other post about "Re: EUR_BTC" but those posts are buying bitcoin with euro.

One of the users on telegram chat was asking about buying euro with bitcoin (going the other way) so I thought I'd try it.  I set up my config file and gunbot happily started running just fine.  It ran for a day or so, but when it came time to buy, when the buy order happened, the API returned "insufficient funds".

Here's the log from the file...

Code: [Select]
2017/05/24 18:15:34  [ --2017/05/24 18:15:34--kraken--BTC_EUR  --  Gunbot v3.2 cycle #134 --------------- ]
2017/05/24 18:15:34  ::::: collecting market data...
2017/05/24 18:15:38  LP 2094.88  Bal.XXBT 0.072567835  Bal.ZEUR 0
2017/05/24 18:15:38  Open orders
2017/05/24 18:15:38  boughtPrice undefined
2017/05/24 18:15:38  price  falls (-7)
2017/05/24 18:15:38  PriceToBuy,21008872.3234,priceToSell,--not set--
2017/05/24 18:15:38  LP 20948800.0000000,<=,prBuy 21008872.0000000  secMargin 210.0887232342344  grows yes
2017/05/24 18:15:38  no altcoins: 0
2017/05/24 18:15:38  price to buy: 2100.887232342344
2017/05/24 18:15:38  price is sweet to buy
2017/05/24 18:15:38  price is growing
2017/05/24 18:15:38  Buying on kraken 0.000523867715573207 of ZEUR for 2094.88
2017/05/24 18:15:38  ***************************************************
2017/05/24 18:15:38  [object Object]
2017/05/24 18:15:38  ***************************************************
2017/05/24 18:15:41  2017/05/24 18:15:41 Error: Kraken API returned error: Order:Insufficient funds
2017/05/24 18:15:41  !!! Cycle 135 failed. Will repeat in 92.38413441348112s
2017/05/24 18:17:13  [ --2017/05/24 18:17:13--kraken--BTC_EUR  --  Gunbot v3.2 cycle #135 --------------- ]


and here's the log from the console...

Code: [Select]
[ --2017/05/24 18:15:34--kraken--BTC_EUR  --  Gunbot v3.2 cycle #134 --------------- ]
::::: collecting market data...
++++
LP 2094.88  Bal.XXBT 0.072567835  Bal.ZEUR 0
Open orders
boughtPrice undefined
price  falls (-7)
PriceToBuy 21008872.3234 priceToSell --not set--
LP 20948800.0000000 <= prBuy 21008872.0000000  secMargin 210.0887232342344  grows yes
no altcoins: 0
price to buy: 2100.887232342344
price is sweet to buy
price is growing
Buying on kraken 0.000523867715573207 of ZEUR for 2094.88
***************************************************
{ pair: 'XXBTZEUR',
  type: 'buy',
  ordertype: 'limit',
  volume: 0.000523867715573207,
  price: 2094.88 }
***************************************************
2017/05/24 18:15:41 Error: Kraken API returned error: Order:Insufficient funds
!!! Cycle 135 failed. Will repeat in 92.38413441348112s
[ --2017/05/24 18:17:13--kraken--BTC_EUR  --  Gunbot v3.2 cycle #135 --------------- ]

I have bitcoin balance, as shown in the log... so I'm not certain why it's complaining.  I'm trying to buy Euro.

Did I do the asset pair wrong?  Or is this just not supported, and this asset pair only will ever go the primary way which is buying bitcoin with euro, and not buying euro with bitcoin?

If it matters, here's the relevant config and how it's launched
Code: [Select]
   DEFAULT_MARKET_NAME:"kraken",
   DEFAULT_CURRENCY_PAIR:"BTC_EUR",   //  single pair format for all markets !
   BTC_TRADING_LIMIT: 0.05,// max amount of BTC balance to use for each pair
   KRAKEN_ASSET_PAIR:'XXBTXEUR',

./gunthy-linuxx64 BTC_EUR kraken

Seems that it should still work, and treat EUR like any other "coin" to buy and sell.  I figured it would buy 0.05 bitcoin worth of Euro.

3
General Discussion / Humble suggestion for allpairs
« on: May 17, 2017, 07:11:01 PM »
From Another post...
Quote
I suggest it always use the AllPairs as the override regardless of which is saved last. 

I can't highlight or agree with this enough.  Please change it so that the use of a "default" configuration file and an "override" file uses the same standard as every other system everywhere else - unix, windows, applications, etc.

The concept of "configuration file precedence" is a global one and I propose we try to adhere to it if at all possible.

1. System local directory -- highest priority
2. App local directories
3. App default directories
4. System default directory -- lowest priority

Example: Unix operating systems have /etc directory and programs will have settings stored there.  They will first load settings, if they exist from /etc/settings.conf.  Then, if there are settings in ~/settings.conf, they will, one-by-one, look for settings. If there are settings in the local user's setting.conf, then the settings there will override the /etc/settings.conf.

Example: applications will have config files with stanzas.  A locally defined file with settings would have highest priority and a higher level file with stanzas with defaults would have lowest priority.

Therefore, in gunbot's world, the ALLPAIRS file would be the lowest priority.  Users would put anything they want all pairs to use by default:

  • API Keys
  • Default BOT timings
  • Startup options
  • Debug options
  • Email settings
  • Any buying / selling strategies that are considered "default"

Then, in the per-pair settings files, you would only put non-default items or items that would OVERRIDE the items in the default allpairs file.

  • THIS PAIR's strategy
  • [could be, nothing else is needed to change]

This is useful is you wanted 20 pairs all using BB buy and GAIN sell with normal BOT timings.  Then if you wanted 3 pairs to use PING PONG, you would just edit the strategy of the config file of just those pairs.  You wouldn't need the strategies to be set in the other pairs.

However, the current problem is that because gunbot looks at the access time of which file was most recently modified, if you go and change the ALLPAIRS file to adjust BOT timings, for example... because polo is lagging, then all of a sudden the 3 pairs using PING PONG will now switch strategies.  We don't want that.

So the suggestion is to have gunbot ignore the last access time of config files, and only use this logic:
  • gunthy first reads allpairs file for settings
  • then reads per-pair settings, which overrides any settings collected from allpairs

4
Technical Support & Development / Feature request: stepstepstepgain
« on: May 11, 2017, 03:42:45 AM »
I like step gain a lot.  Here's what I think I've seen step gain do:

  • Step gain buys a coin at desired level.
  • Step gain sees coin reach price at level "2"
  • Step gain starts marking >= prSell
  • Step gain sees coin reach price at level "3"
  • It keeps marking >= prSell and says "falls no"
  • It will never sell the coin until "falls yes". 

There are cases where my configuration is level 2 is 2.5% and level 3 is 6%.  Coin will hit 2.5%, then 5%, then 6% then 10%, then 20%, then 25% and sit there for 30minutes.  Then go to 20%, 15%, 12%, 7%, then polo has a ton of errors, then hit 4.5% and then barely be able to get in a sell order and maybe get any profit at all.  Or errors keep happening and I miss any profits.

I'd rather be able to configure several levels of steps.

Give us lots of steps.  And a Number of "backsteps" that if we ratchet back the number of backsteps, gunbot sells. 

Just allow us two digits after the word "step".  If we don't define it, then you don't use it. If we do define it, use it.  That way, we can be as crazy or as lazy as we want.

Code: [Select]
# step step step gain
# buy levels
stepbuy01 = 0.5
stepbuy02 = 1.5
# and so on, maybe just 2, maybe 10
# sell levels
stepsell01 = 1.5
stepsell02 = 2.5
stepsell03 = 5.0
stepsell04 = 7.5
stepsell05 = 10
stepsell06 = 12.5
stepsell07 = 15
stepsell08 = 18
stepsell09 = 22.5
stepsell10 = 26
stepsell11 = 30
stepsell12 = 35
stepsell13 = 40
stepsell14 = 45
stepsell15 = 50
stepsell16 = 55
stepsell17 = 70
stepsell18 = 100
stepsell19 = 150
stepsell20 = 200
#backsteps - how many steps back to sell?
backsteps=2

That way, people can be aggressive or safe.  Someone might not want this kind of config and just have two or three steps - stepsell01=5 and stepsell02=50 or something like that.

In this way, people can decide at what point is it worth paying the fee and re-buying in... and they can have one config that both fits straight-line coins as well as suspected pumps without having to change configurations during the day.

With this kind of config, if the coin starts to fall a little, we can lock in the profit THEN instead of risking losing the profits.

5
Beginners & Help / Cryptowally's gunbot linux console, Part I
« on: May 10, 2017, 10:11:02 PM »
Several people have asked in the telegram chat for the steps of the "gunbot console" I made so I can monitor multiple pairs on one screen at once.  What this does is let me see the most important recent information of 16 pairs on one screen.  I have dual-screens, so I can see 32 pairs on the two screens.  All at once - for example, I can see if an instance needs to be restarted.  Or I can see if polo is giving me errors across all of them at once (the dreaded 429 errors).  Or I can see if one of the pairs is getting the "polo is being bad and giving us wrong alt coin balance!!!!!!!!" and I need to restart the bot. 

All these things help me manage multiple pairs with less effort and with a keen eye.

This is what it looks like on one screen:


And for another one with just 6 pairs, it would look like this (for example, ETH only has a few available coin pairs):  You might have another 16 pairs on the second screen, or yet another 16 pairs behind that, or whatever.


This is draft #1 - I was able to make this setup work for me in a few minutes, because I've used screen, tee and multitail in a former life and it's second nature.  However, it's not necessarily easy to explain to others who are new to it.

I'm working on a draft #2 for an improved console, but it will take a lot longer.  Since draft #1 works and suits its purpose and only took a few minutes, I might not hurry too much for draft #2 :)

I've color coded the text in the console like so:
RED TEXT: Error codes like status 422, 500, 520, 420
Yellow Text: Bags.  There's a "has order: " line in the output.  That means there's a bag.
Purple Text: There's an active BUY order still at polo
Cyan Text: There's an active SELL order still at polo
Red/Yellow Text: Order information (buy or sell order placed), profit calculated.
Red/White text: The price is about to buy or about to sell.  Might want to watch because something's happening.
Green Text: supergun true and falls no
RED TEXT: supergun false and falls yes

For example, if Gunbot is thinking about buying or thinking about selling, you'll see the ">= prSell" or "<= prBuy" turn red with white background so it will catch your attention.


The whole point is that I can watch the screen at 16 different pairs and only look for major things - bags, balance, purchases, market swings, buys, sells, etc.   And then I can launch another 16 pairs and another 16 pairs, etc.

The general setup is:
  • `screen` is a program that lets you have multiple terminals and gunbot will run while you're logged out.
  • Each gunbot instance runs in a different screen terminal
  • Each gunbot instance pipes output to `tee`
  • `tee` is a program that sends output to console AND puts output into a file
  • `multitail` is a neat program that will tail a file and put it into a self-contained window and do things with it
  • There are tons of command line options you need for multitail to make it pretty
  • I wrote a multitail.conf that strips out the extra stuff we don't need
  • For my purposes, I wrote a bash script for each group of up to 16 pairs of gunbot instances

Also, I have no idea if this will work for anyone else - it works for me, so that's all I know.  So, some caveats:
  • This is working for me.  I make no warranty for anyone else.
  • This is based on v2.0.3b - probably should work with other versions
  • This is using stepgain output - probably should work with other versions
  • I'm using Ubuntu LTS 14.04 - probably should work with other versions
  • Not expected to work with Windows in any way

In my environment, I create a new directory for each gunbot instance, and I name the directory with a naming convention using the pair name with a dash.  For example, "btc-maid" or "eth-gnt".  This is important in order for the rest of this to work smoothly!

------------------------------
GNU SCREEN:
------------------------------

As I mentioned above, I use GNU screen to manage multiple gunbot instances.  Google how to install screen for your OS.  It's pretty easy using the package manager of your choice.  There are some good tutorials about screen here, here and here.

I typically will group no more than 16 instances in a single screen session.  For one, I have a pretty big monitor and fitting more than 16 together gets to be a little crowded.  I probably could fit 20 and maybe 24 but I'm not running that many pairs yet.  Maybe when I do, I'll try it.  You're free to try.  When things are working, each cycle only really needs 4-5 lines of output so you could easily increase the number of output in multitail or use a smaller font.  It's doable.

Put this in a file called ~/.screenrc - modify at your leisure or find some other tidbits online.  For example, vim ~/.screenrc or use nano or your favorite text editor.

This is the .screenrc I use:

Code: [Select]
defscrollback 9999
startup_message off
shell -$SHELL

hardstatus string '%{= kG}%{C}Screen: %{c}%{= kG}[%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{C} %d-%m %{W}%c %{g}]'

caption always "%{= kw}%-w%{= BW}%n %t%{-}%+w %-= %c"
vbell off

termcapinfo xterm* 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'

Now you can start screen.  Just type in

Code: [Select]
# screen

and you should have a blank window with a "0 bash" at the bottom


now you have one bash shell running and it's screen number is zero "0".

If you press CTRL+a and then the letter "c" for "create" it will create a new window and run a bash shell by default and it will be screen number "1" (aka "window 1")


You can keep doing this (CTRL+a, then letter c, or CTRL+a-c for short) and you will keep creating new screen windows.  Notice how it keeps adding little tabs at the bottom, and each time it increases the number next to it.  Each window is a new separate bash shell and you can run whatever you want in it (like, say, a gunbot instance).


CTRL+a is the "command key" for screen. It's how you tell screen what to do.  CTRL+a-? (CTRL+a then question mark) will give you all the help, and there are lots of tutorials online that will help guide you through all the power tools of what screen can do (tip: google search for "GNU screen" instead of just "screen").  Here are the main ones you need for gunbot:

  • CTRL+a-space - moves forward one window
  • CTRL+a-backspace - moves backward one window
  • CTRL+a-CTRL+D - disconnect from screen session altogether (so you can reconnect later)
  • screen -r    this resumes a disconnected screen (assuming you only have one disconnected session - see tutorial links above)
  • CTRL+a-(number) - connect to window number specified (single digit only unfortunately)

------------------------------
USING TEE WITH GUNBOT
------------------------------


Part of how this console magic works is that we need gunbot's output but we only want part of it.  So, we pipe gunbot's output to a program called "tee".  Go to one of the screen windows and run gunbot like you normally do but pipe the output to tee. 

Now, what I do is I use a naming convention, not only for each directory I run gunbot in (important) but also the name of the file the I pipe the console output to (important).  That way the multitail works more easily.

Also, I keep everything in a directory called 'gunbot' and each instance is in its own subdirectory labeled with the pair, say "btc-maid".
So, I go to window 1 (NOT WINDOW 0 because I use window 0 for my "status console") -

Press CTRL+a-1 (this will get you to window 1 no matter what window you're 1) and it will highlight the tab at the bottom with the "1 bash").

Code: [Select]
zcash@zcash1:~$ cd gunbot
zcash@zcash1:~/gunbot$ cd btc-maid
zcash@zcash1:~/gunbot/btc-maid$ ./gunbot BTC_MAID | tee -a btc_maid-console.log

This specific example I'm showing above is for gunbot v2.0.3.  It launches stepgain, loads the configuration from BTC_MAID-config.js (which is just how it works in this version), displays the output into the console, and will also put all the output into the btc_maid-console.log file.

Then press CTRL+a-space to go to the next window (or CTRL+a-c to create one if I need a new window) and repeat the steps for the next pair - create a new btc-(pair) directory if needed... untar the whole gunbot installation files if needed....

QUICK TIP for spinning up a new pair: what I do is create a master installation directory when Gunthar gives us a stable version and I know I'm going to use it.. for example, v2.0.3b is what I'm using now. So I create a gunbot/v2.0.3 directory that is blank except for the files needed.

So, if I want a new pair, say btc-NEW, I do the following:

Code: [Select]
zcash@zcash1:~/gunbot$ mkdir btc-new
zcash@zcash1:~/gunbot$ cd v2.0.3
zcash@zcash1:~/gunbot/v2.0.3$ tar cvf - . | (cd ../btc-new; tar xfBp -)
./
./config.js
./package.json
./BTC_DASH-config.js
./gunbot
./save.json
./x86/
./x86/gunbot
zcash@zcash1:~/gunbot/v2.0.3$ cd ../btc-new
zcash@zcash1:~/gunbot/btc-new$ mv BTC_DASH-config.js BTC_NEW-config.js
zcash@zcash1:~/gunbot/btc-new$ vim !$

This creates a nice pristine copy that I can edit.  Then I edit the config of the new coin (if needed) and I'm ready to add it somewhere and run it.  This could be scripted if I was doing it often enough.

------------------------------
STATUS SO FAR
------------------------------


So, hopefully you were able to continue with the above steps and launch your multiple gunbot instances, each in their own screen window.  Keep doing CTRL+a-space to move forward a window at a time so you can watch gunbot happily run (don't worry that you don't see any colors from gunbot... tee doesn't support colors... and you don't want colors in the console logs anyway because it messes up the multitail coding). 

Ok, now let's say we have 8, 12, 16 or so gunbot instances running in the single screen session.  For many people, that's enough.  If you didn't want "cryptowally's fancy linux console" and just wanted screen to have the ability to run gunbot in unattended fashion, you're done.  You can just do the following:

  • CTRL+a-space to move forward and see the raw console of each instance
  • CTRL+a-backspace to move backwards
  • CTRL+a-CTRL+D to detach your entire screen session - that way everything continues to run while you're logged out.
  • screen -r to restore or return to your screen session later (more advanced options exist here, like naming them with -S and -list)

If you still want the fancy console, continue reading.

------------------------------
MULTITAIL CONSOLE
------------------------------


Again, I use a main "gunbot" directory that holds all my pairs.  Depending on how you do your pairs, this may change for you.  You might make a "btc1" to hold the first 16 pairs, and a "btc2" for the next 16 pairs and a "eth1" for the eth pairs, etc.

You need to have multitail installed.    Start at the official home page first, then google for some of the other tutorials.  Here are some of my favorites. Installation of multitail on linux tips,  A good .conf file, and Stackexchange article on watching a file even if not created.   

Create a "multitail.conf" file that contains the following text:
Code: [Select]
#include:/etc/multitail.conf
#check_mail:0
colorscheme:gunbot
cs_re:red,magenta:< prBuy
cs_re:red,white:<= prBuy
cs_re:red,white:>= prSell
cs_re:red,yellow:> prSell
cs_re:red,yellow:Sell order placed
cs_re:red,yellow:.*ORDER INFORMATION.*
cs_re:red,yellow:.*profit.*
cs_re:white:.*MinPriceToSell.*
cs_re:white:.*MaxPriceToBuy.*
cs_re:white:.*MaxPriceToSell.*
cs_re:white:.*MinPriceToBuy.*
cs_re:yellow:^Direction:\s+\d+
cs_re:white,red:Not enough BTC
cs_re:red:Error\!*
cs_re:red:.*failed.*
cs_re:red:.*no altcoins.*
cs_re:red:statusCode (.*)
cs_re:green:true
cs_re:red:false
cs_re:magenta:.*buy.*
cs_re:cyan:.*sell.*
cs_re:red:falls\syes
cs_re:green:grows\syes
cs_re:yellow:Has order:.*
cs_re:white:\:\:.*

Of course, the format is pretty self explanatory - if you want different colors, change the colors and the text that you want it to match.  It's normal regex so if you understand regular expressions it's pretty easy.  Put the matches in order from top to bottom.

Notice I'm also highlighting times when there isn't enough BTC or ETH, or when SELL or BUY orders are placed.  Those are things I like to have pointed out to me if I'm just watching things go by.

The next thing I like to see are a list of my latest trades.  So I wrote a little bash script that finds them for me. Since they're in the console logs, I can find them.

Create a directory called stats and create a file in there called "latesttrades.sh":

Code: [Select]
#!/bin/sh

for i in `ls /home/zcash/gunbot/[be]*/[be]*-console.log`
do
        tail -30000 $i  |  egrep '(Buying|Selling|Error\!\!\! Not enough )'
done

Note that you will need to change the "/home/zcash/gunbot/" part to be your normal directory.... and for me, since I run btc and eth pairs, the be be part is a regular expression that matches both "btc" and "eth" in the name.  What it does is looks for ALL the files with "console.log" in the name, but only the ones with "btc" or "eth" in the directory name, AND in the file name but only ones that start with "b" or "e" at the beginning of the name... and then it looks at the last 30000 lines of the file and finds if it bought, sold or had an error.

That's what gives me a nice one-liner summary at the bottom right hand corner of the console -- not sure if you noticed that in the first picture.  If you don't want that, you can leave out the script.

----------------------
The big stats page
----------------------


Now for the script that fires off the multitail.  Create a "btcstat.sh" file inside the top-level gunbot directory and put the following in it:

Code: [Select]
#!/bin/sh

multitail -Z red,black,inverse --config multitail.conf -CS gunbot -x "%m %u@%h %f (%t) [%l]" -b 4 -s 2 -m 0 -n 100 \
   --mark-interval 200 \
        -Ev "before to buy" \
        -Ev "Cannot sell" \
        -Ev "MaxPriceToBuy" \
        -Ev "Last price <=" \
        -Ev "Last price >=" \
        -Ev "Last price >" \
        -Ev "Last price >" \
        -Ev "Altcoin Balance" \
        -Ev "Not supergun:" \
        -Ev "Supergun: " \
        -Ev "avCoins" \
        -Ev "CANCEL sell orders" \
        -Ev "CANCEL buy orders" \
        -Ev "SEll on start" \
        -Ev "^$" \
        -Ev "^\s+\d+\.\d+$" \
        -Ev "No order" \
        -Ev ":::" \
        -Ev "Error\!\!\! statusCode 422" \
        -Ev "Will repeat" \
        -Ev "cycle" \
        -Ev "No basePrice" \
        -Ev "need_" \
        -Ev "Response:" \
        -Ev "Bot responsed" \
        -Ev "next delay" \
        -Ev "^\*" \
        -Ev "\*\*" \
        btc*/*-console.log \
        -ts -c- -Rc 10 -l "./stats/latesttrades.sh "

In short, what this does is:

  • runs multitail
  • loads the multitail.conf file we created before
  • loads the gunbot scheme
  • will warn you with yellow marker lines if any window doesn't have output for 200 seconds (so you can see any HANGING gunbot instances so you can restart them manually... ie, CTRL+a-space over to that window, CTRL+C to stop gunbot, up-arrow and press enter...)
  • strips out all the lines we don't need - that's what the -Ev lines do
  • dynamically makes a window for any -console.log file that matches the btc*/ line (so make sure your directory structure is good)
  • runs the stats/latesttrades.sh script every so often so you know how your trades are going

What *I* do is run ./btcstat.sh from screen window 0.  So I launch all my gunbots starting on window 1, then 2, then 3... etc and make sure they're all running first... then go to window 0 and run ./btcstat.sh.   That way all the -console.logs are there.  multitail will create all the windows it needs.... if you have 8 console logs, it will create 4 x 2 windows plus the latesttrades, so it will have 9 windows.  If you have 16 gunbots running, then you will have 17 windows (8 on the left and 9 on the right).

Notice again that if you start getting yellow lines in any of the windows, that means the gunbot instance in that specific window hasn't had any output for 200 seconds (or whatever you have "mark_interval" set to)...


See the window with the yellow in it?  Multitail is telling me that gunbot has locked up or is hung.  gunbot isn't responding or at least the console log file it's writing to hasn't had any updates.  I NEED TO ACT!

So what do you do?  You need to CTRL+a-space over to that window, CTRL-C gunbot, up arrow and press enter so it can restart.  This happens sometimes when gunbot sent a request to polo and polo didn't send it back.  Here's an example - you'll see "collecting data..." at the bottom of the window and gunbot is not doing anything... there's no output to the console like the other windows.


Just restart gunbot in that one window and you're back in business.  (ie, CTRL++-space until you get there, then CTRL+C to stop gunbot.  Press up-arrow to bring up the command that last started gunbot with the exact same settings in that window and press enter.  It will restart with the same settings and same tee command and everything.  Then CTRL+a-0 to get back to your btcstat.sh page.

I use that mark-interval and the yellow coloring so I can more quickly see that something is wrong.  There have been times when I see a whole bunch of yellow.  Thank goodness I had this system.  I can much more quickly determine if I have a bot that's hung up because I can quickly scan all the bots and see what's wrong.

Now, if you're running any of the other strategies like BB, Russian Roulette, Supergun or some version other than 2.0.3b, I don't know how the console output is different from stepgain.  I don't run those.   There may be tweaks needed to multitail.conf file, btcstat.sh, or latesttrades.sh scripts.  If someone wants to post their console output here, I can maybe post some possible tweaks.

-------------------
DISK SPACE CLEANUP
-------------------


As you can imagine, having each gunbot instance write all its console logs to the disk can eat up a lot of disk space over time.  You really only need the most recent console logs, so what you do with the logs after some time is up to you.  But since you don't want your disks to fill up, you need something to clear out those files.

I use a tool called logrotate.  If you want to copy what I do, it's easy and at least preserves the logs long-term by compressing them and only gives you a minor weekly task.

My system already had logrotate installed, so if you don't have it installed, google "logrotate" or "logrotated" and at least have the defaults running.  Usually, /etc/logrotate.conf points to an /etc/logrotate.d directory where you can put your own local settings.

Create an /etc/logrotate.d/gunbot file and put the following, changing the directory to match your own console.log files and directory naming:

Code: [Select]
/home/zcash/gunbot/[be]*/*-console.log {
        missingok
        weekly
        create 664 zcash zcash
        rotate 30
        compress
        dateext
}

For example, if your home directory is /home/gunbot and you put all your files into a directory called btc1, and your pairs are btc-<coin>, then that first line would have /home/gunbot/btc1/btc-*/btc*-console.log in it. Just make sure the regular expression matches what you have there.  You can use one line to match all your console logs if you want.

This will compress your big console.logs every week and rotate them out every month and put a date on them so if you wanted to go research how gunbot worked, you could still do so.

After my system has been running a while, here's how the log files look:

Code: [Select]
zcash@zcash1:~/gunbot$ ll btc-fct/
total 43952
drwxrwxr-x  3 zcash zcash     4096 May  9 09:23 ./
drwxrwxr-x 33 zcash zcash     4096 May 10 10:56 ../
-rw-rw-r--  1 zcash zcash     3432 May  9 09:23 BTC_FCT-config.js
-rw-rw-r--  1 zcash zcash  2586115 May 10 12:29 btc_fct-console.log
-rw-rw-r--  1 zcash zcash   885421 Apr 16 06:54 btc_fct-console.log-20170416.gz
-rw-rw-r--  1 zcash zcash   594402 Apr 23 21:49 btc_fct-console.log-20170424.gz
-rw-rw-r--  1 zcash zcash   430755 Apr 30 06:40 btc_fct-console.log-20170430.gz
-rw-rw-r--  1 zcash zcash   398708 May  7 06:53 btc_fct-console.log-20170507.gz

Notice how I still have my main console.log (and it's pretty big), and every week, it has a .gz file of the previous week's logs, which is much smaller.

I should point out that I enabled debug logging in my config... so I even have more console logging enabled than most people.  You can tweak your logrotate file to delete the console logs after a week, or not keep so many if you'd like.  Check out the many logrotate example files on the internet, or in the man pages.

Note that what this means is that multitail will turn yellow every week, because it won't know to refresh and look at the new log files.  So Monday morning when you come in, you'll see a sea of yellow windows.  Do not panic - just go to window 0, CTRL+C the btcstat.sh and up-arrow restart it so it can re-read the new console log files.  Or, you may need to just go to each gunbot instance and restart them - just to refresh the tee overwriting the console logs.  Don't worry - gunbot works fine and hasn't quit.  It's just that logrotate and tee or multitail don't get along sometimes.  It's still trading just fine.

--------------------
Multiple screen sessions
--------------------


So, the above is for one screen session for up to 16 pairs.  If you're going past that, I'd recommend you start the next set of pairs with another completely different directory and duplicate everything separately so nothing stomps on anything else.  That way, you're free to use the asterisks and regular expressions and things without messing things up.  It gets complicated if you're trying to juggle too many pairs in the same directory structure.

Personally, I run separate screens for my BTC and ETH pairs.  When I start my BTC screen session the first time, I name the screen session "btc" by running it with "screen -S btc".  For eth pairs, I do "screen -S eth".  This is only the very first time I launch screen, before I've started any gunbot sessions.    That way, with the screen session itself having a name, when I do a "screen -list" I can reconnect to the one I want:

Code: [Select]
zcash@zcash1:~/gunbot$ screen -list
There are screens on:
        31870.eth       (04/05/2017 08:14:10 PM)        (Attached)
        31307.btc       (04/05/2017 08:04:40 PM)        (Attached)

Instead of using "eth" or "btc," you might use "btc1" or "btc2" for the first set of btc pairs, second set or whatever.

So, when I reconnect to my server, I can just type in "screen -r eth" and I'll see all my 6 eth screens still running.  Then I fire up another putty session to my server and in that putty screen I type in "screen -r btc" and the 16 gunbot sessions show up there.  Everything's still running and money's still being made.

Nothing's stopping you from running multiple screens for each set of pairs.  Have a separate directory for each set of pairs.  "btc1" would contain multitail.conf, btcstat.sh, and one subdirectory for each pair.  Everything would be contained together so nothing stomped on each other.

btc2 would be a different directory with it's own multitail.conf, btcstat.sh and subdirectory for its pairs. 

-----------------------
Next steps / future ideas
-----------------------


Future Idea #1: better console
I've been working on a Part II, where the output is more formatted instead of just filtered, and one where it can react to output (such as restarting gunbot when it's yellow), or maybe even change the configs if it notices things like BTC rising, but that takes time.  Plus Gunthar keeps improving the bot (and changing the output) so at some point it might not be worth making changes.

But here's what I've mocked up as the next version of the console - if you'd like me to work on this, consider leaving a tip, or reputation.  The next version constantly watches each cycle's output and feeds a realtime console with the updates but only gives the pertinent and relevant information.  Do I have a bag?  Is it about to buy?  Do I have enough balance?  Is the coin pumping?  Are my settings way off?  How come I don't understand bitcoin market?  And my favorite:  Why am I expecting Gunthar to read my mind when I haven't even tried to understand what gunbot is really doing?


I think with this kind of console, we can better tweak our settings and understand what's going on.  Notice how in the console, I see consistent information in the same spot for each pair, the price is in the same format, I can see buy/sell history, and current orders, and when something changes, it highlights it with color, and I can see the last error, etc.  All this is in the current console output, so I just need to scrape it, collect it, and then fill out the formatter. 

Future Idea #2 - auto-launch. 
One thing I'm mostly done with is automating the above, where instead of manually setting up the screen sessions and such, one could use a .screenrc that launches the different gunbots in a synchronized manner, cd'ing to the directories and running gunbot correctly, and in a staggered fashion, say 3 seconds apart, so as not to anger the API gods.  I just haven't finished it because it's not bothering me too much.  I start gunbot by hand and time it manually by doing CTRL+a-space, up-arrow, enter and go to the next one and that takes about 3 seconds, and I do it so infrequently that I haven't found the need to automate it.  But it can be done and I know others have done it.

But it would look something like this:

Code: [Select]
$ more testscreen/fireguns
startup_message off
defscrollback 100000

#create windows
screen -t btc_gnt
select 0
stuff "sleep 3; fire gunbot command here"
screen -t btc_nav
select 1
stuff "sleep 3; fire gunbot command here"
# repeat to add more and more gunbot windows
# .......
screen -t stats
select 16
stuff "multitail monitoring command here"
#

Note you need a CTRL+M sequence at the end of the stuff commands in order for it to actually execute the commands... like so:




--------------
TIP JAR
--------------


If you enjoyed this tutorial and would like to leave a small tip, you may do so at the following address:
(I'll take any altcoin tip as well.. PM me to tell me the coin and I'll give you an address)

BTC: 1AhkpVhEqxfiaJoEayifwgqppEqZVbdCmn







6
Technical Support & Development / What does "canBuy False" mean?
« on: May 10, 2017, 03:01:42 PM »
I'm looking through my console logs and I suspect that "canbuy false" is just a validation of the message "you used enough balance on this pair, waiting to SELL".  Is that the case?  IS there any other reason "canbuy false" would show up?

Code: [Select]
[ ----------------    2017/05/10 08:34:05       Gunbot v2.0.3 Beta cycle#486 ------------------------ ]
::::: collecting data...
2017-05-08 04:13:50 sell 25.13475510 for 67.90000
SEll on start:  false
CANCEL sell orders:  false
CANCEL buy orders:  false


LP 0.00504613  Bal.BTC 0.89831326  Bal.FCT 0(25.1347551)  vWa1 0.00527705 < vWa2 0.00529063

Direction: -4 supergun:  true
::::: trading
No basePrice
No order
***You used enough balance on this pair, waiting to SELL...
avCoins  0.126833241752763 canBuy  false
MaxPriceToBuy 52.4539 MinPriceToSell --not set--

LP 50.4613000 <= prBuy 52.4538770  secMargin 0.0010554100000000001  grows yes
Bot canBuy: false
!! canBuy false !!
::::: cycle 486 finished in 0.30s
Gunbot v2.0.3 Beta cycle  # 486:     5/10/2017
Response:
        need_faster: false
        need_slower: false

next delay will be  190000

Pages: [1]