Pages:
Author

Topic: goxtool bot: portfolio rebalancing - page 3. (Read 26597 times)

full member
Activity: 160
Merit: 100
November 29, 2013, 07:09:17 AM
I'll be sure to send a donation your way with the first earnings!
Please don't expect too much. If bitcoin price goes up from here and never comes back then you will increase the USD balance but at the same time decrease the BTC balance. You will still overall have more money than you had before but not in terms of BTC alone, and also less than if you had held 100% BTC all the time. You will see BTC denominated profits only if you stop the bot at around the same price where you started it, otherwise it mostly serves as an automated mechanism to keep your BTC exposure (and therefore your risk) at a constant level instead of letting it rise dangerously high with increasing price.

I second this. With backtesting, and in principle, the main function of the balancer is to reduce volatility at the expense of some upside. I.e. you will get less profit but smoother profit.

It does do well in mean-reverting markets though (such as in the recent crashes).
hero member
Activity: 938
Merit: 500
https://youengine.io/
November 26, 2013, 07:01:18 AM
I'll be sure to send a donation your way with the first earnings!
Please don't expect too much. If bitcoin price goes up from here and never comes back then you will increase the USD balance but at the same time decrease the BTC balance. You will still overall have more money than you had before but not in terms of BTC alone, and also less than if you had held 100% BTC all the time. You will see BTC denominated profits only if you stop the bot at around the same price where you started it, otherwise it mostly serves as an automated mechanism to keep your BTC exposure (and therefore your risk) at a constant level instead of letting it rise dangerously high with increasing price.
newbie
Activity: 44
Merit: 0
November 26, 2013, 05:25:58 AM
Hi again! Thanks for your reply.
After a couple of days of mining (and rescuing that little I managed to rescue from the BTC I had invested in mcxNOW fees) I added more balance to my Gox balance.

While I have distance still set to 11, I have now 1.08 BTC + 135 USD in Gox and 6 BTC + 6000 USD as cold balance.
The orders the script placed are now 0.35 for Selling BTC and 0.43 for Buying BTC.

And, yes, I unbalanced the cold wallet on purpose as I would like always to end up with a little more BTC than dollars.

I'll keep you posted if this time it works. Hopefully the price is gonna soon hit one of the triggers.

Thanks for your effort in creating goxtools, and if/when I make it work I'll be sure to send a donation your way with the first earnings!
hero member
Activity: 938
Merit: 500
https://youengine.io/
November 23, 2013, 03:16:11 PM
When it happened it was with an order size of 0.03.
At the moment I have an order size of 0.01. Do you think I should increase it?
Yes, either more money into the account or larger distance
newbie
Activity: 44
Merit: 0
November 23, 2013, 03:03:43 PM
When it happened it was with an order size of 0.03.
At the moment I have an order size of 0.01. Do you think I should increase it?
hero member
Activity: 938
Merit: 500
https://youengine.io/
November 23, 2013, 12:57:18 PM
Have I missed anything?

should work. The only thing that I could imagine causing problems are if the balance were too small (or the distance too small) so that the orders would be less than 0.01 BTC and this would not be allowed on MtGox. Then goxtool would round up to 0.01 BTC and that could cause it come out of balance too far. How large are the orders it has placed?

I'm running my balancer currently with $30k USD and 36 BTC, my order sizes are 1.79 and 1.98 currently (at 11% distance)
newbie
Activity: 44
Merit: 0
November 23, 2013, 07:14:43 AM
Yes git cloned from the repository yesterday afternoon.

I decided to run a new test on my desktop computer (previous attempt was from a raspberry pi) from scratch, in a more controlled environment.

So I wiped everything from the RaspberryPi and git cloned goxtools and _balancer.py once again on a macmini (OSX 10.8.6).

I deleted the old API key on Gox, and made a new one. Also I made sure no pending orders were there.

I ran ./goxtools.py --add-secret and successfully registered my API key.

