Bitcoin Forum
November 08, 2024, 08:09:06 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 3 [4] 5 6 7 8 9 10 11 »  All
  Print  
Author Topic: ncurses based MtGox live monitor and trading-bot-framework  (Read 33851 times)
prof7bit (OP)
Hero Member
*****
Offline Offline

Activity: 938
Merit: 500


https://youengine.io/


View Profile WWW
April 20, 2013, 10:39:48 AM
 #61

I just tested the balancer.py now, and i must say it had a huge spread.

Had about 7BTC, divided in two, and got 433 USD in cash. Current price is 120.
Started the bot with p, and it put in a sell at 129.03137, and a buy at 112.14877   

Yes, its a compromise between how often should it trade and how big should be the effect of the the rebalancing (the profit after a consecutve buy and sell). I cannot mathematically prove it but my gut feeling tells me in a normally trading market the overall profit should be the same (half the distance leads to 1/4 the profit but 4 times more trades [and more mtgox fees, so it would actually be less profitable]).

Faster trades also means more problems when mtgox becomes slow (order lag) or disconnects often during fast price moves. You can experiment with smaller numbers by changing the value of DISTANCE, don't make it smaller than 1.2, at 1.2 you will pay 100% of your profits as mtgox fees, maybe 2 would be a good minimum DISTANCE to experiment with when the market is slow but I guarantee that as soon as there are sudden large price moves mtgox will start lagging at exactly the wrong times and it won't be able to cancel and place new orders fast enough.

This bot is not intended to make you rich quickly, you need to run it for months to see an effect. Write down the BTC price and your account balance once a day and plot the curves on top of each other after a few months. You could also program a simulation if you find historical price data to experiment with different distances, I haven't done this yet.

molecular
Donator
Legendary
*
Offline Offline

Activity: 2772
Merit: 1019



View Profile
April 20, 2013, 12:42:11 PM
 #62

prof7bit, I didn't try out the balance bot, but from the description it seems doesn't work automtically but you have to tell it to place orders manually?

