Author

Topic: Trading Bots (Read 13015 times)

legendary
Activity: 1904
Merit: 1002
May 11, 2013, 01:13:49 PM
#84
what do I need to run it? (on linux)

ruby (it was developed with 1.9, so 1.8 may or may not work)
Code:
gem install bundler
cd rubybot
bundle install
ruby bot.rb
legendary
Activity: 1183
Merit: 1000
May 11, 2013, 12:40:22 PM
#83
If anyone is in need of a professionally built, continuously upgraded, free support included bot, please see here:

https://bitcointalksearch.org/topic/closed-butter-bot-premier-bitstamp-and-btc-e-ema-trading-platform-closed-197175
full member
Activity: 350
Merit: 100
April 15, 2013, 03:56:01 PM
#82
I've written a somewhat simple swing bot in VB6. It finds relatively (by a formula) large bid/ask walls in illiquid markets, sets big or small walls in front of them depending on at-market buy/sell activity, maintains them and profits from the spread (generally 2-4% per hour after fees)

That said I've been coding VB6 since it came out. With NO coding experience, I'd say you best get used to the Mt Gox webpage.

goddamnit why do people bump year-old threads
newbie
Activity: 18
Merit: 0
April 15, 2013, 03:02:59 PM
#81
Code:
$i=0;
    foreach ($decoded_t as $a) {
    if((($i>0) && ($ttype != $a['trade_type'])) || (($i>0) &&(($curtime - $a['date']) > (60*15))))

Neither of these conditions will ever resolve to true.
newbie
Activity: 38
Merit: 0
April 15, 2013, 02:58:38 PM
#80
what do I need to run it? (on linux)
legendary
Activity: 1904
Merit: 1002
April 15, 2013, 01:40:12 PM
#79
I just dusted off my bot since the recent top to help add liquidity.  I've published it here:

https://github.com/yrral86/rubybot

It's very rough at the moment (any previous comments made in this thread by me about my bot apply), but hopefully in a few weeks I'll have some time to spend cleaning things up and making it more robust.  Then I can give it some real money.

It's happily running right now, just with tiny orders.
newbie
Activity: 38
Merit: 0
April 15, 2013, 12:42:30 PM
#78
is this still alive? anyone running the bot? sounds promising, ...
sr. member
Activity: 420
Merit: 250
bool eval(bool b){return b ? b==true : b==false;}
April 15, 2012, 12:38:55 PM
#77
Thank you very much, friends!
You ´re welcome, plus this might help increasing your coding skills.

What is that
Code:
    $newrate = $total / $qty;
    if($newrate > 0){
      return $newrate;
    }else{
      return false;
    }
meant to do?
 ... uhm where is the Candid Camera?
hero member
Activity: 616
Merit: 502
April 14, 2012, 11:16:18 AM
#76
Thank you very much, friends! I will send this thread to administrator! Maybe this will solve the problem! ( at pool http://pool.mkalinin.ru the ability to use a bot).
sr. member
Activity: 420
Merit: 250
bool eval(bool b){return b ? b==true : b==false;}
April 13, 2012, 01:16:08 PM
#75
Please help me find a bug in the code. (PHP) The calculation of the average rate for the last transaction (bot). He should ignore history, which more than 15 minutes. But the error - consider history. (sorry for the translation)

$curtime is set to 0 and never to the current time, so ($curtime - $a['date']) is negative and never > (60*15).

add:

$curtime = time();



Could it be that ($curtime == 0) implies (i==0).
So the real killer is to wait for a 15 min pause in transactions.
Provided I got it right.
sr. member
Activity: 420
Merit: 250
bool eval(bool b){return b ? b==true : b==false;}
April 13, 2012, 01:10:14 PM
#74
Code:
Function midrate($key, $secret){
...
    if((($i>0) && ($ttype != $a['trade_type'])) || (($i>0) &&(($curtime - $a['date']) > (60*15)))){
      break;
    }

Looks broken to my eyes before even thinking about it.
Guys please keep coding simple and straight forward.
Comments are allowed and considered to be a polite move.

What is $i>0 good for? How about a proper init before looping?

Code:
$curtime = $a['date'];
guess where I found that ... what will it do in the breaking if?


legendary
Activity: 826
Merit: 1001
rippleFanatic
April 13, 2012, 01:02:23 PM
#73
Please help me find a bug in the code. (PHP) The calculation of the average rate for the last transaction (bot). He should ignore history, which more than 15 minutes. But the error - consider history. (sorry for the translation)

$curtime is set to 0 and never to the current time, so ($curtime - $a['date']) is negative and never > (60*15).

add:

$curtime = time();

hero member
Activity: 616
Merit: 502
April 13, 2012, 08:27:28 AM
#72
Please help me find a bug in the code. (PHP) The calculation of the average rate for the last transaction (bot). He should ignore history, which more than 15 minutes. But the error - consider history. (sorry for the translation)
Code:
Function midrate($key, $secret){
$curtime = 0;
$ttype = "x";
$total = 0;
$qty = 0;
$decoded_t1=(mtgox_query($key, $secret, '1/generic/private/trades'));
  $decoded_t = array_reverse($decoded_t1['return']);
  $i=0;
    foreach ($decoded_t as $a) {
    if((($i>0) && ($ttype != $a['trade_type'])) || (($i>0) &&(($curtime - $a['date']) > (60*15)))){
      break;
    }
      if ($a['trade_type']=="bid"){
        //$stype = "Sale";
       $ttype = "bid";
       $curtime = $a['date'];
       $total += ($a['amount'] * $a['price']);
       $qty += $a['amount'];
      }else{
        if($a['trade_type']=="ask"){
       // $stype = "Buy";
        $ttype = "ask";
        $curtime = $a['date'];
        $total += ($a['amount'] * $a['price']);
        $qty += $a['amount'];
        }
      }
    ++$i;
    }
    $newrate = $total / $qty;
    if($newrate > 0){
      return $newrate;
    }else{
      return false;
    }
 }
//-------------------------------------
legendary
Activity: 1493
Merit: 1003
mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
April 11, 2012, 08:52:39 AM
#70
if you want ~3weeks of time,buy,sell logs for running sims send me a PM Smiley

Meh... I can pull all the data from bitcoincharts.com in a few minutes, but thanks anyway

you think you can Tongue, but the reality is it is nowhere near as granular Wink

I suppose if your not worried about high frequency trading then its not an issue.

yes to perl, the sysadmins friend Smiley .

I use some basic trend prediction atm I have pulled straight from wikipedia and implemented in perl.
Most of the current work is going into automating sims so I can belt out all the variances (algo's, margins & trend prediction) and have the app tell me which one is the best.

Mine is setup to be completely automated, you will just select a set of parameters (trading style, target margin profit for each trade) and be able to view remotely via a cgi web interface. It will have the option to force sell, pause, margin adjust and cashout.

Once Im happy with the code I will gpl it.
donator
Activity: 848
Merit: 1078
April 11, 2012, 08:13:33 AM
#69
Aah I see notme, thanks for sharing.

Anyway, I had a look around and found this: http://finasystem.sourceforge.net/

Its a PHP library written for 50 of the most popular technical indicators. The project has not been updated in a very long time (dates back to 2006) but it looks pretty comprehensive. I'm going to have a play with these and I'll report back with how it performs.

I found one that is current called TA-Lib however thats only in C/C++, Java, Perl, Python: http://ta-lib.org/ if anyones interested.

In the mean time, if anyone finds a more current open-source project for technical indicators in PHP, let us know.
legendary
Activity: 1904
Merit: 1002
April 11, 2012, 02:24:05 AM
#68
indeed, atm it is live and in operation but only with a tiny amount of BTC.

My algorithm is to basic atm, but I have all the structure there. Currently Im working on making the trading algo modular so I can run simulations on multiple algo's.

Mine just plays the spread with stop orders at medium-term technical support and resistance.  When we move big, my stop makes sure I catch most of the move with enough of my capital.  Then, it goes back to liquidity-bot mode and I adjust the stops.  I haven't really backtested it, but it has a decent amount of live testing with small amounts.

What languages are you guys using with your trading algos? I'm using PHP in mine but it lacks some of the statistical analysis tools that I need for trading the basic technical indicators.

Mine is ruby... I'm not really using stat tools as I adjust the stops manually, but I'm sure there are some good packages out there for ruby.

Since mem's is called bitperl.pl, I'm going to guess it's in Perl, the Pathologically Eclectic Rubbish Lister.

Hey notme, forgive me if i'm being naive but surely you must do some kind of price analysis to form your strategy. Does it read off day high/lows to establish your spread? Does it enter/exit positions?

I manually adjust the spread as conditions change.  It is very much not a set it and forget it type of bot.  It maintains orders above and below the current price at double my spread. When an order is hit, the opposite order is placed at the spread.  It has some escape conditions based on past experiences of getting caught heavily against the trend, as well as stop loss orders.
donator
Activity: 848
Merit: 1078
April 11, 2012, 01:26:54 AM
#67
indeed, atm it is live and in operation but only with a tiny amount of BTC.

My algorithm is to basic atm, but I have all the structure there. Currently Im working on making the trading algo modular so I can run simulations on multiple algo's.

Mine just plays the spread with stop orders at medium-term technical support and resistance.  When we move big, my stop makes sure I catch most of the move with enough of my capital.  Then, it goes back to liquidity-bot mode and I adjust the stops.  I haven't really backtested it, but it has a decent amount of live testing with small amounts.

What languages are you guys using with your trading algos? I'm using PHP in mine but it lacks some of the statistical analysis tools that I need for trading the basic technical indicators.

Mine is ruby... I'm not really using stat tools as I adjust the stops manually, but I'm sure there are some good packages out there for ruby.

Since mem's is called bitperl.pl, I'm going to guess it's in Perl, the Pathologically Eclectic Rubbish Lister.

Hey notme, forgive me if i'm being naive but surely you must do some kind of price analysis to form your strategy. Does it read off day high/lows to establish your spread? Does it enter/exit positions?
legendary
Activity: 1904
Merit: 1002
April 11, 2012, 01:10:39 AM
#66
indeed, atm it is live and in operation but only with a tiny amount of BTC.

My algorithm is to basic atm, but I have all the structure there. Currently Im working on making the trading algo modular so I can run simulations on multiple algo's.

Mine just plays the spread with stop orders at medium-term technical support and resistance.  When we move big, my stop makes sure I catch most of the move with enough of my capital.  Then, it goes back to liquidity-bot mode and I adjust the stops.  I haven't really backtested it, but it has a decent amount of live testing with small amounts.

What languages are you guys using with your trading algos? I'm using PHP in mine but it lacks some of the statistical analysis tools that I need for trading the basic technical indicators.

Mine is ruby... I'm not really using stat tools as I adjust the stops manually, but I'm sure there are some good packages out there for ruby.

Since mem's is called bitperl.pl, I'm going to guess it's in Perl, the Pathologically Eclectic Rubbish Lister.
legendary
Activity: 1904
Merit: 1002
April 11, 2012, 01:07:46 AM
#65
if you want ~3weeks of time,buy,sell logs for running sims send me a PM Smiley

Meh... I can pull all the data from bitcoincharts.com in a few minutes, but thanks anyway
donator
Activity: 848
Merit: 1078
April 11, 2012, 12:57:33 AM
#64
indeed, atm it is live and in operation but only with a tiny amount of BTC.

My algorithm is to basic atm, but I have all the structure there. Currently Im working on making the trading algo modular so I can run simulations on multiple algo's.

Mine just plays the spread with stop orders at medium-term technical support and resistance.  When we move big, my stop makes sure I catch most of the move with enough of my capital.  Then, it goes back to liquidity-bot mode and I adjust the stops.  I haven't really backtested it, but it has a decent amount of live testing with small amounts.

What languages are you guys using with your trading algos? I'm using PHP in mine but it lacks some of the statistical analysis tools that I need for trading the basic technical indicators.
mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
April 11, 2012, 12:45:19 AM
#63
if you want ~3weeks of time,buy,sell logs for running sims send me a PM Smiley
legendary
Activity: 1904
Merit: 1002
April 10, 2012, 10:59:02 PM
#62
indeed, atm it is live and in operation but only with a tiny amount of BTC.

My algorithm is to basic atm, but I have all the structure there. Currently Im working on making the trading algo modular so I can run simulations on multiple algo's.

Mine just plays the spread with stop orders at medium-term technical support and resistance.  When we move big, my stop makes sure I catch most of the move with enough of my capital.  Then, it goes back to liquidity-bot mode and I adjust the stops.  I haven't really backtested it, but it has a decent amount of live testing with small amounts.
mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
April 10, 2012, 10:53:05 PM
#61
indeed, atm it is live and in operation but only with a tiny amount of BTC.

My algorithm is to basic atm, but I have all the structure there. Currently Im working on making the trading algo modular so I can run simulations on multiple algo's.
legendary
Activity: 1904
Merit: 1002
April 10, 2012, 10:21:30 PM
#60
Maybe this is the wrong section, but I think you guys can help me here. I want to make a trading bot that will execute trades based on parameters I set according to technical indicators. Thing is, I have almost zero experience with coding. I don't just want to use someone else's code though, I want to build this from scratch, using custom and unique indicators. Is there any resource that I could use that would teach me how to go about creating and implementing this bot?

TL;DR Noob coder needs help building trading bot.

I have already written one, its called bitperl.pl but atm is a private only release.

On a good day it earns 0.7% of capital.

What about a bad day?

The worst Ive seen is it flat line waiting to sell coins for 4 days (back when he had  a good sized slump to 4.60). Once  the price came back  to normal it resumed its micro trading.

I see... careful with that type of strategy.  If it moves too far and you don't have a stop you'll miss the big moves.
mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
April 10, 2012, 10:17:05 PM
#59
Maybe this is the wrong section, but I think you guys can help me here. I want to make a trading bot that will execute trades based on parameters I set according to technical indicators. Thing is, I have almost zero experience with coding. I don't just want to use someone else's code though, I want to build this from scratch, using custom and unique indicators. Is there any resource that I could use that would teach me how to go about creating and implementing this bot?

TL;DR Noob coder needs help building trading bot.

I have already written one, its called bitperl.pl but atm is a private only release.

On a good day it earns 0.7% of capital.

What about a bad day?

The worst Ive seen is it flat line waiting to sell coins for 4 days (back when he had  a good sized slump to 4.60). Once  the price came back  to normal it resumed its micro trading.

Currently supports:

  • Simulations
  • Uploads charts output of: profit ph, profit total, buy, sell, target, target break even. Example:
  • Logs historical Data. (for simulations)
  • The most basic buy low sell high algorithm (more coming).
  • Forcing a sell/buy remotely.
  • tweets changes and transactions: https://twitter.com/#!/bitperl
  • Factors MTGOX transaction charges

Todo:

  • Nicer web UI
  • modular trading algo's

Good luck with your trading bot Smiley

My advice is thread or daemonize everything to avoid any lag between transactions and mtgox live price.
I used to have everything pushed into a single loop - was easy to follow but a simple tweet was enough to miss a good price.
legendary
Activity: 1904
Merit: 1002
April 10, 2012, 10:14:55 PM
#58
Maybe this is the wrong section, but I think you guys can help me here. I want to make a trading bot that will execute trades based on parameters I set according to technical indicators. Thing is, I have almost zero experience with coding. I don't just want to use someone else's code though, I want to build this from scratch, using custom and unique indicators. Is there any resource that I could use that would teach me how to go about creating and implementing this bot?

TL;DR Noob coder needs help building trading bot.

I have already written one, its called bitperl.pl but atm is a private only release.

On a good day it earns 0.7% of capital.

What about a bad day?
mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
April 10, 2012, 10:13:26 PM
#57
Maybe this is the wrong section, but I think you guys can help me here. I want to make a trading bot that will execute trades based on parameters I set according to technical indicators. Thing is, I have almost zero experience with coding. I don't just want to use someone else's code though, I want to build this from scratch, using custom and unique indicators. Is there any resource that I could use that would teach me how to go about creating and implementing this bot?

TL;DR Noob coder needs help building trading bot.

I have already written one, its called bitperl.pl but atm is a private only release.

On a good day it earns 0.7% of capital.
legendary
Activity: 1190
Merit: 1004
April 09, 2012, 11:48:01 AM
#56
Yep, allocation with malloc works fine.

Except now I have OpenCL errors, will fix those...

Quote
Then look at the libs you use. What is openCL good for? Do you really need it?

Testing many combinations on an algorithm at once.
sr. member
Activity: 420
Merit: 250
bool eval(bool b){return b ? b==true : b==false;}
April 09, 2012, 07:04:28 AM
#55
Maybe be you should take a closer look at your data structures.

What do you think a trade looks like?
Do you need to store the trades? For what purpose?

Is the decision to buy different from a decision to sell? If yes what is the difference?
Is this to be modelled as a struct or function? (could be both)

Is your bot meant to run on a single exchange or will it serve several different exchanges?
Thus you have to model the synopsis for the(se) exchange(s).

Then look at the libs you use. What is openCL good for? Do you really need it?
It prevents you from using function pointers. Which could be handy when dealing with different exchanges and modelling the decision as a function.
legendary
Activity: 1904
Merit: 1002
April 08, 2012, 08:56:17 PM
#54
Stack overflow... Now I'll know to be weary of static variables. I'll try replacing large static arrays with allocated memory and hopefully it will work... I thought the stack size would grow to meet larger variables... It would be nice if there was some error or warning when this happens.

That's it... don't make static variables over a few hundered bytes.  Just don't.
legendary
Activity: 1190
Merit: 1004
April 08, 2012, 08:50:08 PM
#53
Stack overflow... Now I'll know to be weary of static variables. I'll try replacing large static arrays with allocated memory and hopefully it will work... I thought the stack size would grow to meet larger variables... It would be nice if there was some error or warning when this happens.
legendary
Activity: 1190
Merit: 1004
April 08, 2012, 08:22:55 PM
#52
I fiddled with the code and slowly removed parts until I got a super small program that crashes:

Quote
#include

int main () {
   if (!errno) {
      int bar[2096159];
   }
   return 0;
}

This gives:

Code:
(null):Parrallel BitCoin Trading Algorithm matt$ gcc -g test.c -o test
(null):Parrallel BitCoin Trading Algorithm matt$ gdb test
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug 15 16:03:10 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries .. done

(gdb) run
Starting program: /Users/matt/Programming/Bit Coin algorithm/Parrallel BitCoin Trading Algorithm/test
Reading symbols for shared libraries +. done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00007fff5f3ffff8
0x00007fff5fc1404c in __dyld__ZNK26ImageLoaderMachOCompressed18findExportedSymbolEPKcPPK11ImageLoader ()
(gdb)

But if the array is one smaller:

Code:
#include 

int main () {
if (!errno) {
int bar[2096158];
}
return 0;
}

Then this happens:

Code:
(null):Parrallel BitCoin Trading Algorithm matt$ gcc -g test.c -o test
(null):Parrallel BitCoin Trading Algorithm matt$ gdb test
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug 15 16:03:10 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries .. done

(gdb) run
Starting program: /Users/matt/Programming/Bit Coin algorithm/Parrallel BitCoin Trading Algorithm/test
Reading symbols for shared libraries +. done

Program exited normally.
(gdb)

Stack trace:

Code:
(gdb) bt
#0  0x00007fff5fc1404c in __dyld__ZNK26ImageLoaderMachOCompressed18findExportedSymbolEPKcPPK11ImageLoader ()
#1  0x00007fff5fc0f141 in __dyld__ZNK16ImageLoaderMachO18findExportedSymbolEPKcbPPK11ImageLoader ()
#2  0x00007fff5fc12b34 in __dyld__ZN26ImageLoaderMachOCompressed15resolveTwolevelERKN11ImageLoader11LinkContextEPKS0_bPKcPS5_ ()
#3  0x00007fff5fc12dd0 in __dyld__ZN26ImageLoaderMachOCompressed7resolveERKN11ImageLoader11LinkContextEPKchiPPKS0_PNS_10LastLookupE ()
#4  0x00007fff5fc1699e in __dyld__ZN26ImageLoaderMachOCompressed20doBindFastLazySymbolEjRKN11ImageLoader11LinkContextE ()
#5  0x00007fff5fc0478f in __dyld__ZN4dyld18fastBindLazySymbolEPP11ImageLoaderm ()
#6  0x00007fff8812800a in dyld_stub_binder ()
#7  0x0000000100001030 in pvars ()
#8  0x0000000100000ef4 in start ()

Well I'm stumped...
legendary
Activity: 1190
Merit: 1004
April 08, 2012, 07:08:01 PM
#51
At this point in the program nothing is initialised since it's at the main function entry. I ran gdb again and it shows 0xbea7d7cc again. No idea where it came from. What I'll try to do is make and share a minimalist version of the program that replicates the problem...
sr. member
Activity: 420
Merit: 250
bool eval(bool b){return b ? b==true : b==false;}
April 08, 2012, 03:25:21 PM
#50
Code:
Reason: KERN_PROTECTION_FAILURE at address: 0xbea7d7cc
wtf is located at 0xbea7d7cc?
Is it stack or heap? Did you init it? When did you release that address?
Is it always this specific address? ... if yes, why? Where did it come from?
legendary
Activity: 1190
Merit: 1004
April 08, 2012, 11:31:34 AM
#49
Well I just tried compiling and running outside of Xcode and I get the same thing...

Code:
Matthew-Mitchell:Parrallel BitCoin Trading Algorithm matt$ gcc -g cmain.c -o test -lcurl -framework OpenCL -std=c99 -arch i386
Matthew-Mitchell:Parrallel BitCoin Trading Algorithm matt$ gdb testGNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug 15 16:03:10 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries .... done

(gdb) run
Starting program: /Users/matt/Programming/Bit Coin algorithm/Parrallel BitCoin Trading Algorithm/test
Reading symbols for shared libraries .+++.................................................................. done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0xbea7d7cc
0x00003e9a in main (argc=0, argv=0x1000) at cmain.c:572
572 int main (int argc, const char * argv[]) {
(gdb)

Sad Also when running directly in the command line, it returns instantly.
sr. member
Activity: 420
Merit: 250
bool eval(bool b){return b ? b==true : b==false;}
April 07, 2012, 01:35:06 PM
#48
Fine so far.
Now find the lib or the combination causing trouble and feed that to agony aunt google.

btw. if your first line of code would have been:
Code:
long satoshi = 0;
It would have crashed there, so could be RAII isn´t too bad for pure C either.
sr. member
Activity: 327
Merit: 250
we are legion
April 07, 2012, 01:30:05 PM
#47
A IDE / Compiler can be broken. Its possible.
Try Compiling on a clean, fresh System. - or at least reinstall xcode.
Also check environment variables.. these are very important for most Compilers.
legendary
Activity: 1190
Merit: 1004
April 07, 2012, 11:57:32 AM
#46
I removed all optimisation and now the line during the crash is shown at entering the main function...

I removed all curllib and the same problem occurs...

I removed all of the OpenCL and the same problem occurs... What? Is Xcode broken...

I replaced the entire program with:

Code:
#include 
#include

int main(){
printf(":O");
return EXIT_SUCCESS;
}

It works... Time to scratch my head...
sr. member
Activity: 420
Merit: 250
bool eval(bool b){return b ? b==true : b==false;}
April 07, 2012, 11:05:50 AM
#45
No, it crashes on intializing a lib.
Remove all optimizations (compiler + linker) include debug infos and step by step remove one lib after the other.
legendary
Activity: 1190
Merit: 1004
April 07, 2012, 09:58:27 AM
#44
Well I modified the code:

Quote
int main (int argc, const char * argv[]) {
   float usd,btc,bid,ask,order_price,possible_price;
   printf("HALLO\n");
   DateData * prices = load_prices();

It never prints HALLO and it now crashes o the printf line...
legendary
Activity: 1904
Merit: 1002
April 06, 2012, 11:15:29 PM
#43
OK but what is wrong with this line?

Code:
FILE * file = fopen("price.dat", "rb");

That's as perfect as a line of code can be. It makes me think the compiler is corrupting the program somehow.

Or you have a bad pointer somewhere and C won't stop you from overwriting your code stack and screwing up the instructions, leading to an error being identified in a bit of code that was fine before the program did exactly what you told it to do.
legendary
Activity: 1190
Merit: 1004
April 06, 2012, 05:53:19 PM
#42
OK but what is wrong with this line?

Code:
FILE * file = fopen("price.dat", "rb");

That's as perfect as a line of code can be. It makes me think the compiler is corrupting the program somehow.
sr. member
Activity: 461
Merit: 251
April 06, 2012, 11:11:28 AM
#41
I'm using C.
... so check your pointers. Make sure nothing is pointing to the stack and so on.

Yes, definitely a pointer issue.  The problem with set faults and pointers is that the seg fault can often occur at misleading places leading you to believe that the bug is located at a different point in the code.  And C gives little to no warning when playing with pointers improperly.
sr. member
Activity: 420
Merit: 250
bool eval(bool b){return b ? b==true : b==false;}
April 06, 2012, 08:07:39 AM
#40
I'm using C.
... so check your pointers. Make sure nothing is pointing to the stack and so on.
legendary
Activity: 1190
Merit: 1004
April 06, 2012, 07:43:34 AM
#39
Code:
(*PPO_results)[x]

This is is not a C++ object. I'm not even using C++, I'm using C. The type is CombinationResult[PPO_COMBINATIONS * 11].

Also I don't know why declaring several variables on one line is bad style...
sr. member
Activity: 420
Merit: 250
bool eval(bool b){return b ? b==true : b==false;}
April 06, 2012, 07:15:43 AM
#38
Code:
(*PPO_results)[x]
is a valid object?
Make sure all objects used are initialized plus not yet released.

Is it possibly an
Code:
extern "C" {
issue?

p.s.
Code:
float usd,btc,bid,ask,order_price,possible_price;
Bad style I´d say.
Not so much of an issue on basic types, but still.
My Grandma used to say: "Wokeen Grössn ni eert ward n Daaler ni weert!" meaning don´t be sloppy even not on little things.
legendary
Activity: 1190
Merit: 1004
April 06, 2012, 05:52:56 AM
#37
Forgot about that, it's a structure with an int and float.
sr. member
Activity: 420
Merit: 250
bool eval(bool b){return b ? b==true : b==false;}
April 06, 2012, 05:39:03 AM
#36
What is a CombinationResult? ... possibly a pointer?


legendary
Activity: 1190
Merit: 1004
April 05, 2012, 07:23:00 PM
#35
I'm currently unable to test that but that should not be the case. It works when I return from the other function before the suspected bad line occurs.
sr. member
Activity: 461
Merit: 251
April 05, 2012, 06:47:52 PM
#34
I updated my algorithm in attempt to get it to test for consistency over different time periods and also use use more data but unfortunately it has a weird problem. http://stackoverflow.com/questions/10036739/line-of-c-code-causes-a-segmentation-fault-on-a-completely-irrelevant-line-of-co  Huh

Don't you just need to define

Quote
FILE * file;

first and then do the

Quote
file = fopen(....

on a separate line?
legendary
Activity: 1190
Merit: 1004
April 05, 2012, 06:23:31 PM
#33
I updated my algorithm in attempt to get it to test for consistency over different time periods and also use use more data but unfortunately it has a weird problem. http://stackoverflow.com/questions/10036739/line-of-c-code-causes-a-segmentation-fault-on-a-completely-irrelevant-line-of-co  Huh
donator
Activity: 2058
Merit: 1007
Poor impulse control.
April 04, 2012, 10:56:55 AM
#32

Thanks organofcorti, I'm reading up about it now. I've been programming for a little while but have never heard of R, even for statistical analysis. How come it isnt more mainstream? I've heard of languages such as K and Q which seems to be used fairly widely for banks processing tick by tick data however trading strategies tend to be predominantly done in C.

Do you have an overview of the pros/cons of R, and how it compares to the others. I wanna get a bit more of an idea what the language is like before investing serious time into learning it.

Can it interface easily with PHP and/or the existing API's to automatically place trades?

I'm not a good person to ask. Apart from R I've done a little C, python, and basic and that's about it (I can feel my kudos disappear as I write shudder). But I like R, it's extensible, flexible, has error messages that actually help you find bugs, and can do everything I need it to. I've scraped webpages with it, and stochastic wrote some code that interfaces with bitcoinica (posted here.

Another good upside is that it's been around in one form or another for decades. There's not one question I've had that couldn't be answered by google.

The downside is that it is very specialised. It's an object oriented math language, like matlab (only better) or mathematica (but open source and not quite as good). How much that will affect you I can't tell since I've never written an active tradebot, just the algorithms (they've done well, but I didn't power bots with them since they only traded on a week or month scale). Stochastic shows how it's done, though.
donator
Activity: 848
Merit: 1078
April 02, 2012, 08:06:22 PM
#31
Are there any open source classes where you could add a data feed and it will spit out calcs on various technical indicators?

The charting functions on Bitcoincharts is similar to what I'm after but I want to be able to programatically receive the chart outputs. The website says the charts are under creative commons licence, where can I find the source code?

R has plenty, and writing a script to plot them all is quite easy. You just have to have the data from mtgox, and you can quickly split it into hi-lo-close and then have functions operate on the data.

You want library(xts),library(quantmod) and library(TTR). TTR has about 35 or 40 technical trading rules, for example easy to vary SMA/EMA.

Then if you want to do bootstrapping you can use (backtesting with variation) you can use library(quantstrat) (i think, this is all from memory).

All of these can be applied within rgp to give you huge flexibility when it comes to evolving GAs. If you do bootstrapping right, you don't have problems with overfitting.

Thanks organofcorti, I'm reading up about it now. I've been programming for a little while but have never heard of R, even for statistical analysis. How come it isnt more mainstream? I've heard of languages such as K and Q which seems to be used fairly widely for banks processing tick by tick data however trading strategies tend to be predominantly done in C.

Do you have an overview of the pros/cons of R, and how it compares to the others. I wanna get a bit more of an idea what the language is like before investing serious time into learning it.

Can it interface easily with PHP and/or the existing API's to automatically place trades?
donator
Activity: 2058
Merit: 1007
Poor impulse control.
April 02, 2012, 01:18:49 AM
#30
Are there any open source classes where you could add a data feed and it will spit out calcs on various technical indicators?

The charting functions on Bitcoincharts is similar to what I'm after but I want to be able to programatically receive the chart outputs. The website says the charts are under creative commons licence, where can I find the source code?

R has plenty, and writing a script to plot them all is quite easy. You just have to have the data from mtgox, and you can quickly split it into hi-lo-close and then have functions operate on the data.

You want library(xts),library(quantmod) and library(TTR). TTR has about 35 or 40 technical trading rules, for example easy to vary SMA/EMA.

Then if you want to do bootstrapping you can use (backtesting with variation) you can use library(quantstrat) (i think, this is all from memory).

All of these can be applied within rgp to give you huge flexibility when it comes to evolving GAs. If you do bootstrapping right, you don't have problems with overfitting.
donator
Activity: 848
Merit: 1078
April 01, 2012, 09:41:51 PM
#29
Are there any open source classes where you could add a data feed and it will spit out calcs on various technical indicators?

The charting functions on Bitcoincharts is similar to what I'm after but I want to be able to programatically receive the chart outputs. The website says the charts are under creative commons licence, where can I find the source code?
hero member
Activity: 532
Merit: 500
April 01, 2012, 06:51:48 PM
#28
Though mixing bits up might create an inaccurate representation of the actual market do you think?

I could experiment a little with different algorithms and test them side by side. I might come back to it but I've got other things I should perhaps be working on.

Sure... ideally you want to maintain valid wave counts.  I wish I had the time to build such a wave validity checker and mutator.

a wave counting bot would be soooo cool.
legendary
Activity: 1904
Merit: 1002
April 01, 2012, 02:48:59 PM
#27
Though mixing bits up might create an inaccurate representation of the actual market do you think?

I could experiment a little with different algorithms and test them side by side. I might come back to it but I've got other things I should perhaps be working on.

Sure... ideally you want to maintain valid wave counts.  I wish I had the time to build such a wave validity checker and mutator.
legendary
Activity: 1190
Merit: 1004
April 01, 2012, 02:36:33 PM
#26
Though mixing bits up might create an inaccurate representation of the actual market do you think?

I could experiment a little with different algorithms and test them side by side. I might come back to it but I've got other things I should perhaps be working on.
legendary
Activity: 1904
Merit: 1002
April 01, 2012, 02:34:01 PM
#25
What's low and what's high?

Mine trie to figure out a strategy itself an d it found really good strategies... that only worked for old data. It was good at hindsight, rubbish at foresight. Maybe it needed tweaking.

This problem is known as overfitting.  The solution is to add noise to the data.  Create 10 copies of the data with random permutations to train it on.

So your solution would be to copy the data and add various noise... how would this noise be added, random changes in the prices? What should the spread and distribution in the randomness be?

I guess using more data and perhaps testing for consistency would help also.

That's the art of it.  I might try something along the lines of scaling similar movements from different timescales to replace the move that actually happened.  This will give the solution space more robustness to handle similar, but slightly different situations.
legendary
Activity: 1190
Merit: 1004
April 01, 2012, 02:23:01 PM
#24
What's low and what's high?

Mine trie to figure out a strategy itself an d it found really good strategies... that only worked for old data. It was good at hindsight, rubbish at foresight. Maybe it needed tweaking.

This problem is known as overfitting.  The solution is to add noise to the data.  Create 10 copies of the data with random permutations to train it on.

So your solution would be to copy the data and add various noise... how would this noise be added, random changes in the prices? What should the spread and distribution in the randomness be?

I guess using more data and perhaps testing for consistency would help also.
sr. member
Activity: 420
Merit: 250
bool eval(bool b){return b ? b==true : b==false;}
April 01, 2012, 10:26:50 AM
#23
WTF ?  Huh
I have never seen a Function call like this.
I consider those function calls broken.

Nevertheless could be it works. Still it then might be a good idea to look a bit deeper into the idea of GA.
What are your Populations? Can you reproduce trades? Will those be as good again as they were before?
What is your fitness function? Is the function meant to change or just its values?
donator
Activity: 2058
Merit: 1007
Poor impulse control.
April 01, 2012, 10:09:52 AM
#22
You have a list of all possibilities there. Only a few are needed. Have you never used R before?

You'd have to be familiar with R and then learn to use the RGP package. The last bit is not a steep learning curve.
sr. member
Activity: 327
Merit: 250
we are legion
April 01, 2012, 09:27:19 AM
#21
I think you're better off finding the right algorithm first, backtesting/bootstrapping, and then learning about the MtGox API. At least then you won't be tempted to turn it on at the first evolved GA you get that seems to work.

BTW, if you use RGP to create the algorithm you get a fair degree of flexibility since it allows boolean operations. So you end up with "if then" type conditions. It's reasonably quick to plateau as well.

I generated a good GA that was basically a moving average crossover which did well in backtesting and has done well so far. It only trades once every two or three weeks though.

Let me look at that Document... function call to "geneticProgramming"
Parameters:
Code:
geneticProgramming(fitnessFunction,stopCondition=makeTimeStopCondition(5),population,
populationSize=100,eliteSize=ceiling(0.1*populationSize),
elite=list(),functionSet=mathFunctionSet,
inputVariables=inputVariableSet("x"),
constantSet=numericConstantSet,
selectionFunction=makeTournamentSelection(),
crossoverFunction=crossover,mutationFunction,
restartCondition=makeEmptyRestartCondition(),
restartStrategy=makeLocalRestartStrategy(),
breedingFitness=function(individual)TRUE,breedingTries=50,
extinctionPrevention=FALSE,archive=FALSE,genealogy=FALSE,
progressMonitor,verbose=TRUE)
typedGeneticProgramming(fitnessFunction,type,stopCondition=makeTimeStopCondition(5),
population,populationSize=100,eliteSize=ceiling(0.1*
populationSize),elite=list(),functionSet,inputVariables,
constantSet,selectionFunction=makeTournamentSelection(),
crossoverFunction=crossoverTyped,mutationFunction,
restartCondition=makeEmptyRestartCondition(),
restartStrategy=makeLocalRestartStrategy(populationType=type),
breedingFitness=function(individual)TRUE,breedingTries=50,
extinctionPrevention=FALSE,archive=FALSE,genealogy=FALSE,
progressMonitor,verbose=TRUE)

WTF ?  Huh
I have never seen a Function call like this.
legendary
Activity: 1904
Merit: 1002
March 31, 2012, 11:37:54 PM
#20
What's low and what's high?

Mine trie to figure out a strategy itself an d it found really good strategies... that only worked for old data. It was good at hindsight, rubbish at foresight. Maybe it needed tweaking.

This problem is known as overfitting.  The solution is to add noise to the data.  Create 10 copies of the data with random permutations to train it on.
donator
Activity: 2058
Merit: 1007
Poor impulse control.
March 31, 2012, 10:09:17 PM
#19
I think you're better off finding the right algorithm first, backtesting/bootstrapping, and then learning about the MtGox API. At least then you won't be tempted to turn it on at the first evolved GA you get that seems to work.

BTW, if you use RGP to create the algorithm you get a fair degree of flexibility since it allows boolean operations. So you end up with "if then" type conditions. It's reasonably quick to plateau as well.

I generated a good GA that was basically a moving average crossover which did well in backtesting and has done well so far. It only trades once every two or three weeks though.
hero member
Activity: 532
Merit: 500
March 31, 2012, 09:09:58 PM
#18
What's low and what's high?

Mine trie to figure out a strategy itself an d it found really good strategies... that only worked for old data. It was good at hindsight, rubbish at foresight. Maybe it needed tweaking.

This is the most important advice I see time and again about trading bots. There is no such thing as a "set and forget" trading bot. They will need continual tweaking to adjust to changing market conditions that require adjusted trading strategies.

legendary
Activity: 1190
Merit: 1004
March 31, 2012, 07:03:44 PM
#17
What's low and what's high?

Mine trie to figure out a strategy itself an d it found really good strategies... that only worked for old data. It was good at hindsight, rubbish at foresight. Maybe it needed tweaking.
sr. member
Activity: 327
Merit: 250
we are legion
March 31, 2012, 06:56:23 PM
#16
I made a bot that used an evolutionary algorithm and OpenCL. It completely failed when I tested it with live data.

OpenCL ? isnt that a bit too complicated ?
You wont need extreme processing power, do you ?
What I did was to "buy low, sell high", this one works.
Artificial Intelligence could be Artificial Stupidity.
legendary
Activity: 1190
Merit: 1004
March 31, 2012, 06:45:17 PM
#15
I made a bot that used an evolutionary algorithm and OpenCL. It completely failed when I tested it with live data.
sr. member
Activity: 327
Merit: 250
we are legion
March 31, 2012, 06:41:36 PM
#14
You're going to want to backtest/simulate it on historical data too. Not to make sure it makes you lots of money, as past performance has little bearing on future behavior, but simply to make sure it doesn't do anything ridiculously stupid and is behaving as you'd expect.

If you don't have data or know how to simulate the bot outside of the real market, you probably shouldn't be doing this.

I have been doing this with my old AutoIt bot.
I dont know if the results are any good, its probably full of bugs and totally wrong.
One of the test results i remember is +90% from 1.1.2012 to today.
If this really worked as the data shows, it would be quite usable.
I better get more data and do more testing, because my strategy was really simple.
donator
Activity: 266
Merit: 252
I'm actually a pineapple
March 31, 2012, 06:31:58 PM
#13
You're going to want to backtest/simulate it on historical data too. Not to make sure it makes you lots of money, as past performance has little bearing on future behavior, but simply to make sure it doesn't do anything ridiculously stupid and is behaving as you'd expect.

If you don't have data or know how to simulate the bot outside of the real market, you probably shouldn't be doing this.
sr. member
Activity: 327
Merit: 250
we are legion
March 31, 2012, 06:22:37 PM
#12
I'd be very much interested in this visually coded custom trading bot. I'll pay a 1% fee on transactions for the first £10 of you'r earnings from me. I'd like it to be avaliable from a website like MTGox and Bitcoinica are.

I only know one online trading bot platform, this one: https://bitcointalksearch.org/topic/aricie-announcing-a-new-trading-bots-platform-32484
Its really hard to understand... but i dont belive in visual programming anyway.
What we really need is a well documented platform, like input->processing-> output shown in great details.
Is a trading bot profitable enough to give the provider a share of the profits ?
hero member
Activity: 1778
Merit: 504
WorkAsPro
March 31, 2012, 04:12:54 PM
#11
I'd be very much interested in this visually coded custom trading bot. I'll pay a 1% fee on transactions for the first £10 of you'r earnings from me. I'd like it to be avaliable from a website like MTGox and Bitcoinica are.
sr. member
Activity: 364
Merit: 250
[#][#][#]
March 28, 2012, 02:59:15 PM
#10
me and a friend are currently bitting out our teeth trying to implement a relatively advanced trading system with alot of indicators..

hard work, i tell you. don't know if we can ever finish it in a way that it makes sense.
sr. member
Activity: 327
Merit: 250
we are legion
March 27, 2012, 07:26:51 PM
#9
...
Thank you. This is very useful Information.
Some of the old MtGox Bots wont work anymore, because they use the old
username/password Authentication instead of the Key/Secret.
REF
hero member
Activity: 529
Merit: 500
March 27, 2012, 07:02:22 PM
#8
hero member
Activity: 532
Merit: 500
sr. member
Activity: 327
Merit: 250
we are legion
March 27, 2012, 06:32:47 PM
#6
Thing is, I have almost zero experience with coding.
You get Experience from actually doing it.  Tongue
I don't just want to use someone else's code though, I want to build this from scratch, using custom and unique indicators.
There are a few Libraries around to make use of the Trading APIs.
If they work, there is no reason to not use them.
Reading and understanding someone else's code is good for learning.
Is there any resource that I could use that would teach me how to go about creating and implementing this bot?
What you need to read:
Trading API Documentation of your favorite Exchange.
"C# for Dummies" (or whatever Language you like)
Bits and pieces of Information about Programming and Trading. (Google and Wikipedia are your Friends)  Grin

I wrote a (really bad) MtGox Bot in AutoIt (dont use that Language!),
...and rewrite everything in C# now, using someones SocketIO Library.  Cool
legendary
Activity: 1904
Merit: 1038
Trusted Bitcoiner
March 27, 2012, 06:01:31 PM
#5
my implementation would be a windows application
I would retro fit the software I'm currently working on http://youtu.be/f3qWB3zYzU8
instead of programing an IO devices you'd be programing a trading bot

i dont know if this would be a worth while project tho...

 
legendary
Activity: 947
Merit: 1042
Hamster ate my bitcoin
March 27, 2012, 05:26:09 PM
#4
Start by writing/obtaining an api to communicate with the exchange you wish to trade on. Then implement your strategy/s using the api. If you need a database something simple like sqlite will probable do.

I am in the process of developing a trading platform. It has a host of facilities for communicating with exchanges, reading/writing to databases, etc.  which are accessed through scripts and plugins.

Unfortunately it is still some months from even being in an unstable beta state.
ELT
newbie
Activity: 14
Merit: 0
March 27, 2012, 05:18:41 PM
#3
https://en.bitcoin.it/wiki/MtGox/API/HTTP

That is the API doc's for MtGox, if you just want to use PHP the code to auth and getting the ticker and the other thing.  

I have some python code, but that is also on a wiki and easily found on here via the search.

I would use either python or PHP to write it as they are pretty easy to write in.

[Edit]

My first bot was quite stupid and I limited its trades to just 0.1btc and it did quite well for a bit, but then a few things changed and it ate through its 1btc play money pretty quickly.  Will you lose everything? Maybe but only if you allow it to.

ELT
legendary
Activity: 1904
Merit: 1038
Trusted Bitcoiner
March 27, 2012, 05:16:47 PM
#2
Maybe this is the wrong section, but I think you guys can help me here. I want to make a trading bot that will execute trades based on parameters I set according to technical indicators. Thing is, I have almost zero experience with coding. I don't just want to use someone else's code though, I want to build this from scratch, using custom and unique indicators. Is there any resource that I could use that would teach me how to go about creating and implementing this bot?

TL;DR Noob coder needs help building trading bot.

if your a noob coder, you can not make this bot...

your going to make a bug that will sell all your bitcoin or something


i was thinking of doing a trading bot, the user would visual program a trading strategy... a easily re-programmable bot if you will

how much would that be worth to you?
member
Activity: 76
Merit: 10
March 27, 2012, 05:06:09 PM
#1
Maybe this is the wrong section, but I think you guys can help me here. I want to make a trading bot that will execute trades based on parameters I set according to technical indicators. Thing is, I have almost zero experience with coding. I don't just want to use someone else's code though, I want to build this from scratch, using custom and unique indicators. Is there any resource that I could use that would teach me how to go about creating and implementing this bot?

TL;DR Noob coder needs help building trading bot.
Jump to: