Bitcoin Forum

Economy => Trading Discussion => Topic started by: nomorecoin on May 07, 2013, 02:43:37 AM



Title: tAPI-bot - Automated crossover trade platform for BTC-e [INACTIVE 2013-10-15]
Post by: nomorecoin on May 07, 2013, 02:43:37 AM
I have decided to open source my trade "bot". It is written in Python 2.7, and uses Pylab (or matplotlib+numpy, confirmed (https://bitcointalk.org/index.php?topic=197526.msg2222467#msg2222467)) 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 (https://www.enthought.com/products/epd/free/), 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 (https://github.com/nomorecoin/tAPIbot/blob/master/tapi/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 (https://github.com/nomorecoin/tAPIbot/tree/master/tapi), 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.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: nomorecoin on May 07, 2013, 03:31:16 AM
TODO:
Add newer pairs
Verify key/secret pair are valid when starting commit (https://github.com/nomorecoin/tAPIbot/commit/678602a9158247bf37ea0f7a10f88a66beabb67e)
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


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: maverick1337 on May 07, 2013, 05:37:06 AM
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.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: maverick1337 on May 07, 2013, 05:42:50 AM
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.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: maverick1337 on May 07, 2013, 05:55:49 AM
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?


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 08, 2013, 07:41:22 PM
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?


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 09, 2013, 12:12:05 AM
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!)


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 09, 2013, 02:00:42 AM
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.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 09, 2013, 02:07:29 AM
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.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 09, 2013, 02:34:47 PM
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.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 09, 2013, 11:03:16 PM
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?


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: Jude Austin on May 11, 2013, 02:06:48 PM
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.



Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 11, 2013, 02:17:59 PM


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.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 11, 2013, 04:55:31 PM
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.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 11, 2013, 06:36:37 PM
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.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 11, 2013, 07:23:45 PM
Absolutely! The bot is already scraping the info from btc-e, you would just have to add a little more math to the bot.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: Jude Austin on May 12, 2013, 06:26:15 AM
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?


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: Jude Austin on May 12, 2013, 02:03:25 PM
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.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 12, 2013, 06:17:04 PM
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.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 12, 2013, 06:18:18 PM
I would also add that I have turned off live trading right now due to everything on btc-e taking a dump!


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: Jude Austin on May 13, 2013, 08:48:57 AM
I don't mean to be a pain in the butt but I would really like to see the OrdersList.

Perhaps you could take a look at how this guy pulls that information:

https://github.com/alanmcintyre/btce-api/blob/master/btceapi/trade.py

If you look on line 203, perhaps that would help get this situation, well, situated, lol.

Thanks for everything!


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: miningusa on May 13, 2013, 10:52:00 AM
There's a lot of bots floating around... any of them useful?


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: ewibit on May 15, 2013, 11:25:29 AM
I get nearly the same output
Code:
ERROR Key error in helper.processOrders: 'pair'
it is now running in simulation mode; - can I see something in log.log how the balance has changed but for not running in simulation mode? (I don't find anything)


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: aparadox on May 15, 2013, 06:28:32 PM
Thanks for the bot Nomorecoins

I'm glad I'm running it in sim mode until I find the some good settings because so far, regardless of my settings and with the low trading, I would be buying high and selling low.

I have an issue with the graph displaying some values. The graph itself shows up but not the lines when simulating ltc_btc trading. Any recommendation ?

I wish I knew how to code in Python to help you with this project. I guess I'll have to learn eventually ;)


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: yachtsman on May 16, 2013, 04:43:30 PM
I have installed matplotlib into python27, now when i run applicatoin.py i get "no module named numpy"  I have also installed the Numpy from scipy.org

Im at a loss now...


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: yachtsman on May 16, 2013, 06:43:27 PM
Never mind... i got it working now... pretty sweet bot if i say so.. i got it working through dos prompt..

Now time to tweak averages


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: aparadox on May 16, 2013, 07:17:15 PM
Thanks for the bot Nomorecoins

I'm glad I'm running it in sim mode until I find the some good settings because so far, regardless of my settings and with the low trading, I would be buying high and selling low.

I have an issue with the graph displaying some values. The graph itself shows up but not the lines when simulating ltc_btc trading. Any recommendation ?

I wish I knew how to code in Python to help you with this project. I guess I'll have to learn eventually ;)

How long (how many ticks) has the bot been running for?
Can you post a (resized) image?

I'll put it on my list to check this out, I haven't run against ltc_btc in quite a while. Edit: I can confirm this issue, appears to be due to scientific notation on the axes labels.

Edit #2 seems to be due to rounding in setting the y-axis limits. Change the following in trader.py (near the bottom of the file) if you would like to test:

Code:
ymax = round(ymax+(ymax*0.001),5)
and
Code:
ymin = round(ymin-(ymin*0.001),5)

I don't want to commit until I ensure this won't wonkify other pairs' charts.

Thanks, that made it work. It was a rounding issue. It had been ticking for over 1000 ticks based on 30 seconds between each tick. Now I'll be able to visualise what happens.

The setting could be dynamicly adjusted according to the trading price range


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: f6gau on May 16, 2013, 09:15:22 PM
hi,

i found your bot today and started it an hour ago.
the simulations seems to work either:
Code:
Simulated sell: btc_usd 108.119

my question (maybe silly):
how to see an overall win/loss?
Manually through the logs?

thanks :)


ps. if you need some testing data like logs etc. let me know


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: f6gau on May 17, 2013, 03:10:18 PM
Code:
2013-05-17 08:22:26,976 WARNING Attempted order below 0.1: -1e-05
2013-05-17 08:22:26,976 INFO Attempted buy: btc_usd 109.101 -1e-05
2013-05-17 08:22:26,976 INFO Order failed

-1e-05 --> what is this?

and also where to configure the minimum order (0.1) the bot is always trying to trade less...

thanks


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: f6gau on May 18, 2013, 11:14:59 AM
Code:
2013-05-17 08:22:26,976 WARNING Attempted order below 0.1: -1e-05
2013-05-17 08:22:26,976 INFO Attempted buy: btc_usd 109.101 -1e-05
2013-05-17 08:22:26,976 INFO Order failed

-1e-05 --> what is this?

and also where to configure the minimum order (0.1) the bot is always trying to trade less...

thanks

ok the issue with the minimum order is clear now ... trader.py
but i always get these "wrong" values like above.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 18, 2013, 01:07:16 PM
What kind of finances are you giving the bot to play with?

I have not tried btc_usd but I have not had that error thrown with ltc_btc, ltc_usd, ppc_btc and had 10+ coins/$ in my accounts before starting the bot for testing.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: f6gau on May 19, 2013, 08:23:29 PM
is it possible - for the bot - to remember the price btc was bought? i often see buy at 113.615$ and shortly after sell for 113.568$.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: Mogumodz on May 21, 2013, 12:57:47 PM
Just started it up in sim mode.

Had to install matplotlib and numpy to get it running.

Graph is updating nicely, Lets see what this can do.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: davider on May 21, 2013, 04:19:14 PM
Do you plan to implement also Exponential Moving Average as a signal type?


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: ewibit on May 21, 2013, 06:57:36 PM
I try it now without sim mode with little money
Code:
/usr/lib/pymodules/python2.7/matplotlib/axes.py:2667: UserWarning: Attempting to set identical bottom==top results
in singular transformations; automatically expanding.
bottom=0.0, top=0.0
  + 'bottom=%s, top=%s') % (bottom, top))