If it does work automatically, how does it decide at which point to "balance out" (i.e. how much divergence from 50/50 does it tolerate)? (I've written a similar bot in my traidor "framework". Never got it to fully work, even after 2nd try, I kept scrwing it up, then came the api change at gox (this was quite a while ago) but the goal was the same. I thought about putting the asks/bids just below/above walls. Also it didn't place just 2 bids, but a whole array all the way up/down so it wouldn't run into problems with lag)

PGP key molecular F9B70769 fingerprint 9CDD C0D3 20F8 279F 6BE0  3F39 FC49 2362 F9B7 0769
prof7bit (OP)
Hero Member
*****
Offline Offline

Activity: 938
Merit: 500


https://youengine.io/


View Profile WWW
April 20, 2013, 01:26:35 PM
Last edit: April 20, 2013, 01:55:51 PM by prof7bit
 #63

If it does work automatically, how does it decide at which point to "balance out"

It will place orders in the distance of 7% price change. So for example if price is at $100/BTC and you have 1000USD and 10BTC in your account is exactly balanced, it would place a sell order 0.327 at 107 and a buy order 0.376 at 93. Then it will wait until price moves and one of these orders is filled and automatically cancel the other and place 2 fresh orders in +- 7% distance around the new price. Thats all. It should happen automatically. BUT it will only work if you don't confuse the logic by having other open orders in your account! It will try to tell bot orders from manually entered orders by looking at the last digit of the order price but thats only an ugly hack! Make sure you dont have any other open orders whose price ends with "7" (or whatever you configured the value of MARKER)!

Standard disclamer for algorithmic trading: If you don't understand the logic of the bot by reading the source code and maybe inserting some more debug output then please don't use it. Please don't ask me, you cannot run a bot if you are not able to debug it yourself! That is simply not possible!

If the distance (default = 7%) is chosen too narrow then it might need to place orders faster than mtgox lag allows and it might come out of sync.

If it is messed up completely (happens maybe once a week) press c to cancel all orders and if it won't cancel them all or is behaving strange then cancel them manually, maybe restart goxtool or press u to get a manually updated list of open orders, use F6 to check your open orders to make sure they are all canceled. then press i to see how far you are out of balance at current price and if needed press b to rebalance manually, press p to place 2 fresh orders.

And as i have mentioned before already: make sure you ALWAYS have an up to date version of goxtool. git pull (and restart if there were updates) at least once a day, I'm still fixing things in goxtool itself occasionally that make it more reliable.

fnordfnordfnord
Newbie
*
Offline Offline

Activity: 56
Merit: 0


View Profile
April 20, 2013, 02:21:36 PM
 #64

Maybe we could make a separate forum thread where people post their bots and discuss them.

That's a good idea.

(half the distance leads to 1/4 the profit but 4 times more trades [and more mtgox fees, so it would actually be less profitable]).
Correct me if I am wrong but Mtgox charges a 0.6% fee per trade so it makes little difference whether you make large* or small ones. But, as you say, you do need to ensure that you make approximately >(0.6*2)% profit on trades or you will simply be slowly giving away your account to Mtgox in the form of fees.

* Large being relative here.
daybyter
Legendary
*
Offline Offline

Activity: 965
Merit: 1000


View Profile
April 20, 2013, 02:27:48 PM
 #65

The channel #cryptocoin-bots is quiet at the moment, but was used for such discussion a while ago....

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

Activity: 938
Merit: 500


https://youengine.io/


View Profile WWW
April 20, 2013, 02:33:05 PM
 #66

Correct me if I am wrong but Mtgox charges a 0.6% fee per trade so it makes little difference whether you make large* or small ones. But, as you say, you do need to ensure that you make approximately >(0.6*2)% profit on trades or you will simply be slowly giving away your account to Mtgox in the form of fees.

* Large being relative here.

Yes, its the price difference between buy and sell, not the trade volume that matters. 2 * 0.6% fee translates into a minimum price difference of 1.2% between buy and sell price to reach the profit zone, if you buy at 100 you need to sell above 101.2 to become profitable, so the samller the distance, the larger (relative) the part that goes to mtgox on every trade.

fnordfnordfnord
Newbie
*
Offline Offline

Activity: 56
Merit: 0


View Profile
April 20, 2013, 04:33:09 PM
 #67

Okay, here are a couple questions,
Q1. Are you interested in bug reports at your github?
Q2. Do you mind contributions from others?
Q2. a. Even from individuals who are obviously less capable programmers than yourself? It might require some patience on your part, especially in the beginning.
Q3. I might want to add some features that some may think is really goofy (like play sounds when trades execute),

let's say I make some changes to stragegy.py, and I want to test them. We can consider several testing strategies
  • Test on historical data from mtgox.
    • interesting since goxtool grabs this data when it connects, and because this data is real, and relevant to current mkt conditions
    • bad because it's not a controlled test, and therefore difficult to compare strategies
    • dangerous since we're connected to a live account. Maybe we should make for ourselves different API access for testing vs trading
  • Test on fake data we make ourselves. This could be:
    • Old data we've saved
    • Data collected from other exchanges
    • Fake sample data sets.

There is also various levels of diligence to consider,
  • simply iterate over the data?
  • iterate, and try to account for realistic mkt timings, liquidity, etc.

Do you think it would be easier to write a new program for testing that imports some strategy.py, or add testing functionality to goxtool?
Is that a feature that you might be personally interested in, or would consider adding to the codebase?
prof7bit (OP)
Hero Member
*****
Offline Offline

Activity: 938
Merit: 500


https://youengine.io/


View Profile WWW
April 20, 2013, 05:47:21 PM
 #68

Okay, here are a couple questions,
Q1. Are you interested in bug reports at your github?

yes. I just cannot promise that I will include every new feature but even then its easy on github to maintain a modified fork (there are a few already) and still exchange patches with each other that are important.

Do you think it would be easier to write a new program for testing that imports some strategy.py, or add testing functionality to goxtool?

Not 100% sure. A full blown simulator could load the strategy and implement the same interface and emit the same signals as Gox() does, it could run as multiple processes (maybe even on multiple machines) to test different parameters of the same strategy in parallel, maybe its really a good idea to make such a thiing a completely separate application and not complicate the goxapi too much, since only few people will use it.

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

Activity: 938
Merit: 500


https://youengine.io/


View Profile WWW
April 20, 2013, 05:48:59 PM
 #69

Maybe we could make a separate forum thread where people post their bots and discuss them.
That's a good idea.
I have made a new thread for the _balancer.py now, maybe a separate thread for every separate bot is even better: https://bitcointalk.org/index.php?topic=181584.0

rm187
Member
**
Offline Offline

Activity: 65
Merit: 10



View Profile
April 21, 2013, 12:55:19 AM
 #70

Love this. Plan to do my own custom changes.

Also setup a server for public to check out the script/watch gox. Basically just another ticker; but useful for some people depending on internet restrictions.

gox.ruststorm.com:22
user:goxtool
pass:password

1x5AFgSYTzXZ9eKJTKUfr7tiSuGyBE7Yd
JWU42
Legendary
*
Offline Offline

Activity: 1666
Merit: 1000


View Profile
April 21, 2013, 02:37:00 AM
 #71

Interesting idea...

Just tested it out and looks cool.  Wish I knew how to script to have it load goxtool and exit the ssh session as you did...

K1773R
Legendary
*
Offline Offline

Activity: 1792
Merit: 1008


/dev/null


View Profile
April 21, 2013, 03:14:01 AM
 #72

Love this. Plan to do my own custom changes.

Also setup a server for public to check out the script/watch gox. Basically just another ticker; but useful for some people depending on internet restrictions.

gox.ruststorm.com:22
user:goxtool
pass:password
thanks, now i can tell all the win kids they can use goxtool too with putty Tongue

[GPG Public Key]
BTC/DVC/TRC/FRC: 1K1773RbXRZVRQSSXe9N6N2MUFERvrdu6y ANC/XPM AK1773RTmRKtvbKBCrUu95UQg5iegrqyeA NMC: NK1773Rzv8b4ugmCgX789PbjewA9fL9Dy1 LTC: LKi773RBuPepQH8E6Zb1ponoCvgbU7hHmd EMC: EK1773RxUes1HX1YAGMZ1xVYBBRUCqfDoF BQC: bK1773R1APJz4yTgRkmdKQhjhiMyQpJgfN
rm187
Member
**
Offline Offline

Activity: 65
Merit: 10



View Profile
April 21, 2013, 03:27:33 AM
Last edit: April 21, 2013, 03:39:37 AM by rm187
 #73

Interesting idea...

Just tested it out and looks cool.  Wish I knew how to script to have it load goxtool and exit the ssh session as you did...

I just setup the script as the user shell.
Add the script location to the shells(/etc/shells), change the user's shell with chsh username, then when prompted, enter the location of goxtool.py(same as what u added in shells). (Debian env here, RH may be little different)

Love this. Plan to do my own custom changes.

Also setup a server for public to check out the script/watch gox. Basically just another ticker; but useful for some people depending on internet restrictions.

gox.ruststorm.com:22
user:goxtool
pass:password
thanks, now i can tell all the win kids they can use goxtool too with putty Tongue
np. I threw in shellinabox too for HTTP display. Though it doesn't respond as well as a real terminal.
http://gox.ruststorm.com/

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

Activity: 938
Merit: 500


https://youengine.io/


View Profile WWW
April 21, 2013, 08:50:25 AM
 #74

np. I threw in shellinabox too for HTTP display. Though it doesn't respond as well as a real terminal.
http://gox.ruststorm.com/

wow, this is a funny idea! I think I should add a configuration option for (or automatic detection of) black&white terminals too to make this look even better :-)

c0inbuster
Member
**
Offline Offline

Activity: 105
Merit: 10



View Profile WWW
April 21, 2013, 09:34:45 AM
 #75

Thanks prof7bit for your hard work.
I ever see you on a FX forum (sorry I don't remember which one)

It will be very nice if you could add features such as:
- stop loss (sell stop)
- trailing stop
- stepping stop

You should also add support of Python Pandas library
http://pandas.pydata.org/
because some technical analysis indicators have been ported to this lib
https://code.google.com/p/ultra-finance/wiki/pyTaLib

of course making this software available to other markets (Bitcoin-central for
example) will be great !

Kind regards

Download free softwares! - crypto mining profit calculator - crypto triangular arbitrage tools - crypto stocks tools...
https://sites.google.com/site/working4coins/
ErebusBat
Hero Member
*****
Offline Offline

Activity: 560
Merit: 500

I am the one who knocks


View Profile
April 21, 2013, 12:48:21 PM
 #76

np. I threw in shellinabox too for HTTP display. Though it doesn't respond as well as a real terminal.
http://gox.ruststorm.com/

wow, this is a funny idea! I think I should add a configuration option for (or automatic detection of) black&white terminals too to make this look even better :-)
On that note... When connecting to my screen instance from my ipad it isn't immediately clear what the last price was because f no title bar.  Would you be willing to accept a pull request to add this by account balance?

