Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can this be done any faster
Message
De
10/02/2006 08:50:33
Suhas Hegde
Dental Surgeon
Sirsi, Inde
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Can this be done any faster
Versions des environnements
Visual FoxPro:
VFP 6 SP5
Database:
Visual FoxPro
Divers
Thread ID:
01095428
Message ID:
01095428
Vues:
64
hi,
can the below code be modified to process much faster ?

Bhav_data contains distinct 1000 symbols and 1000 dates so total records is 1000*1000 = 1000000

bhav_data has indexs on padr(symbol,20) and date
select symbol from bhav_data group by 1 into cursor distsymbol nofilter
scan
	wait window distsymbol.symbol nowait
	select date,close from bhav_data where symbol = distsymbol.symbol into cursor s1 nofilter
	use dbf('s1') in 0 alias s2 again
	select s1
	set relation to recno()+1 into s2
	create cursor gainloss(date D,gain f(10,2),loss f(10,2))
	select s1
	scan
		if eof('s2')
			exit
		endif
		m.diff = s1.close - s2.close
		if m.diff > 0
			insert into gainloss values(s2.date,m.diff,0)
		else
			insert into gainloss values(s2.date,0,m.diff*-1.00)
		endif
	endscan
	use in select('s2')
	use in select('s1')

	select gainloss
	index on date tag date1 desc
	locate
	use dbf('gainloss') in 0 alias gainloss1 again
	select gainloss1
	index on date tag date2 desc
	select gainloss
	set relation to date into gainloss1
	scan
		select gainloss1
		average gain,loss next 14 to m.gain,m.loss
		m.rs = m.gain/m.loss
		update bhav_data set RSI = (100-(100/(1+m.rs))) ;
		where date = gainloss.date and ;
		symbol = distsymbol.symbol
	endscan
	use in select('gainloss')
	use in select('gainloss1')	
endscan
it takes abt 15 - 20 minutes to process

is it ok or can it be made faster ?
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform