I don't know if anyone is familiar with stock application. there are certain formulas that you can input to analyze based on data. e.g.
input:LONG(26,20,100,1),SHORT(12,5,40,1),M(9,2,60,1);
DIFF : EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA : EMA(DIFF,M);
MACD: 2*(DIFF-DEA), COLORSTICK;
what i am going to do here is, user will be able to input these formulas and my php server side will be able to understand/interpreter these formulas.
the challenge here is the user inputs are various and may lead to some very complex stuff, e.g. expression(expression1(expression2(1,2)/3)*2) etc.
What is the best way(think about performance, security, flexibilities) to accomplish such kind of goals?
Of course, i am not asking for the actual solutions, but some guide/direction.
My current idea is to use RPN(reverse polish notation) and regular expression to replace/filter input, and use eval() to get results.
someone also suggest to use LEX&YACC and write PHP extension. but it's really not the open source.
Any good ideas?
thanks!
input:LONG(26,20,100,1),SHORT(12,5,40,1),M(9,2,60,1);
DIFF : EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA : EMA(DIFF,M);
MACD: 2*(DIFF-DEA), COLORSTICK;
what i am going to do here is, user will be able to input these formulas and my php server side will be able to understand/interpreter these formulas.
the challenge here is the user inputs are various and may lead to some very complex stuff, e.g. expression(expression1(expression2(1,2)/3)*2) etc.
What is the best way(think about performance, security, flexibilities) to accomplish such kind of goals?
Of course, i am not asking for the actual solutions, but some guide/direction.
My current idea is to use RPN(reverse polish notation) and regular expression to replace/filter input, and use eval() to get results.
someone also suggest to use LEX&YACC and write PHP extension. but it's really not the open source.
Any good ideas?
thanks!