what does this mean?
TIA


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 22, 2013, 03:05:16 AM
I have to baby sit it or else I come back to it buying high and selling low at times... that and I am a cheapskate even when it comes to testing.

Fees are an issue. Seems like the bot plays the margins too close for profitability most of the time, unless there is some good movement in the market. I have caught it making some good trades though and it seems that different trading pairs work better with different signals but I've set my sights on just ltc_usd for tweaking.

Another interesting realization I had the other day is no matter how good this bot might work, there are much meaner things lurking on btc-e... which is a fun catalyst by itself. The glory of the internet.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: Mogumodz on May 22, 2013, 03:44:51 AM
http://anony.ws/i/2013/05/22/NjvmR.png

I can see a few times when the streams look like they have predicted a few good trends (mostly late). This is just with standard settings on sim mode to see what it did over a few hours.

Going to somehow tally up all the buy an sell data and see what I would be left with. Left it running a long enough time I thought.

I wonder if the data could be exported to CSV or another format so a script or macro could tally up and down the values.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: nullbitspectre1848 on May 22, 2013, 02:37:05 PM
Is there a guide somewhere that defines the types of signals and what the values mean etc. (don't know how to adjust the signals if I don't know what the values mean)?  I'm rather new to these sorts of things, any help or starting point would be most appreciated.  Also, where does the graph output to?


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 22, 2013, 02:43:47 PM
I have to baby sit it or else I come back to it buying high and selling low at times... that and I am a cheapskate even when it comes to testing.

Fees are an issue. Seems like the bot plays the margins too close for profitability most of the time, unless there is some good movement in the market. I have caught it making some good trades though and it seems that different trading pairs work better with different signals but I've set my sights on just ltc_usd for tweaking.

Another interesting realization I had the other day is no matter how good this bot might work, there are much meaner things lurking on btc-e... which is a fun catalyst by itself. The glory of the internet.

There is no magic bullet for all pairs, nor all days. You have to adapt your signal settings to make any profit. Volatility is your friend.

HA! You can say that again!

Still, I wish I kept better records of performance. I'm thinking it makes profit about 50-75% of the time which I do not think is bad since I'm not even a ranked amature when it comes to proper trading strategy... I just know how to read!


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 22, 2013, 08:47:28 PM
Is there a guide somewhere that defines the types of signals and what the values mean etc. (don't know how to adjust the signals if I don't know what the values mean)?  I'm rather new to these sorts of things, any help or starting point would be most appreciated.  Also, where does the graph output to?

Some quick internet searching on the moving average types and single types will give you a mind blowing amount of info.

Graph has to be enabled in the settings.ini and prerequisites met. Graph exports to ~/tapi/graph.png

Best advice, run it in sim mode until you feel comfortable with the settings.ini and the settings within.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 22, 2013, 08:50:18 PM

I'm thinking of ways to implement a minimum volatility trade "pause". When the trends are smaller than a round trip trade, we're guaranteed to lose. The bot could check the high/low gap over a certain range, and decide whether or not to try trading. Thoughts?

YES! That is exactly what I think is needed. Is it possible? This is pretty much what I do when I say baby sitting. If there is not enough action in my pair of interest, I just shut to bot down for a bit and wait. If this could be done automatically with variables, you might be on to something.

Further develop that thought... include multiple trade pairs and have the bought 'shop around' so to speak for the most volatility with the available currencies in your account?


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: sla73 on May 23, 2013, 11:24:34 AM
Here's a quick run-down of my trading for today. I let the bot run against ltc_btc with a small amount.

Set ribbon, start 49, spacing 50, for MA lines at 49, 99, and 149.


Hi nomorecoin, I am enjoying playing around with this bot, many thanks for your hard work.. Once question how does the above setup, look in the settings.ini file?

Cheers..

P.S I get frequent crashes ...RuntimeError: dictionary changed size during iteration?


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: ewibit on May 23, 2013, 02:16:00 PM
hi
Code:
# Enter single pair to trade and generate signals, eg: btc_usd 
pair = ltc_btc
is it only possible to run a single pair to trade or more at one time (if not, is it possible to run multiple instances with same API keys?)


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 23, 2013, 08:04:11 PM

Best advice, run it in sim mode until you feel comfortable with the settings.ini and the settings within.

This, for now. In testing, you want to configure the signals such that a "crossover" happens as near to peaks and troughs as possible.

It's unlikely that many will share successful setups in the future, but you can do some reading on crossover trading and moving averages. Be aware: conventional wisdom on these signals may not apply, or may be skewed, as the period used to calculate is individual trades, not days.

Oh boy you can say that again. I went into playing with this bot thinking I knew a thing about a thing or two but I sure the hell was dead wrong.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: sla73 on May 24, 2013, 09:05:32 AM

Hi nomorecoin, I am enjoying playing around with this bot, many thanks for your hard work.. Once question how does the above setup, look in the settings.ini file?

Cheers..

P.S I get frequent crashes ...RuntimeError: dictionary changed size during iteration?

Can you post the stack trace and relevant system info? That's a new one.

Sure here you go http://110.174.141.187/stacktrace.txt (http://110.174.141.187/stacktrace.txt)


