Bitcoin Forum
October 19, 2024, 05:35:11 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 3 4 5 »  All
  Print  
Author Topic: tAPI-bot - Automated crossover trade platform for BTC-e [INACTIVE 2013-10-15]  (Read 36356 times)
nomorecoin (OP)
Newbie
*
Offline Offline

Activity: 16
Merit: 0



View Profile
May 07, 2013, 02:43:37 AM
Last edit: October 15, 2013, 11:09:50 PM by nomorecoin
 #1

I have decided to open source my trade "bot". It is written in Python 2.7, and uses Pylab (or matplotlib+numpy, confirmed) for graphing output. I have not tested without these packages.
I use the EPD free distribution of Python 2.7.3, which is available here, though all that should be required is Pylab, and only if you wish to view a simple plot of the lines the bot "sees".

The trade algorithm is very simple, but fairly configurable. It uses a moving average crossover with several options. See settings.ini.
I expect there are more than a few issues. Logging is incomplete, and error handling is nearly non-existent. Run in IDLE for better stack traces.
Only trades against BTC-e (for now).

One other note, the program uses individual trades as periods for the purpose of moving averages. This is non-typical, and may not align with traditional wisdom for crossover signals.

Grab the source as a zip from my Github, extract, punch in some API stuff, configure your signals, and run Application.py to start.

pre-posting edit: it seems EPD free has been renamed to "Canopy" something or other. Should work just as well.
nomorecoin (OP)
Newbie
*
Offline Offline

Activity: 16
Merit: 0



View Profile
May 07, 2013, 03:31:16 AM
Last edit: September 17, 2013, 09:27:25 PM by nomorecoin
 #2

TODO:
Add newer pairs
Verify key/secret pair are valid when starting commit
Test like crazy
Fix bug where bot doesn't place bids
Change min trade amounts. API limit appears to have changed since code was originally laid out. - bot currently trades full balance, issue is N/A
Implement a better simulation mode (low priority)
Improve exception handling (high priority)
Abstract the API portion to allow interchangeable exchanges
Add EMA signal type
Add stop loss

No Plans to Implement:
GUI
Compiled version
Cross-exchange arbitrage
MtGox anything

Known Issues:
KeyError printing existing orders, investigating. Set verbose = False to bypass this issue.
Graphing for some values is useless due to scientific notation on axes.

Potential Issues:
Bot is likely to be caught on the wrong side of a trend due to minimum volatility check
maverick1337
Newbie
*
Offline Offline

Activity: 40
Merit: 0


View Profile
May 07, 2013, 05:37:06 AM
 #3

This may sound weird but is it possible to have a bot notify you (via email/text/etc) when the EMA lines cross, and that only? I don't want it to automatically trade but to just send me a notification of when they cross so I can initiate the trades myself. You wouldn't have to include any trading data or anything. I know people spend a lot o time and effort on their codes and was wondering if this was possible.

Thank you in advance for any help.
maverick1337
Newbie
*
Offline Offline

Activity: 40
Merit: 0


View Profile
May 07, 2013, 05:42:50 AM
 #4

Thank you for the response. I have absolutely zero knowledge about python and trade bots in general. Would this work on a Mac or PC? I don't have linux.
maverick1337
Newbie
*
Offline Offline

Activity: 40
Merit: 0


View Profile
May 07, 2013, 05:55:49 AM
 #5

Well I'm thinking of have it notify when M15/H1/H4 lines cross. That wouldn't be very emails at all. Also, would it be easy to implement Mt.Gox instead of BTC-e?
billotronic
Legendary
*
Offline Offline

Activity: 1610
Merit: 1000


Crackpot Idealist


View Profile
May 08, 2013, 07:41:22 PM
Last edit: May 08, 2013, 09:19:22 PM by billotronic
 #6

Silly question, does this bot only handle one pair at a time? ie, could I configure the ini to trade both btc_usd & ltc_usd? If no, can I run multiple instances to cover both items of interest? [edit] I can figure this part out myself

