Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Which basic to use for a stock market application

0 views
Skip to first unread message

Ali Chambers

unread,
Aug 18, 2006, 4:28:54 PM8/18/06
to
Hi,

I'm planning to write a program in basic that processes stock market
price data. It will be using floating points arrays in the following
manner:

- Price data is held in floating point currency arrays, eg:-
highprice(0-2000 max)

- Comparisons are done between highprice() arrays and lowprice() arrays

- Buy levels are determined and these buy points held in arrays

- The program will then loop through the price arrays incrementally to
find sell prices - at which it sells and records the price (a basic
description!)

Different levels for buy & selling are to be tested (too complicated
for this email). On average, the buy/sell routine will be called 3
million times per stock.

I did a "mock up" in VB.NET and it took 15 hours to run! I expected the
app to take a while, but this is too long. I have also optimised the
alogarithm as much as possible.

I've been reading the newsgroups and I can see various choices:

- Powerbasic
- Freebasic

I need *RAW SPEED*. I'm not too bothered about the rest. Oh - and not
too complicated to write (not C++), as I'm a novice programmer doing it
part-time.

Would Powerbasic be best? Is it really that fast?

Thanks, alex

Michael Kennedy

unread,
Aug 19, 2006, 7:41:14 AM8/19/06
to
Ali,

For speed tests, maybe check the use of "Long Integers" instead of
Floating-Pt - assuming these fields are adequate for your calcs. In general,
the calcs should be faster. You would save all values internally in "Cents"
or "Pence". If users type 2 decimals, you'd multiply by 100 on the way in,
and save as integers. Similarly, on the way out, you'd divide by 100. If you
need, say, 3 or 4 decimals, you'd adopt the same approach. However, if you
need, say, 10 decimal places, then this approach would not be appropriate.

- M


"Ali Chambers" <in...@alexchambers.co.uk> wrote in message
news:1155932934.1...@m79g2000cwm.googlegroups.com...

Michael Mattias

unread,
Aug 19, 2006, 9:57:00 AM8/19/06
to

"Michael Kennedy" <In...@KennedySoftware.ie> wrote in message
news:hRCFg.12841$j7.3...@news.indigo.ie...

> Ali,
>
> For speed tests, maybe check the use of "Long Integers" instead of
> Floating-Pt - assuming these fields are adequate for your calcs. In
general,
> the calcs should be faster. You would save all values internally in
"Cents"
> or "Pence". If users type 2 decimals, you'd multiply by 100 on the way in,
> and save as integers. Similarly, on the way out, you'd divide by 100. If
you
> need, say, 3 or 4 decimals, you'd adopt the same approach. However, if you
> need, say, 10 decimal places, then this approach would not be appropriate.

As I pointed out in the other newsgroup (maybe my adding alt.lang.basic to
this reply will CORRECT THE NEARLY UNFORGIVEABLE SIN COMMITTED BY MR.
CHAMBERS WHEN HE POSTED THE SAME INQUIRY **SEPARATELY** TO MULTIPLE
NEWSGROUPS)...

This is not a problem which is going to be conquered by changing from
floating point to integers. This is an algorithm problem.

Changing datatypes or changing from FOR/NEXT to WHILE..WEND or any other
such changes simply cannot replace better algorithms and data management
strategies when performance is an issue.

The changes you get twiddling around with these kinds of things is marginal.


--
Michael Mattias
Tal Systems, Inc.
Racine WI
mmat...@talsystems.com


Michael Kennedy

unread,
Aug 19, 2006, 12:16:41 PM8/19/06
to
Michael,

> Changing datatypes or changing from FOR/NEXT to WHILE..WEND or any other
> such changes simply cannot replace better algorithms and data management
> strategies when performance is an issue.
>
> The changes you get twiddling around with these kinds of things is
> marginal.

In general, I totally agree with you. I posted my first "2c" contribution
before he/she mentioned the "loops".

However if the loops are essential, then the major attack should first be to
eliminate as many loops as possible, maybe based on "results-to-date"... and
then speed up the remaining ones. And re-thinking the problem to use some
appropriate "optimisation" algorithm might be "challenging"!

- Mike


Charles Appel

unread,
Aug 20, 2006, 7:32:49 AM8/20/06
to
"Ali Chambers" <in...@alexchambers.co.uk> wrote in message
news:1155932934.1...@m79g2000cwm.googlegroups.com...
> I did a "mock up" in VB.NET and it took 15 hours to run! I expected the
> app to take a while, but this is too long. I have also optimised the
> alogarithm as much as possible.

In general, PowerBASIC should prove faster than VB.NET -
but if you use the same algorithm, the speed increase won't be
that great. (7 to 12 hours will probably still be too slow.)

You need a different algorithm rather than a different language.

--
Charles Appel
http://charlesappel.home.mindspring.com/

Ali Chambers

unread,
Aug 20, 2006, 10:24:39 AM8/20/06
to
Hi,

Thanks for all the suggestions and sorry for the cross post. I'm going
to have another look at the alogarithm and use integers instead of FP.

Cheers,
Alex

Charles Appel

unread,
Aug 21, 2006, 2:56:24 PM8/21/06
to
"Ali Chambers" <in...@alexchambers.co.uk> wrote in message
news:1156083879.9...@74g2000cwt.googlegroups.com...

> Hi,
>
> Thanks for all the suggestions and sorry for the cross post. I'm going
> to have another look at the alogarithm and use integers instead of FP.

That might help but without seeing your code, I really couldn't say.
I'd get hold of a good code profiler and let it show you the areas that
use up the most time. Good luck with it.

0 new messages