Oh and running Win 7 64 bit (Prem) with Canopy.. 

Cheers sla73


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: ewibit on May 24, 2013, 12:40:53 PM
Recommend separate accounts for anything sharing a base currency in the pairs traded. Multiple instances will not cause an issue, but each instance will attempt to sell/buy with all available currency it sees.
I have tried it with multiple instances (in different directories and different ini's), but:
Code:
Traceback (most recent call last):
  File "Application.py", line 40, in <module>
    runLoop()
  File "Application.py", line 23, in runLoop
    trader.update()
  File "/home/xxx/tAPIbot/tapi_TRC/trader.py", line 62, in update
    self.tradeData = self.tapi.update()
  File "/home/xxx/tAPIbot/tapi_TRC/api.py", line 24, in update
    self.tradeData['funds'] = output['funds']
TypeError: 'NoneType' object has no attribute '__getitem__'
seems no go..


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: sla73 on May 27, 2013, 06:19:48 AM

Hi nomorecoin, I am enjoying playing around with this bot, many thanks for your hard work.. One question how does the above setup, look in the settings.ini file?

Cheers..

P.S I get frequent crashes ...RuntimeError: dictionary changed size during iteration?

Can you post the stack trace and relevant system info? That's a new one.

Sure here you go http://110.174.141.187/stacktrace.txt (http://110.174.141.187/stacktrace.txt)


Oh and running Win 7 64 bit (Prem) with Canopy.. 

Cheers sla73



Hi nomorcoin, am still having trouble trying to set up the [signals] section in settings.ini file for ribbon

could you please post an example?

cheers sla73


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 27, 2013, 12:23:12 PM
Trouble as in the bot is not making trades? Or the bot is making trades that are not making you money?



Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: sla73 on May 27, 2013, 12:30:51 PM
Hi,
as in i can't figure out how to put the settings in the ini file.. where/ how do i put in the other 3 MA values?

if i want to Set ribbon, start 49, spacing 50, and the MA lines at 49, 99, and 149.

do i put them in

MAtype = 49, 99, and 149 <- like this or 49 99 149 ?


I have this set like below

# Ribbon:
# Note: ribbonStart + (3*ribbonSpacing) MUST BE < 150!
# This is because the platform only looks at last 150 trades (max returned by API)
ribbonStart = 49
ribbonSpacing = 50


thanks..


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 27, 2013, 12:37:32 PM
Code:
# Ribbon:
# Note: ribbonStart + (3*ribbonSpacing) MUST BE < 150!
# This is because the platform only looks at last 150 trades (max returned by API)
ribbonStart = 49
ribbonSpacing = 50

This is correct. Start is 49. Spacing is 50. 49 + 50 = 99. 99 + 50 = 149

This logic is here:

Code:
# Note: ribbonStart + (3*ribbonSpacing) MUST BE < 150!


Hope this helps.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: sla73 on May 27, 2013, 12:39:36 PM
yep.. got it now many thanks.. doh! ::)


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 27, 2013, 12:51:08 PM
Good deal. Happy trading!


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: alexxy on May 29, 2013, 08:52:52 AM
nomorecoin can you add trading fee in accounting? your bot works fine except that!

PS also why are you using your custom btceapi port? there is maintained version https://github.com/alanmcintyre/btce-api


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: nullbitspectre1848 on May 29, 2013, 10:53:39 AM
So I've run this for a couple days with different settings, but I seem to pretty much get the same result.  It appears that I am buying low and selling high, but I am perpetually taking slow but gradual loss.  Is anyone actually making anything using this bot, or is everyone pretty much running into the same thing (as per previous messages in this thread)?
 

PS:  thanks for making this available to everyone :)


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: alexxy on May 29, 2013, 12:44:04 PM
You get some loss because this bot doesnt take fee into account. So for example you're buy low and sell high but the difference is ~0.1% and trading fee is 0.2% so you get loss ~0.2% per iteration.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: nullbitspectre1848 on May 29, 2013, 02:35:53 PM
You get some loss because this bot doesnt take fee into account. So for example you're buy low and sell high but the difference is ~0.1% and trading fee is 0.2% so you get loss ~0.2% per iteration.

Yes that seems to be what is happening.  Looks like it may read the trends/signals/MAs ok, but since it doesn't include a minimum trade threshold, loss is all you will get unless there are larger fluctuations.  I suppose one could insulate against that by making the refresh period much longer than 60 seconds, however, that would only really be a shot in the dark, hoping that over the cycle period a larger fluctuation has occured.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on May 29, 2013, 05:08:11 PM
So I've run this for a couple days with different settings, but I seem to pretty much get the same result.  It appears that I am buying low and selling high, but I am perpetually taking slow but gradual loss.  Is anyone actually making anything using this bot, or is everyone pretty much running into the same thing (as per previous messages in this thread)?
 

PS:  thanks for making this available to everyone :)

The fee's kill ya. Stagnant markets kill ya. This is not the easiest bot in the world to work with but has made me some bitchin trades... and then lost the profit through fee's on the following trades. I do not run this bot unattended. As quite as nomorecoin has been I would assume that he is messing with the code as we speak.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: telemaco on May 30, 2013, 08:33:35 AM
Hello,

Maybe you can add on settings.ini something like this:

Code:
ThresholdBuy = 0.02
ThresholdSell= 0.02

and on trader.py

Code:
        if signalType == 'dual':
            # lines cross each other = trade signal
            if self.signals.fastMA.value > self.signals.slowMA.value*(1+self.ThresBuy):
                print'Market trending up'
                self.log.info('Market trending up')
                #investigate
                #if self.shortPosition:
                self.placeBid()
            elif self.signals.fastMA.value*(1-self.ThresSell) < self.signals.slowMA.value:
                print'Market trending down'
                self.log.info('Market trending down')
                if not self.shortPosition:
                    self.placeAsk()

Cheers,



Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: ewibit on June 10, 2013, 04:42:09 PM
Hello,

Maybe you can add on settings.ini something like this:
.
.
.
and what does this produce?
TIA


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: drwho88888 on June 12, 2013, 09:41:13 PM
Does EMA trading work profitably ? I think not. People have been trying to crack this in fx for years and I doubt anyone makes any money longterm. Obviously there are winners short term but really, if its was this easy we'd all be millionaires.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: ironstove on June 14, 2013, 05:01:49 AM
Hi, great that you've implemented a bot for BTC-e, I'll start helping with the testing/debugging... Looks like fun.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: ewibit on June 18, 2013, 03:58:22 PM
Hi nomorecoin
is it not possible to run multiple instances with multiple currencies?
I get always
Code:
Traceback (most recent call last):
  File "Application.py", line 40, in <module>
    runLoop()
  File "Application.py", line 23, in runLoop
    trader.update()
  File "/home/ewi/Downloads/tAPIbot/LTC_USD_tapi/trader.py", line 62, in update
    self.tradeData = self.tapi.update()
  File "/home/ewi/Downloads/tAPIbot/LTC_USD_tapi/api.py", line 24, in update
    self.tradeData['funds'] = output['funds']
TypeError: 'NoneType' object has no attribute '__getitem__'
or is there another problem the reason for this?
TIA


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: erk on June 19, 2013, 12:11:48 AM
Can this bot be run in the command line in a text mode,  or does is require a GUI? eg. x11 on Ubuntu.

I am planning on using a headless Ubuntu server with no mouse, monitor, keyboard.

When I try and run it I get an error as if it want's X11

Code:
 File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1712, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on June 19, 2013, 12:47:17 AM
Hi nomorecoin
is it not possible to run multiple instances with multiple currencies?
I get always
Code:
Traceback (most recent call last):
  File "Application.py", line 40, in <module>
    runLoop()
  File "Application.py", line 23, in runLoop
    trader.update()
  File "/home/ewi/Downloads/tAPIbot/LTC_USD_tapi/trader.py", line 62, in update
    self.tradeData = self.tapi.update()
  File "/home/ewi/Downloads/tAPIbot/LTC_USD_tapi/api.py", line 24, in update
    self.tradeData['funds'] = output['funds']
TypeError: 'NoneType' object has no attribute '__getitem__'
or is there another problem the reason for this?
TIA

It's mentioned some where in here that he recommends use a separate account per instance. This was cited as a precaution of over buying/selling a shared currency. The advice might also apply to your situation. It would be easy enough to test at least.

Can this bot be run in the command line in a text mode,  or does is require a GUI? eg. x11 on Ubuntu.