Thanks for this and thanks even more for the sim mode. I'm not much for trading much less trade bots so thats a nice feature for us n00bs to get a grip on the bot before turning it loose. Look forward to messing with this.

[edit 2] Another question, in the sim mode, it's pretty much just presenting information as opposed to showing theoretical trades that the bot would perform if simMode was set to False?

This post sums up why all this bullshit is a scam
Read It. Hate It. Change the facts that it represents.
https://bitcointalk.org/index.php?topic=1606638.msg16139644#msg16139644
billotronic
Legendary
*
Offline Offline

Activity: 1610
Merit: 1000


Crackpot Idealist


View Profile
May 09, 2013, 12:12:05 AM
 #7

ooo, that is a really good point for which I did not think about. Maybe something for the future could be loading separate api's and separate settings per api? Assuming that's even desirable or feasible.

Quote
I'd like to improve the simulation mode to trade against a fake copy of your existing balance, adjusting it as it simulates trading.

Now that would be pretty neat. Personally, I think (if) bfl does indeed flood the market with ASICS we are going to see a surge of people looking into trading for coins (like myself) who would find much use and learning from a sim type tool (like myself).

Thank you for your work and I hope I can get to the point to send some fun to your grape juice fund for it! (gotta pay the mortgage first, boo!)

This post sums up why all this bullshit is a scam
Read It. Hate It. Change the facts that it represents.
https://bitcointalk.org/index.php?topic=1606638.msg16139644#msg16139644
billotronic
Legendary
*
Offline Offline

Activity: 1610
Merit: 1000


Crackpot Idealist


View Profile
May 09, 2013, 02:00:42 AM
 #8

Toying with the sim right now. Is it a safe assumption that the values to set for the moving average is in days?

Python is definitely a wonderful language... I wish I knew more than just basic trouble shooting when I can't get an app to run on my linux boxes.

But now I have a problem. Running in as sim with tickers for btc_usd ltc_usd & ppc_btc with trade active for ppc_btc. I installed canopy with no errors. App has been running for about 10 minutes but nothing graphed. I am not familiar with canopy, is there anything I need to do with it?

I have python 2.7.3 and running Xubuntu 12.10.

Help? lol.

This post sums up why all this bullshit is a scam
Read It. Hate It. Change the facts that it represents.
https://bitcointalk.org/index.php?topic=1606638.msg16139644#msg16139644
billotronic
Legendary
*
Offline Offline

Activity: 1610
Merit: 1000


Crackpot Idealist


View Profile
May 09, 2013, 02:07:29 AM
Last edit: May 09, 2013, 02:30:59 AM by billotronic
 #9

I should also add that the file size of graph.png has increased, but damned if I see anything on it. Also tried increasing DPI to 800. Now I am trying changing the trade target to btc_usd to see if that makes a difference

[edit]hahahaha I should of known. Low and behold there just wasn't data to graph. Changed trade target and now I have a graph. Ignore previous silliness.

This post sums up why all this bullshit is a scam
Read It. Hate It. Change the facts that it represents.
https://bitcointalk.org/index.php?topic=1606638.msg16139644#msg16139644
billotronic
Legendary
*
Offline Offline

Activity: 1610
Merit: 1000


Crackpot Idealist


View Profile
May 09, 2013, 02:34:47 PM
 #10

Ok, after some tinkering I think I have found a bug. It appears that the bot does not like the existence of manually created trades. I'm running in sim with trading on btc_usd but I have open ppc orders which I think is the culprit.

Quote
Greetings, human. tAPI-bot loading...
tAPI-bot v0.51, starting.
Open Orders: 4
Traceback (most recent call last):
  File "Application.py", line 40, in <module>
    runLoop()
  File "Application.py", line 25, in runLoop
    printing.displayBalance()
  File "/home/x/Desktop/tAPIbot-master/tapi/helper.py", line 145, in displayBalance
    self.processOrders(printOutput=True)
  File "/home/x/Desktop/tAPIbot-master/tapi/helper.py", line 164, in processOrders
    order['pair'],
