Author

Topic: tAPI-bot - Automated crossover trade platform for BTC-e [INACTIVE 2013-10-15] (Read 36360 times)

full member
Activity: 209
Merit: 100
I'like this bot really!!!! I'hope you will find time to tune the bot ... for giving profit ...
hero member
Activity: 896
Merit: 532
Former curator of The Bitcoin Museum
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?
hero member
Activity: 896
Merit: 532
Former curator of The Bitcoin Museum
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
    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'
newbie
Activity: 27
Merit: 0
Edited thread title to inactive. Other projects have been consuming my time.

That saddens me   Embarrassed

Good luck with your other projects though  Wink

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 Smiley 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  Roll Eyes 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 Smiley
newbie
Activity: 27
Merit: 0
Edited thread title to inactive. Other projects have been consuming my time.

That saddens me   Embarrassed

Good luck with your other projects though  Wink

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 Smiley Looks like you put a decent amount of time into this!
newbie
Activity: 27
Merit: 0
Edited thread title to inactive. Other projects have been consuming my time.

That saddens me   Embarrassed

Good luck with your other projects though  Wink
newbie
Activity: 33
Merit: 0
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
MCT
newbie
Activity: 6
Merit: 0
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.
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
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!
legendary
Activity: 2955
Merit: 1049
I tried several options but only loosing money due to wrong signals.
for me the same..
MCT
newbie
Activity: 6
Merit: 0
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.


legendary
Activity: 2955
Merit: 1049
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%
legendary
Activity: 965
Merit: 1000
Arb is better methinks?
hero member
Activity: 900
Merit: 1000
Crypto Geek
Am I right in thinking that EMA is the only (reliable) bot method for btc?
legendary
Activity: 2955
Merit: 1049
thx
but now I get always
Code:
Order returned error:/n You incorrectly entered one of fields.
which field?
legendary
Activity: 2955
Merit: 1049
Code:
Traceback (most recent call last):
  File "Application.py", line 57, in
    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
legendary
Activity: 965
Merit: 1000

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...
newbie
Activity: 5
Merit: 0
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.
member
Activity: 102
Merit: 10
I keep getting error parsing trades error when I run application.py
legendary
Activity: 2955
Merit: 1049
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?
 Wink
hero member
Activity: 490
Merit: 500
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?
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
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
    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)
erk
hero member
Activity: 826
Merit: 500
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
legendary
Activity: 2955
Merit: 1049
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
    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
member
Activity: 111
Merit: 10
Possibilities are limitless
Hi, great that you've implemented a bot for BTC-e, I'll start helping with the testing/debugging... Looks like fun.
member
Activity: 70
Merit: 10
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.
legendary
Activity: 2955
Merit: 1049
Hello,

Maybe you can add on settings.ini something like this:
.
.
.
and what does this produce?
TIA
sr. member
Activity: 371
Merit: 250
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,

legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
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 Smiley

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.
full member
Activity: 141
Merit: 100
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.
sr. member
Activity: 363
Merit: 250
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.
full member
Activity: 141
Merit: 100
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 Smiley
sr. member
Activity: 363
Merit: 250
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
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
newbie
Activity: 27
Merit: 0
yep.. got it now many thanks.. doh! Roll Eyes
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
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.
newbie
Activity: 27
Merit: 0
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..
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
Trouble as in the bot is not making trades? Or the bot is making trades that are not making you money?

newbie
Activity: 27
Merit: 0

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


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
legendary
Activity: 2955
Merit: 1049
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
    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..
newbie
Activity: 27
Merit: 0

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


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

Cheers sla73
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist

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.
legendary
Activity: 2955
Merit: 1049
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?)
newbie
Activity: 27
Merit: 0
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?
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist

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?
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
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.
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
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!
full member
Activity: 141
Merit: 100
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?
sr. member
Activity: 290
Merit: 250


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.
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
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.
legendary
Activity: 2955
Merit: 1049
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
member
Activity: 72
Merit: 10
Do you plan to implement also Exponential Moving Average as a signal type?
sr. member
Activity: 290
Merit: 250
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.
newbie
Activity: 13
Merit: 0
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$.
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
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.
newbie
Activity: 13
Merit: 0
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.
newbie
Activity: 13
Merit: 0
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
newbie
Activity: 13
Merit: 0
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 Smiley


ps. if you need some testing data like logs etc. let me know
newbie
Activity: 10
Merit: 0
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 Wink

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
newbie
Activity: 51
Merit: 0
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
newbie
Activity: 51
Merit: 0
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...
newbie
Activity: 10
Merit: 0
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 Wink
legendary
Activity: 2955
Merit: 1049
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)
member
Activity: 98
Merit: 10
There's a lot of bots floating around... any of them useful?
legendary
Activity: 1140
Merit: 1000
The Real Jude Austin
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!
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
I would also add that I have turned off live trading right now due to everything on btc-e taking a dump!
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
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.
legendary
Activity: 1140
Merit: 1000
The Real Jude Austin
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.
legendary
Activity: 1140
Merit: 1000
The Real Jude Austin
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?
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
Absolutely! The bot is already scraping the info from btc-e, you would just have to add a little more math to the bot.
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
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.
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
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.
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist


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.
legendary
Activity: 1140
Merit: 1000
The Real Jude Austin
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.

legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
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?
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
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
    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.
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
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.
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
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.
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
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!)
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
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?
newbie
Activity: 40
Merit: 0
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?
newbie
Activity: 40
Merit: 0
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.
newbie
Activity: 40
Merit: 0
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.
newbie
Activity: 16
Merit: 0
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
newbie
Activity: 16
Merit: 0
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.
Jump to: