Bitcoin Forum
May 04, 2024, 04:19:35 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2] 3 4 5 »  All
  Print  
Author Topic: Trading Bots  (Read 12938 times)
ohforf
Sr. Member
****
Offline Offline

Activity: 327
Merit: 250


we are legion


View Profile
April 01, 2012, 02:27:19 PM
 #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.

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
▀██████ EAT SLEEP DECENTRALIZE ██████▀
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
1714796375
Hero Member
*
Offline Offline

Posts: 1714796375

View Profile Personal Message (Offline)

Ignore
1714796375
Reply with quote  #2

1714796375
Report to moderator
"Your bitcoin is secured in a way that is physically impossible for others to access, no matter for what reason, no matter how good the excuse, no matter a majority of miners, no matter what." -- Greg Maxwell
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
organofcorti
Donator
Legendary
*
Offline Offline

Activity: 2058
Merit: 1007


Poor impulse control.


View Profile WWW
April 01, 2012, 03:09:52 PM
 #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.

Bitcoin network and pool analysis 12QxPHEuxDrs7mCyGSx1iVSozTwtquDB3r
follow @oocBlog for new post notifications
Kettenmonster
Sr. Member
****
Offline Offline

Activity: 420
Merit: 250


bool eval(bool b){return b ? b==true : b==false;}


View Profile
April 01, 2012, 03:26:50 PM
 #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?

The paining (sic!) is done with the QPainter class inside the paintEvent() method.
(source: my internet)
MatthewLM
Legendary
*
Offline Offline

Activity: 1190
Merit: 1004


View Profile
April 01, 2012, 07: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.
notme
Legendary
*
Offline Offline

Activity: 1904
Merit: 1002


View Profile
April 01, 2012, 07: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.

https://www.bitcoin.org/bitcoin.pdf
While no idea is perfect, some ideas are useful.
MatthewLM
Legendary
*
Offline Offline

Activity: 1190
Merit: 1004


View Profile
April 01, 2012, 07: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.
notme
Legendary
*
Offline Offline

Activity: 1904
Merit: 1002


View Profile
April 01, 2012, 07: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.

https://www.bitcoin.org/bitcoin.pdf
While no idea is perfect, some ideas are useful.
guruvan
Hero Member
*****
Offline Offline

Activity: 532
Merit: 500


View Profile
April 01, 2012, 11: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.

Seal
Donator
Hero Member
*
Offline Offline

Activity: 848
Merit: 1078


View Profile WWW
April 02, 2012, 02:41:51 AM
 #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?

DefiDive - Filter the noise
A clean crypto asset management terminal
organofcorti
Donator
Legendary
*
Offline Offline

Activity: 2058
Merit: 1007


Poor impulse control.


View Profile WWW
April 02, 2012, 06: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.

Bitcoin network and pool analysis 12QxPHEuxDrs7mCyGSx1iVSozTwtquDB3r
follow @oocBlog for new post notifications
Seal
Donator
Hero Member
*
Offline Offline

Activity: 848
Merit: 1078


View Profile WWW
April 03, 2012, 01:06:22 AM
 #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?

DefiDive - Filter the noise
A clean crypto asset management terminal
organofcorti
Donator
Legendary
*
Offline Offline

Activity: 2058
Merit: 1007


Poor impulse control.


View Profile WWW
April 04, 2012, 03:56:55 PM
 #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.

Bitcoin network and pool analysis 12QxPHEuxDrs7mCyGSx1iVSozTwtquDB3r
follow @oocBlog for new post notifications
MatthewLM
Legendary
*
Offline Offline

Activity: 1190
Merit: 1004


View Profile
April 05, 2012, 11: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
MelMan2002
Sr. Member
****
Offline Offline

Activity: 461
Merit: 251



View Profile
April 05, 2012, 11: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?

19F6veduCZcudwXuWoVosjmzziQz4EhBPS
MatthewLM
Legendary
*
Offline Offline

Activity: 1190
Merit: 1004


View Profile
April 06, 2012, 12:23:00 AM
 #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.
Kettenmonster
Sr. Member
****
Offline Offline

Activity: 420
Merit: 250


bool eval(bool b){return b ? b==true : b==false;}


View Profile
April 06, 2012, 10:39:03 AM
 #36

What is a CombinationResult? ... possibly a pointer?



The paining (sic!) is done with the QPainter class inside the paintEvent() method.
(source: my internet)
MatthewLM
Legendary
*
Offline Offline

Activity: 1190
Merit: 1004


View Profile
April 06, 2012, 10:52:56 AM
 #37

Forgot about that, it's a structure with an int and float.
Kettenmonster
Sr. Member
****
Offline Offline

Activity: 420
Merit: 250


bool eval(bool b){return b ? b==true : b==false;}


View Profile
April 06, 2012, 12:15:43 PM
 #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.

The paining (sic!) is done with the QPainter class inside the paintEvent() method.
(source: my internet)
MatthewLM
Legendary
*
Offline Offline

Activity: 1190
Merit: 1004


View Profile
April 06, 2012, 12:43:34 PM
 #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...
Kettenmonster
Sr. Member
****
Offline Offline

Activity: 420
Merit: 250


bool eval(bool b){return b ? b==true : b==false;}


View Profile
April 06, 2012, 01:07:39 PM
 #40

I'm using C.
... so check your pointers. Make sure nothing is pointing to the stack and so on.

The paining (sic!) is done with the QPainter class inside the paintEvent() method.
(source: my internet)
Pages: « 1 [2] 3 4 5 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!