Bitcoin Forum
April 26, 2024, 05:21:52 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 3 4 5 6 [7] 8 »  All
  Print  
Author Topic: goxtool bot: portfolio rebalancing  (Read 26517 times)
prof7bit (OP)
Hero Member
*****
Offline Offline

Activity: 938
Merit: 500


https://youengine.io/


View Profile WWW
December 11, 2013, 11:24:00 PM
 #121

please

git pull


and then run with

--protocol=pubnub

still experimental because I coded it in a hurry but seems to work already

1714108912
Hero Member
*
Offline Offline

Posts: 1714108912

View Profile Personal Message (Offline)

Ignore
1714108912
Reply with quote  #2

1714108912
Report to moderator
1714108912
Hero Member
*
Offline Offline

Posts: 1714108912

View Profile Personal Message (Offline)

Ignore
1714108912
Reply with quote  #2

1714108912
Report to moderator
1714108912
Hero Member
*
Offline Offline

Posts: 1714108912

View Profile Personal Message (Offline)

Ignore
1714108912
Reply with quote  #2

1714108912
Report to moderator
"Your bitcoin is secured in a way that is physically impossible for others to access, no matter for what reason, no matter how good the excuse, no matter a majority of miners, no matter what." -- Greg Maxwell
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714108912
Hero Member
*
Offline Offline

Posts: 1714108912

View Profile Personal Message (Offline)

Ignore
1714108912
Reply with quote  #2

1714108912
Report to moderator
1714108912
Hero Member
*
Offline Offline

Posts: 1714108912

View Profile Personal Message (Offline)

Ignore
1714108912
Reply with quote  #2

1714108912
Report to moderator
whizter
Hero Member
*****
Offline Offline

Activity: 588
Merit: 500


View Profile
December 12, 2013, 08:26:25 AM
 #122

please

git pull


and then run with

--protocol=pubnub

still experimental because I coded it in a hurry but seems to work already


seems to work, but it doesn't show the account info @ the top.

        ███████████████████▄▄▄
        ████████████████████████▄▄
           ████████████████████████▄
    ▄▄▄▄▄▄▄██████████████████████████▄
    ███████████████       ▀▀███████████
        ███████               ██████████
        ███████                ██████████
████████   ████████             █████████
▀▀▀▀▀▀▀▀▄▄▄████████             █████████
        ███████████             █████████
    ████   ████████            ██████████
    ████   ████████           ██████████
        ███    ████       ▄▄███████████
    ▄▄▄▄███▄▄▄▄██████████████████████▀
    ███████████████████████████████▀
████    ████████████████████████▀▀
████    ███████████████████▀▀▀
DIMCOIN   
❱❱❱  facebook  ❱❱❱  twitter  ❱❱❱  Telegram  ❱❱❱
.The Future of Equity on The Blockchain.
prof7bit (OP)
Hero Member
*****
Offline Offline

Activity: 938
Merit: 500


https://youengine.io/


View Profile WWW
December 12, 2013, 09:54:47 AM
 #123

Please edit the goxtool.ini and set use_tonce=True (and while you are at it also set use_http_api=True). It seems that with my current implementation some API requests during initialization come out of chronological sequence, making some API requests fail sometimes but the "tonce" which is only requres a 10 second time window has not such strict requirements and stilll works.

I have made this the default for new installations now but existing installations will still have the old settings in the ini.

Edit: and please git pull once a day, I'm still not finished with the pubnub stuff, its still a huge mess, their python API is ugly and incomplete and therefore the goxtool side of this is a huge pile of workarounds, I am still trying to fix it and make it more elegant and more reliable.

fatal
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
December 12, 2013, 10:39:21 AM
 #124

Thanks! Appreciate the work and quick turn around...  made the changes suggested and everything looks to be working. The account info is showing fine for me.
whizter
Hero Member
*****
Offline Offline

Activity: 588
Merit: 500


View Profile
December 12, 2013, 07:39:03 PM
 #125

Please edit the goxtool.ini and set use_tonce=True (and while you are at it also set use_http_api=True). It seems that with my current implementation some API requests during initialization come out of chronological sequence, making some API requests fail sometimes but the "tonce" which is only requres a 10 second time window has not such strict requirements and stilll works.

I have made this the default for new installations now but existing installations will still have the old settings in the ini.

Edit: and please git pull once a day, I'm still not finished with the pubnub stuff, its still a huge mess, their python API is ugly and incomplete and therefore the goxtool side of this is a huge pile of workarounds, I am still trying to fix it and make it more elegant and more reliable.