░▒▓█ Coinroll.it - 1% House Edge Dice Game █▓▒░ • Coinroll Thread • *FREE* 100 BTC Raffle

Signup for CEX.io BitFury exchange and get GHS Instantly!  Don't wait for shipping, mine NOW!
K1773R
Legendary
*
Offline Offline

Activity: 1792
Merit: 1008


/dev/null


View Profile
April 21, 2013, 01:07:33 PM
 #77

np. I threw in shellinabox too for HTTP display. Though it doesn't respond as well as a real terminal.
http://gox.ruststorm.com/
even more awesome Cheesy
i will use this too!

[GPG Public Key]
BTC/DVC/TRC/FRC: 1K1773RbXRZVRQSSXe9N6N2MUFERvrdu6y ANC/XPM AK1773RTmRKtvbKBCrUu95UQg5iegrqyeA NMC: NK1773Rzv8b4ugmCgX789PbjewA9fL9Dy1 LTC: LKi773RBuPepQH8E6Zb1ponoCvgbU7hHmd EMC: EK1773RxUes1HX1YAGMZ1xVYBBRUCqfDoF BQC: bK1773R1APJz4yTgRkmdKQhjhiMyQpJgfN
prof7bit (OP)
Hero Member
*****
Offline Offline

Activity: 938
Merit: 500


https://youengine.io/


View Profile WWW
April 21, 2013, 01:30:27 PM
 #78

np. I threw in shellinabox too for HTTP display. Though it doesn't respond as well as a real terminal.
http://gox.ruststorm.com/
even more awesome Cheesy
i will use this too!
This is the true power of the unix philosopy "one job one tool", you can just plug a few small existing tools together without needing to change or adapt any them and instantly create something totally new :-)

K1773R
Legendary
*
Offline Offline

Activity: 1792
Merit: 1008


/dev/null


View Profile
April 21, 2013, 08:17:10 PM
 #79

np. I threw in shellinabox too for HTTP display. Though it doesn't respond as well as a real terminal.
http://gox.ruststorm.com/
even more awesome Cheesy
i will use this too!
This is the true power of the unix philosopy "one job one tool", you can just plug a few small existing tools together without needing to change or adapt any them and instantly create something totally new :-)
thats why i love linux (not unix, unix has been a mess too often Tongue) myself so much Smiley
its like LEGO, you build your tools/program and can wrap em with whatever u want!

[GPG Public Key]
BTC/DVC/TRC/FRC: 1K1773RbXRZVRQSSXe9N6N2MUFERvrdu6y ANC/XPM AK1773RTmRKtvbKBCrUu95UQg5iegrqyeA NMC: NK1773Rzv8b4ugmCgX789PbjewA9fL9Dy1 LTC: LKi773RBuPepQH8E6Zb1ponoCvgbU7hHmd EMC: EK1773RxUes1HX1YAGMZ1xVYBBRUCqfDoF BQC: bK1773R1APJz4yTgRkmdKQhjhiMyQpJgfN
rm187
Member
**
Offline Offline

Activity: 65
Merit: 10



View Profile
April 21, 2013, 11:19:20 PM
 #80

Well, shellinabox does not close sessions on browser closes. Had 9.99 load and few hundred goxtools trying to run. I have setup a script to kill processes that continue after a session is lost. Hopefully fixes the problem.

I am adding more GUI elements, options (currency/graph type, etc), personal modifications. prof7bit, are you currently working on any additions?

1x5AFgSYTzXZ9eKJTKUfr7tiSuGyBE7Yd
Pages: « 1 2 3 [4] 5 6 7 8 9 10 11 »  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!