Gentoo Archives: gentoo-user

From: Mark Knecht <markknecht@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] - Code translation tools?
Date: Wed, 26 Jan 2011 21:56:27
Message-Id: AANLkTimHfO+9Dne5cbbmL4RqvOyjT3HgXzqMg89joYVC@mail.gmail.com
In Reply to: Re: [gentoo-user] [OT] - Code translation tools? by Michael Orlitzky
1 On Wed, Jan 26, 2011 at 12:32 PM, Michael Orlitzky <michael@××××××××.com> wrote:
2 > On 01/26/2011 02:40 PM, Mark Knecht wrote:
3 <SNIP>
4 >> As for testing it _may_ be a slight bit easier than having to get to
5 >> that level. There is a library in portage called ta-lib which
6 >> implements lots of standard technical analysis constructs. After it's
7 >> installed I don't seem to have the C code for the actual functions
8 >> anymore. What I have is a compiled library as well as some header
9 >> files to look at. I suspect I can install the library again using
10 >> portage bt not getting rid of the functions which I could then use as
11 >> an example for my coding.
12 >
13 > Use FEATURES="noclean" and the patched source will be left under
14 > /var/tmp/portage. The unpatched source is probably in your
15 > /usr/portage/distfiles already. (I don't know if there *are* any patches
16 > for ta-lib, but if there are, you usually want them applied).
17 >
18
19 Actually, the tar.gz file in distfiles was easily expanded and I found
20 the code within for all the functions. I hadn't considered patches but
21 fortunately there aren't any applied so it seems I get off lucky this
22 time.
23
24 <SNIP>
25 >
26 > If you can figure out what all those parameters mean -- that will be the
27 > hard part. What type of moving average is EasyLanguage doing? Which
28 > TA_MAType does it match up to? Can the E.L. version fail if it runs off
29 > the end of the prices array, or does it just add zeros at the end? Is
30 > there a way to make TA_MA do the same?
31 >
32 > Sorry I have nothing but discouragement to offer =) This isn't an easy
33 > problem.
34
35 I don't consider this discouragement at all. In fact it's _very_ helpful.
36
37 Documentation:
38
39 I've found this much:
40
41 Online at the following links:
42 http://ta-lib.org/d_api/d_api.html
43 http://ta-lib.org/function.html
44
45 I haven't yet found a nice PDF that tells me the exact meaning of
46 every parameter but I suspect it's out there somewhere. There's a
47 forum for the library where people ask questions. I just noticed
48 someone asking about writing documentation to be put in a Wiki so
49 there's something going on. I'm not overly worried about matching up
50 ta-lib functionality with what I use today in EL.
51
52 Functionality:
53
54 Software for real-time stock trading tends to be a little more
55 restrictive than more general programming
56
57 1) First, we are operating on price data that has date & time
58 attached to every value. Think of a price chart for any stock. This
59 stuff (in general) just operates across time in a forward direction.
60
61 2) When doing a moving average, for example, we are calculating from
62 the current bar _backwards_. The only way to run off the end of the
63 array is to try to reference too far back, so a 20 period moving
64 average cannot be calculated before bar #20. As I go through a price
65 data array, I just start at the length parameter into the array N[20]
66 and keep going until the end.
67
68 The way I see this is there's an upper layer that reads the price data
69 in, puts it in an array and the calls the strategy bar-by-bar.
70 (row-by-row in the array) When it gets to the last bar of data (last
71 row with date and time) then it knows it's done. Pretty much all this
72 stuff seems to work that way.
73
74 At this point I feel like I've imposed on gentoo-user far too much. I
75 was hoping maybe there was some program in portage for doing
76 translations that might work but I guess there isn't. I'll let this
77 thread drift asleep unless someone responds back. I think I've got
78 enough info to sort of play around at this point, and I suspect my
79 next set of questions are better addressed at someplace like
80 StackOverflow as I can hardly program beyond Hello World at this
81 point! ;-)
82
83 Again, THANKS for your help and insights!
84
85 Anyone interested in this subject matter is always welcome to contact
86 me off-list.
87
88 Cheers,
89 Mark