Thanks, it's working now.

        ███████████████████▄▄▄
        ████████████████████████▄▄
           ████████████████████████▄
    ▄▄▄▄▄▄▄██████████████████████████▄
    ███████████████       ▀▀███████████
        ███████               ██████████
        ███████                ██████████
████████   ████████             █████████
▀▀▀▀▀▀▀▀▄▄▄████████             █████████
        ███████████             █████████
    ████   ████████            ██████████
    ████   ████████           ██████████
        ███    ████       ▄▄███████████
    ▄▄▄▄███▄▄▄▄██████████████████████▀
    ███████████████████████████████▀
████    ████████████████████████▀▀
████    ███████████████████▀▀▀
DIMCOIN   
❱❱❱  facebook  ❱❱❱  twitter  ❱❱❱  Telegram  ❱❱❱
.The Future of Equity on The Blockchain.
btcrun
Member
**
Offline Offline

Activity: 103
Merit: 10



View Profile
December 17, 2013, 06:13:43 PM
Last edit: December 17, 2013, 07:03:53 PM by btcrun
 #126

I don't know what happened, but my instance isn't responding to the balance command (pressing b)
I tried using websocket and pubnub, tried a new API key and am up to date.

Does anybody how to solve this?

EDIT: I converted everything I got in my account (only 0.05BTC to test, maybe this isn't enough?) into BTC and as I pressed "b" after this, the bot rebalanced (it wasn't balanced before, but it wouldn't do it automatically).
New orders were placed and I will let it run through the night and see tomorrow Smiley
prof7bit (OP)
Hero Member
*****
Offline Offline

Activity: 938
Merit: 500


https://youengine.io/


View Profile WWW
December 17, 2013, 07:39:27 PM
 #127

0.05BTC
Is not enough. please read the thread, I have mentioned it multiple times. Load it at least with a few thousand dollars for it to make any sense. Minimum order size on gox is 0.01BTC, if you do the math you will see that your rebalancing orders would be too small by orders of magnitude.

btcrun
Member
**
Offline Offline

Activity: 103
Merit: 10



View Profile
December 18, 2013, 09:45:05 AM
 #128

0.05BTC
Is not enough. please read the thread, I have mentioned it multiple times. Load it at least with a few thousand dollars for it to make any sense. Minimum order size on gox is 0.01BTC, if you do the math you will see that your rebalancing orders would be too small by orders of magnitude.

I'm sorry, I wasn't thinking straight!
Was reading through the code and let it run simultaneously to test it...without thinking about the minimum order size. I will try it again later.
Thanks for your work!
leela
Newbie
*
Offline Offline

Activity: 16
Merit: 0


View Profile
December 23, 2013, 12:31:49 AM
 #129

I'm trying to get this to run on my linux box. I'm not normally a noob (been using linux since mid 90s) but I am a Python noob. If this was written in perl or something, no problem. Tongue

First problem was python-crypto wasn't installed. Second problem was python-simplejson wasn't installed.

 1807  apt-get install python-crypto
 1808  apt-get install python-simplejson

So after that, we have a new problem. (sorry for the spam, but this is how the output came out. I did delete screenfulls of blank lines at least.)


:~/goxtool$ ./goxtool.py --strategy=balancer.py
enter passphrase for secret:
testing secret...
testing key...
ok :-)

Price: 0.000000 - 0.000000 | Market: BTCUSD | Account: No info (yet)
sum_bid: 0 USD | sum_ask: 0 BTC | ratio: - USD/BTC | lag:  / 0.000 s (order / socket)

                                                                   
### shutdown...                                                     
                                                                   


*** error(s) in curses_loop() that caused unclean shutdown:

                                                           Traceback (most recent call last):
                                                                                               File "./goxtool.py", line 1592, in curses_loop
             strategy_manager = StrategyManager(gox, strat_mod_list)
                                                                      File "./goxtool.py", line 1476, in __init__
                                                                                                                     self.reload()
                                                                                                                                    File "./goxtool.py", line 1490, in reload
                                             strategy_module = __import__(name)
                                                                                 File "/home/leela/goxtool/balancer.py", line 16, in <module>
              conf = json.load(open("user.conf"))
                                                 IOError: [Errno 2] No such file or directory: 'user.conf'

                                                                                                          Traceback (most recent call last):
          File "./goxtool.py", line 1679, in curses_loop
                                                            strategy_manager.unload()
                                                                                     UnboundLocalError: local variable 'strategy_manager' referenced before assignment