I am planning on using a headless Ubuntu server with no mouse, monitor, keyboard.

When I try and run it I get an error as if it want's X11

Code:
 File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1712, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

It does not look like it. Might be worth a pm to the author (have not seen him on this thread in a while)


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: sal002 on July 07, 2013, 08:18:32 PM
Hello,

Maybe you can add on settings.ini something like this:

Code:
ThresholdBuy = 0.02
ThresholdSell= 0.02

and on trader.py

Code:
        if signalType == 'dual':
            # lines cross each other = trade signal
            if self.signals.fastMA.value > self.signals.slowMA.value*(1+self.ThresBuy):
                print'Market trending up'
                self.log.info('Market trending up')
                #investigate
                #if self.shortPosition:
                self.placeBid()
            elif self.signals.fastMA.value*(1-self.ThresSell) < self.signals.slowMA.value:
                print'Market trending down'
                self.log.info('Market trending down')
                if not self.shortPosition:
                    self.placeAsk()

Cheers,



There is a fee setting in the ini - maybe someone could come up with some code to implement it?


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: ewibit on July 09, 2013, 11:54:23 AM
feedback:
now I have run the bot for ~2 weeks with the default options
start was with
USD:  0.00
BTC:  1.00
now after xxx trades result is:

Code:
Available Balances:
USD: 0.02570973
BTC: 0.96450296
means, that there has to be some options to change
but which?
 ;)


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: syphen on July 29, 2013, 05:49:53 AM
I keep getting error parsing trades error when I run application.py


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: piotars_kbw on July 29, 2013, 09:10:37 PM
Since yesterday, I have the same problem. It just stop working: (
The configuration has not been changed, the software also unchanged.


EDIT:

Already running, it looks like it's a problem with btc-e api.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: daybyter on September 11, 2013, 11:56:52 AM

No promises, but I'll try to set aside some time to make a few changes.

Edit: if you got the generic "Error parsing trades", that is likely the API failing to respond. I didn't/don't have great exception handling going on.

Check the HTTP response code. It's most likely 504 with some HTML from cloudflare, or so...


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: ewibit on September 11, 2013, 02:47:54 PM
Code:
Traceback (most recent call last):
  File "Application.py", line 57, in <module>
    runLoop()
  File "Application.py", line 33, in runLoop
    trader.update()
  File "/home/xxx/xx/trader.py", line 113, in update
    self.evalOrder()
  File "/home/xxx/xx/trader.py", line 177, in evalOrder
    self.placeAsk()
  File "/home/xxx/xx/
line 256, in placeAsk
    order = self.placeOrder('sell',rate,amount)
NameError: global name 'amount' is not defined


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: ewibit on September 13, 2013, 10:40:21 AM
thx
but now I get always
Code:
Order returned error:/n You incorrectly entered one of fields.
which field?


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: jago25_98 on September 13, 2013, 01:37:06 PM
Am I right in thinking that EMA is the only (reliable) bot method for btc?


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: daybyter on September 13, 2013, 04:57:48 PM
Arb is better methinks?


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: ewibit on September 16, 2013, 08:07:04 PM
Edit: if you'd like to do some testing, uncomment either or both of the following from tapi/trader.py:

Code:
         
#amount = round((balance/rate),3)
Code:
    
#amount = amount - 0.00001


I have uncommented both an get the same again
Code:
Volatility is 1.86%
Market trending up
Order returned error:/n You incorrectly entered one of fields.
Signal Spread: 0.73%


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: MCT on September 26, 2013, 05:13:51 PM
Nice piece of code BUT you really have to fetch candles via bitcoincharts api. The last 150 trades are just a too small timeframe to build MAs on. I tried several options but only loosing money due to wrong signals.

Please consider at least to download the last ~100 hours of tradedata from the bitcoincharts api and calculate hourly close prices.

Then we could use crossing averages strategies on those pseudocandles.




Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: ewibit on September 26, 2013, 05:41:42 PM
I tried several options but only loosing money due to wrong signals.
for me the same..


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: billotronic on September 27, 2013, 04:19:35 PM
Nice piece of code BUT you really have to fetch candles via bitcoincharts api. The last 150 trades are just a too small timeframe to build MAs on. I tried several options but only loosing money due to wrong signals.

Please consider at least to download the last ~100 hours of tradedata from the bitcoincharts api and calculate hourly close prices.

Then we could use crossing averages strategies on those pseudocandles.


The program is open source. Feel free to make changes. I've long wanted to properly abstract the API portion, but haven't found the time to do so. I will add this to my possible todo list though.


Nice to see you working on this again bud!


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: MCT on October 02, 2013, 10:48:31 AM
Anyone else has problems with placing orders on btc_usd?

Sometimes it just does nothing when it says market trending up and sometimes it says not enough usd.


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: dna2 on October 11, 2013, 09:34:49 PM
If anyone is testing this with PPC_BTC, add the following in trader.py:

def getPip(self):
        '''provides correct minimum pip for orders, BTC-e specific'''
        pair = self.config.pair
        if 'ltc' in pair or 'nmc' in pair or 'ppc' in pair:
            return 0.00001
        else:
            return 0.001


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: ravagetheearth on October 19, 2013, 04:12:51 AM
Edited thread title to inactive. Other projects have been consuming my time.

That saddens me   :-[

Good luck with your other projects though  ;)


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: ravagetheearth on October 20, 2013, 06:35:25 AM
Edited thread title to inactive. Other projects have been consuming my time.

That saddens me   :-[

Good luck with your other projects though  ;)

Thank you. I won't say the project is dead, I may revisit when I have the time to test and tune.

That would be great!! I'm currently learning python just so I can tweak this. Thanks for the code :) Looks like you put a decent amount of time into this!


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e
Post by: ravagetheearth on October 22, 2013, 02:35:12 PM
Edited thread title to inactive. Other projects have been consuming my time.

That saddens me   :-[

Good luck with your other projects though  ;)

Thank you. I won't say the project is dead, I may revisit when I have the time to test and tune.

That would be great!! I'm currently learning python just so I can tweak this. Thanks for the code :) Looks like you put a decent amount of time into this!

A lot of time... I wrote this as a way of writing functional code I was interested in while learning Python basics myself.

A word of warning; most of the code is extremely amateur, and does not follow best practices. Frankly, it's a mess. There are many areas for improvement.

Best of luck! As others have stated, the biggest area of functional improvement is a better source of ticker data.

Thanks for the tip! I'm a first year networking student and have almost no experience with coding. I am basically learning from the ground up. Someone I know who trades 100's of BTC used this bot as a shell for the one that he wrote and he recommended this one to me. I can't even get this to run  ::) I'll get a hang of it though. I hope you don't mind if I message you every once in a while to ask you a question about it :)


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e [INACTIVE 2013-10-15]
Post by: DobZombie on October 25, 2013, 01:39:51 PM
I'm getting this A LOT.  I think it only happens when it attempts to make a buy. bot was working pretty good until this started happening...

Code:
Volatility is 0.84%
Market trending up
Traceback (most recent call last):
  File "application.py", line 57, in <module>
    runLoop()
  File "application.py", line 33, in runLoop
    trader.update()
  File "C:\tAPIbot-master\tapi\trader.py", line 113, in update
    self.evalOrder()
  File "C:\tAPIbot-master\tapi\trader.py", line 172, in evalOrder
    self.placeBid()
  File "C:\tAPIbot-master\tapi\trader.py", line 216, in placeBid
    amount = balance/rate
TypeError: unsupported operand type(s) for /: 'float' and 'NoneType'


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e [INACTIVE 2013-10-15]
Post by: DobZombie on October 26, 2013, 12:58:03 PM
I've figured out it's directly related to changing...
Code:
min_volatility = 1.0
# Min volatility sleep: time in seconds to sleep between min volatility checks when volatility is below threshold
volatility_sleep = 120
to
Code:
min_volatility = 0.8
# Min volatility sleep: time in seconds to sleep between min volatility checks when volatility is below threshold
volatility_sleep = 90

Is it possible that increasing the amount of times that the api is checked can induce an response that confounds the bot?


Title: Re: tAPI-bot - Automated crossover trade platform for BTC-e [INACTIVE 2013-10-15]
Post by: xhabit on November 03, 2013, 10:51:19 AM
I'like this bot really!!!! I'hope you will find time to tune the bot ... for giving profit ...