KeyError: 'pair'

I'm going to let my orders stand for a bit (come on bull!) and then try creating manual btc orders and see if that fixes the crash.

This post sums up why all this bullshit is a scam
Read It. Hate It. Change the facts that it represents.
https://bitcointalk.org/index.php?topic=1606638.msg16139644#msg16139644
billotronic
Legendary
*
Offline Offline

Activity: 1610
Merit: 1000


Crackpot Idealist


View Profile
May 09, 2013, 11:03:16 PM
Last edit: May 10, 2013, 01:59:33 AM by billotronic
 #11

Well that is what I thought too BUT took down my remaining orders for ppc and low and behold it has been running for 3 hours now with no crash whereas before it was crashing after start up. I think there is a bug there and I am all over trying to figure it out (started looking at the code watch out! [insert puking smiley from skype here])

I have the luxury of toying with this remotely on my server from work so if I get some proper time in the next few days I am going to run some experiments to see what I can see.

On a side note, you say that there is no error logging / debugging built it, what would it take to make that happen? Is there some sort of app or environment I could run this in that would give debugging info?

[edit] also, i know that python is cross platform and all, but maybe for posterity, we should list what os's we are running this on in case the finished product requires independent install instructions?

This post sums up why all this bullshit is a scam
Read It. Hate It. Change the facts that it represents.
https://bitcointalk.org/index.php?topic=1606638.msg16139644#msg16139644
Jude Austin
Legendary
*
Offline Offline

Activity: 1140
Merit: 1000


The Real Jude Austin


View Profile WWW
May 11, 2013, 02:06:48 PM
 #12

In regards to the KeyError:

On line 143 of helper.py I changed:

Code:
if type(orders) == int and orders > 0: 

to

Code:
if type(orders) == str and orders > 0: 

And I no longer get that error.


Buy or sell $100 of Crypto and get $10!
billotronic
Legendary
*
Offline Offline

Activity: 1610
Merit: 1000


Crackpot Idealist


View Profile
May 11, 2013, 02:17:59 PM
 #13



In order to make a compiled, Windows-only exe (the only type I have any experience with), the way settings are stored and read would need to change. It's certainly possible though.

I was thinking more in the lines of dealing with the python dependencies. For example, if I type PyLab into my package manager I get a library named python-matplotlib that I might be able to use for charting in place of the HUGE install of Canopy. I don't know what your set up is, but my plan would be to load this onto one of my running pi's and the smaller install size would be ideal.

Otherwise, seems to be running nice and smooth. I've had it running for about 24 hours now in live mode with no crashes and the bot posting trades. I would have to say it seems to work pretty good with the little coin I am giving it to work with. I am looking forward to running this baby full throttle.

This post sums up why all this bullshit is a scam
Read It. Hate It. Change the facts that it represents.
https://bitcointalk.org/index.php?topic=1606638.msg16139644#msg16139644
billotronic
Legendary
*
Offline Offline

Activity: 1610
Merit: 1000


Crackpot Idealist


View Profile
May 11, 2013, 04:55:31 PM
 #14

Well I was thinking of setting up some VM's this weekend to toy around with fresh installs... the VM I am running your bot in is a bit messy to say the least. I will post if I find anything useful.

Oh and I should add that I would like to keep the graphing functional. My end goal would be a simple web based output screen for your bot that I can check up on and that would include the graph.

This post sums up why all this bullshit is a scam
Read It. Hate It. Change the facts that it represents.
https://bitcointalk.org/index.php?topic=1606638.msg16139644#msg16139644
billotronic
Legendary
*
Offline Offline

Activity: 1610
Merit: 1000


Crackpot Idealist


View Profile
May 11, 2013, 06:36:37 PM
 #15

with enough whiskey, i can do anything!

Had a thought. How hard would it be to keep track of profits? Let's say when the bot starts, it uses the balance info and the converts all balances to btc and then prints a total. Then you could have the bot print profit (or loss) against this total in btc when it prints balances? I figured btc would be the easiest base since almost all the pairs on btc-e are based on btc.

This post sums up why all this bullshit is a scam
Read It. Hate It. Change the facts that it represents.
https://bitcointalk.org/index.php?topic=1606638.msg16139644#msg16139644
billotronic
Legendary
*
Offline Offline

Activity: 1610
Merit: 1000


Crackpot Idealist


View Profile
May 11, 2013, 07:23:45 PM
 #16

Absolutely! The bot is already scraping the info from btc-e, you would just have to add a little more math to the bot.

This post sums up why all this bullshit is a scam
Read It. Hate It. Change the facts that it represents.
https://bitcointalk.org/index.php?topic=1606638.msg16139644#msg16139644
Jude Austin
Legendary
*
Offline Offline

Activity: 1140
Merit: 1000


The Real Jude Austin


View Profile WWW
May 12, 2013, 06:26:15 AM
 #17

It seems to me that the script get's out of whack.

At some point it starts doing the complete opposite, it will buy when high, then sell when low.

I will provide the log tomorrow for it.

It's crazy!

Anyway some BTC can change your schedule to make this script awesome?

Buy or sell $100 of Crypto and get $10!
Jude Austin
Legendary
*
Offline Offline

Activity: 1140
Merit: 1000


The Real Jude Austin


View Profile WWW
May 12, 2013, 02:03:25 PM
 #18

It seems to me that the script get's out of whack.

At some point it starts doing the complete opposite, it will buy when high, then sell when low.

I will provide the log tomorrow for it.

It's crazy!

Anyway some BTC can change your schedule to make this script awesome?

Trust me, I want it to be awesome. It is as awesome as my skills and time have allowed to date.

Did you change the MA line settings at all? Default is essentially random. Understanding how this thing trades (or decides to try to trade) might help you capture the volatility.

It looks at individual trades, so a 40 point MA line takes the last 40 trades. SMA plots a point from a simple average of these 40 points. VMA weights the trades by volume.
Single MA mode compares price to moving average. When the price is below the MA line, the market is seen as trending down. The opposite when the price line moves above the MA.
Dual compares 2 MA lines, one fast, and one slower.
Ribbon is an attempt at a better confirmation of a trend. 3 lines must agree before a trend is decided.

In any case, this bot is prone to errors, calling trends that never develop, lagging behind a micro-trend, etc. It has been profitable, but certainly not every day.

The key is setting it to capture the volatility.

Yes, a little better understanding would be nice.

So each of the values defined in settings.ini are N of last trades averaged, for the mode anyway?

So over time the best mode to use would be ribbon, correct?

I am a new and have a ton of questions and very little understanding of all this, lol.

Thanks for your time.

Buy or sell $100 of Crypto and get $10!
billotronic
Legendary
*
Offline Offline

Activity: 1610
Merit: 1000


Crackpot Idealist


View Profile
May 12, 2013, 06:17:04 PM
 #19

And it does not help much that the volume on BTC-E has been in the dumps for the past few days...

Jude, run it in sim mode till you have an understanding of the configuration settings is the best advice you can get. Set it for something with some movement and you will begin to see how the bot 'thinks' and reacts to market conditions.

This post sums up why all this bullshit is a scam
Read It. Hate It. Change the facts that it represents.
https://bitcointalk.org/index.php?topic=1606638.msg16139644#msg16139644
billotronic
Legendary
*
Offline Offline

Activity: 1610
Merit: 1000


Crackpot Idealist


View Profile
May 12, 2013, 06:18:18 PM
 #20

I would also add that I have turned off live trading right now due to everything on btc-e taking a dump!

This post sums up why all this bullshit is a scam
Read It. Hate It. Change the facts that it represents.
https://bitcointalk.org/index.php?topic=1606638.msg16139644#msg16139644
Pages: [1] 2 3 4 5 »  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!