I edited _balancer.py so that the parameters state:
DISTANCE=11
FIAT_COLD=0
COIN_COLD=0

I launched goxtools: screen ./goxtool.py --strategy=_balancer.py --protocol=websocket --use-http

Within goxtools I balanced the BTC/$ amounts in my account using "b".
The balance was set on BTC 0.08513863 + USD 72.08415.

Then I pushed "p" and the orders were placed. "i" gives the following debug output:

2013-11-23 13:03:27,278:DEBUG:_balancer.Strategy:BTC difference at current price: -0.00055701
2013-11-23 13:03:27,281:DEBUG:_balancer.Strategy:Price where it would be balanced: 846.66796


And I'm waiting now for the trigger to hit either marker (753$~939$).

Have I missed anything?
hero member
Activity: 938
Merit: 500
https://youengine.io/
November 23, 2013, 06:54:48 AM
but started placing them at the same sale/buy price of where the previous buy/sale happened

This should not happen. After a trade is filled the balances (as displayed in the status bar at the top) should be *immediately* updated, the new orders are calculated from the balances. I have currently no idea what might be the reason for the symptoms you describe. Are you running the very latest version of goxtool?
newbie
Activity: 44
Merit: 0
November 23, 2013, 06:23:17 AM
I'm right now testing _balancer.py (the version from Github) and I only changed the DISTANCE parameter from 7 to 11.

Before starting I balanced the amount of BTC/$ in my account and made sure the order book was empty.

I start goxtools with the commandline ./goxtool.py --strategy=_balancer.py --protocol=websocket --use-http.

I push "p" and the bot places its two orders. Since last night the bot hit the higher threshold twice, and twice it canceled the remaining order and placed two new orders.
But apparently the script didn't place the new orders at distance 11 from where the BTC sale happened, but started placing them at the same sale/buy price of where the previous buy/sale happened, so that my balances were quickly being eroded by the fees.

So I stopped it for now and decided to ask first. Any ideas? Thanks!
full member
Activity: 160
Merit: 100
October 24, 2013, 03:48:52 PM
hmmm.. goxtool cross-exchange arbitrage... could be neat.
sr. member
Activity: 248
Merit: 252
1. Collect underpants 2. ? 3. Profit
October 24, 2013, 03:45:21 PM
I like this idea - have you considered writing the tool for bitstamp's API too? Their percentage of total bitcoin trading volume has risen a fair amount recently.

+1


Bitstamp's API is pretty bad, and the security is even worse.  You  send your username and password in every request.  No API keys and no grading of permissions.

Bitstamp have now implemented API keys

https://www.bitstamp.net/article/api-key-implementation/

legendary
Activity: 1437
Merit: 1002
https://bitmynt.no
August 21, 2013, 07:11:31 AM
I like this idea - have you considered writing the tool for bitstamp's API too? Their percentage of total bitcoin trading volume has risen a fair amount recently.
+1

I offer 0.2 btc bounty for this.

I know it's not much for the work but I hope others will add to it.
Bitstamp's API is pretty bad, and the security is even worse.  You  send your username and password in every request.  No API keys and no grading of permissions.  If you are somehow tricked into sending a request to the wrong server, you just gave away your account.  MtGox's API is much better in all regards.  A request sent to the wrong server contains no information of any use to anybody.

Bitcurex has an API very similar to MtGox v0, btw.  Should be trivial to port.
full member
Activity: 160
Merit: 100
August 21, 2013, 06:02:00 AM
I like this idea - have you considered writing the tool for bitstamp's API too? Their percentage of total bitcoin trading volume has risen a fair amount recently.

+1

I offer 0.2 btc bounty for this.

I know it's not much for the work but I hope others will add to it.
newbie
Activity: 37
Merit: 0
August 20, 2013, 11:04:40 AM
I like this idea - have you considered writing the tool for bitstamp's API too? Their percentage of total bitcoin trading volume has risen a fair amount recently.
hero member
Activity: 938
Merit: 500
https://youengine.io/
July 25, 2013, 04:22:23 AM
#99
Thanks for the link. Does this mean you'll be switching to the opposite strategy once the next bubble starts?