Exception in thread Thread-1 (most likely raised during interpreter shutdown):
                                                                              Traceback (most recent call last):
                                                                                                                  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
                                                      File "/usr/lib/python2.7/threading.py", line 757, in run
                                                                                                                File "/usr/lib/python2.7/threading.py", line 403, in wait
                                       File "/usr/lib/python2.7/threading.py", line 267, in wait
                                                                                                <type 'exceptions.ValueError'>: list.remove(x): x not in list
                         :~/goxtool$


Okay, so lets create user.conf.


:~/goxtool$ touch user.conf
:~/goxtool$ ./goxtool.py --strategy=balancer.py
enter passphrase for secret:
testing secret...
testing key...
ok :-)


Price: 0.000000 - 0.000000 | Market: BTCUSD | Account: No info (yet)
sum_bid: 0 USD | sum_ask: 0 BTC | ratio: - USD/BTC | lag:  / 0.000 s (order / socket)

                                                                   
### shutdown...                                                     
                                                                                                                 

*** error(s) in curses_loop() that caused unclean shutdown:

                                                           Traceback (most recent call last):
                                                                                               File "./goxtool.py", line 1592, in curses_loop
             strategy_manager = StrategyManager(gox, strat_mod_list)
                                                                      File "./goxtool.py", line 1476, in __init__
                                                                                                                     self.reload()
                                                                                                                                    File "./goxtool.py", line 1490, in reload
                                             strategy_module = __import__(name)
                                                                                 File "/home/leela/goxtool/balancer.py", line 16, in <module>
              conf = json.load(open("user.conf"))
                                                   File "/usr/lib/python2.7/dist-packages/simplejson/__init__.py", line 357, in load
    use_decimal=use_decimal, **kw)
                                    File "/usr/lib/python2.7/dist-packages/simplejson/__init__.py", line 413, in loads
                                                                                                                          return _default_decoder.decode(s)
                         File "/usr/lib/python2.7/dist-packages/simplejson/decoder.py", line 402, in decode
                                                                                                               obj, end = self.raw_decode(s, idx=_w(s, 0).end())
                              File "/usr/lib/python2.7/dist-packages/simplejson/decoder.py", line 420, in raw_decode
                                                                                                                        raise JSONDecodeError("No JSON object could be decoded", s, idx)
                                                    JSONDecodeError: No JSON object could be decoded: line 1 column 0 (char 0)

                                                                                                                              Traceback (most recent call last):
                              File "./goxtool.py", line 1679, in curses_loop
                                                                                strategy_manager.unload()
                                                                                                         UnboundLocalError: local variable 'strategy_manager' referenced before assignment


Exception in thread Thread-1 (most likely raised during interpreter shutdown):
                                                                              Traceback (most recent call last):
                                                                                                                  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
                                                      File "/usr/lib/python2.7/threading.py", line 757, in run
                                                                                                                File "/usr/lib/python2.7/threading.py", line 403, in wait
                                       File "/usr/lib/python2.7/threading.py", line 267, in wait
                                                                                                <type 'exceptions.ValueError'>: list.remove(x): x not in list
                          Exception in thread Thread-2 (most likely raised during interpreter shutdown):
                                                                                                        Traceback (most recent call last):
        File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
                                                                                File "/usr/lib/python2.7/threading.py", line 759, in run
      File "/home/leela/goxtool/goxapi.py", line 431, in _fire
                                                                 File "/home/leela/goxtool/goxapi.py", line 371, in __call__
                                                                                                                               File "/usr/lib/python2.7/threading.py", line 121, in acquire
                                                       <type 'exceptions.TypeError'>: 'NoneType' object is not callable
                                                                                                                       :~/goxtool$



Urghh.

The code in balancer.py has:


# Load user.conf
conf = json.load(open("user.conf"))

# Set defaults
conf.setdefault('balancer_simulate', True)
conf.setdefault('balancer_distance', 7)
conf.setdefault('balancer_fiat_cold', 0)
conf.setdefault('balancer_coin_cold', 0)
conf.setdefault('balancer_marker', 7)
conf.setdefault('balancer_compensate_fees', False)
conf.setdefault('balancer_target_margin', 1)


So I assume it would use those as defaults if there's nothing in the conf file...

Anyway, I don't know if I've pulled some new version from git or what because there's no instructions in this thread or the goxtool website about needing this conf file or what to put in it...
prof7bit (OP)
Hero Member
*****
Offline Offline

Activity: 938
Merit: 500


https://youengine.io/


View Profile WWW
December 23, 2013, 12:53:13 AM
 #130

user.conf

The _balancer.py this thread is about has no "user.conf", please see the link to the original in post #1

You also wouldn't have needed any additional json packages, all of goxtool is using the built in json moule that comes with a standard python installation, I don't know what this balancer fork is doing or what it needs exotic additional json libs for.

leela
Newbie
*
Offline Offline

Activity: 16
Merit: 0


View Profile
December 23, 2013, 12:57:36 AM
 #131

So you're telling me this has nothing to do with balancer.py from https://github.com/caktux/goxtool ?  Hmmmm.
prof7bit (OP)
Hero Member
*****
Offline Offline

Activity: 938
Merit: 500


https://youengine.io/


View Profile WWW
December 23, 2013, 01:00:51 AM
 #132

So you're telling me this has nothing to do with balancer.py from https://github.com/caktux/goxtool ?  Hmmmm.
Thats a fork of my original bot. I don't know what was changed in this fork and how to use it, I can only recommend my original as it is found in the link on page 1.

prof7bit (OP)
Hero Member
*****
Offline Offline

Activity: 938
Merit: 500


https://youengine.io/


View Profile WWW
December 23, 2013, 01:03:24 AM
 #133

and in my signature the link for the main goxtool app. The only recommended and supported version.

leela
Newbie
*
Offline Offline

Activity: 16
Merit: 0


View Profile
December 23, 2013, 01:04:55 AM
 #134

So you're telling me this has nothing to do with balancer.py from https://github.com/caktux/goxtool ?  Hmmmm.
Thats a fork of my original bot. I don't know what was changed in this fork and how to use it, I can only recommend my original as it is found in the link on page 1.

Yes, I see, I'm studying the diff now. I didn't realise he imported your code into goxtool and made a few changes around the place (hence my confusion). It seems he did this relatively recently too.
prof7bit (OP)
Hero Member
*****
Offline Offline

Activity: 938
Merit: 500


https://youengine.io/


View Profile WWW
December 23, 2013, 01:12:26 AM
 #135

He probably added the user.conf stuff to support multiple installations on his multi user hosted goxtool server, probably heavy modifications because also every user needs his own account api secret.

The original _balancer does not need a config file, the way it is supposed to work in a single user setup is to edit the .py file of the strategy directly and then just press "l" (lowercase L) to dynamically reload the strategy at runtime (keep it simple approach, also for making code changes to the bot or similar experiments without needing to restart the entire application).

prof7bit (OP)
Hero Member
*****
Offline Offline

Activity: 938
Merit: 500


https://youengine.io/


View Profile WWW
December 23, 2013, 01:18:20 AM
 #136

he imported your code into goxtool
Its probably also a modified goxtool. Original code for original goxtool is at my repository (link in my sig)

shermozle
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
January 08, 2014, 12:52:30 AM
 #137

He probably added the user.conf stuff to support multiple installations on his multi user hosted goxtool server, probably heavy modifications because also every user needs his own account api secret.

(Second attempt to post this. Bitcointalk is rubbish)

Interesting service. I like his visualization:
https://zerogox.com/sites/zerogox.com/files/chart-screenshot.png

What are people using to track their bots' progress? I've got a simple Google Spreadsheet that I manually update periodically. One of these days I plan to learn enough Python to automatically push trades to it as they happen, which would be much more interesting.

But more relevant, how do you visualize and assess success from the bot? I look at both the 24 hour average exchange rate as well as the price at the time of the trade. They're both interesting views, and there's been a reasonable appreciation in balance by both measures.
smooth
Legendary
*
Offline Offline

Activity: 2968
Merit: 1198



View Profile
January 08, 2014, 01:26:56 AM
 #138

What are people using to track their bots' progress?

Its pretty hard to do this in a meaningful way if you are running a balancer. If you do some simulations you see that results can be all over the place just due to luck.

You can draw pretty pictures of course, but if you are drawing conclusions from results over a reasonable time scale you are probably fooling yourself.
prof7bit (OP)
Hero Member
*****
Offline Offline

Activity: 938
Merit: 500


https://youengine.io/


View Profile WWW
January 08, 2014, 10:32:18 AM
 #139

What are people using to track their bots' progress?

You can use this:
Code:
#!/usr/bin/gnuplot

set terminal wxt size 1000,650
set datafile sep ','

set xlabel "USD Account Balance"
set ylabel "BTC Account Balance"
plot '_balancer.log' using 3:4 with lines
pause -1

it will produce plots like these: https://bitcointalk.org/index.php?topic=181584.msg3911898#msg3911898

or here (same plot as above after a few more weeks):



shermozle
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
January 11, 2014, 07:10:01 AM
 #140


This is awesome, and has given me a nice gentle way into gnuplot which has always seemed scary and hairy. I like with this plot how you can see the total edging forward slightly with each gyration of the price. Would be nice to show the time dimension in there somehow.
Pages: « 1 2 3 4 5 6 [7] 8 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!