I'm not really sure yet how to do it exactly. If I really can convince myself that the post-bubble-bottom has been reached I will probably switch to something with much more BTC exposure (that decision will probably be a gamble but there is also a little gambler hidden inside me)
member
Activity: 85
Merit: 10
July 25, 2013, 12:38:35 AM
#98
Thanks for the link. Does this mean you'll be switching to the opposite strategy once the next bubble starts? The CPPI that's discussed in that link? Buying more Bitcoin when it is clear that the market is going up and selling when it is going down.

Interest that two completely opposite trading strategies are perfectly valid, just depending on the current behaviour of the market!
hero member
Activity: 938
Merit: 500
https://youengine.io/
July 22, 2013, 04:27:00 AM
#97
If BTC goes down to 0 USD shouldn't the bot automatically keep buying BTC and keep my total balance the same?
If BTC goes up to 1 000 000 USD shouldn't the bot automatically keep selling BTC and keep my total balance the same?

If the above is true, why does my total balance drop by 20% just because the starting and ending prices of my simulation are different?

You are still 50% exposed to BTC price, so if BTC goes down your total worth goes down as well, it just doesn't go down as much as if you were exposed 100%. If BTC price goes up your total worth will also go up (but also not as much as if you were 100% in BTC). All the bot can do is keep your exposure to the risky asset at 50% all the time.

Its important to understand that and not use this bot with wrong expectations! This is a concave strategy and as such it will underperform in strong trends but it will outperform in ranging markets, so I an use it until the next bubble begins (which will come I am 100% convinced).

Also when using it you are helping reduce volatility because you are providing a (small) resistance against every pump and dump that they have to overcome (and pay for) and so for every dollar or BTC that is allocated to such a balancing strategy it will become a little bit more expensive for the pumpers and dumpers to move the market because: (1) You are making it a little bit more expensive for them to initiate a huge move instead of helping them and (2) if it moves you are taking a little bit of their profits away (you are front-running them with your rebalancing orders), reducing their profits instead of losing money to them.
member
Activity: 85
Merit: 10
July 21, 2013, 05:05:31 AM
#96
Thanks! Its a bit concerning that beginning and finishing prices need to be the same. They won't be in the real world. I would've expected the small profits that this bot provides would be valid for any price of BTC as it automatically rebalances?

If BTC goes down to 0 USD shouldn't the bot automatically keep buying BTC and keep my total balance the same?
If BTC goes up to 1 000 000 USD shouldn't the bot automatically keep selling BTC and keep my total balance the same?

If the above is true, why does my total balance drop by 20% just because the starting and ending prices of my simulation are different?
full member
Activity: 227
Merit: 100
July 20, 2013, 02:53:36 PM
#95
http://cryptotrader.org/backtests/AQjCcwKuYdoXFK5TR
An other test that includes the all times high.
About 17% gains.
full member
Activity: 227
Merit: 100
July 20, 2013, 02:35:04 PM
#94
In order to see results with this algorithm the starting price and finishing price must be roughly the same.

So try this one
http://cryptotrader.org/backtests/oKM2ucnwtoFJTpSWD

This is my code for the same interval
http://cryptotrader.org/backtests/ASTXJE9ZzhJZA2H5u
The code is clean and small. The variables names and some comments are from the original code.

Check also this one
http://cryptotrader.org/backtests/DzbqZuFqL7xuuijFY
This not ideal because starting price is 13.40 and finishing price is 88.79.
But the gains are 225% and you have more fiat than when you started and the same amount in BTC.

Also there is a basic difference
This backtest trades only when the candle closes.
The original algorithm places trades inside the candle and before the price is reached.
I don't know if this is good or bad.

Regards,

Pakis
Pages:
Jump to: