czarna dziura
New Member
- Joined
- Jun 3, 2015
- Messages
- 7
Hi all,
I've created a script (I can post upon request) which walks through a column of stock symbols, then using google finance, grabs the company name, sector, and industry for each symbol.
The problem I'm encountering is say I have the symbols AAPL, GOOGL, and MSFT, the output should look as follows:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Symbol[/TD]
[TD]Name[/TD]
[TD]Sector[/TD]
[TD]Industry[/TD]
[/TR]
[TR]
[TD]AAPL[/TD]
[TD]Apple inc[/TD]
[TD]Technology[/TD]
[TD]Computer Hardware - NEC[/TD]
[/TR]
[TR]
[TD]GOOGL[/TD]
[TD]Google inc[/TD]
[TD]Technology[/TD]
[TD]Search Engines[/TD]
[/TR]
[TR]
[TD]MSFT[/TD]
[TD]Microsoft Corp.[/TD]
[TD]Technology[/TD]
[TD]Software - NEC[/TD]
[/TR]
</tbody>[/TABLE]
And does if I step through the code manually. But if I run the script the output looks like the loop is getting ahead of itself like so:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Symbol[/TD]
[TD]Name[/TD]
[TD]Sector[/TD]
[TD]Industry[/TD]
[/TR]
[TR]
[TD]AAPL[/TD]
[TD]Apple inc[/TD]
[TD]Technology[/TD]
[TD]Computer Hardware - NEC[/TD]
[/TR]
[TR]
[TD]GOOGL[/TD]
[TD]Apple inc[/TD]
[TD]Technology[/TD]
[TD]Computer Hardware - NEC[/TD]
[/TR]
[TR]
[TD]MSFT[/TD]
[TD]Microsoft Corp.[/TD]
[TD]Technology[/TD]
[TD]Software - NEC[/TD]
[/TR]
</tbody>[/TABLE]
Basically one company symbol is being used for two rows (sometimes rows are skipped, or partially done), and the only thing I can think of to fix it is to force the script to pause every loop for 10 seconds for everything to catch up. Does anybody have a more elegant solution?
A follow up question to this, is that it will be applied to data pulled using power pivot, and I'd like to have it run on the symbols while still in the power pivot table instead of being exported and pulled back into power pivot. Is this possible with user made macros?
Thanks!
I've created a script (I can post upon request) which walks through a column of stock symbols, then using google finance, grabs the company name, sector, and industry for each symbol.
The problem I'm encountering is say I have the symbols AAPL, GOOGL, and MSFT, the output should look as follows:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Symbol[/TD]
[TD]Name[/TD]
[TD]Sector[/TD]
[TD]Industry[/TD]
[/TR]
[TR]
[TD]AAPL[/TD]
[TD]Apple inc[/TD]
[TD]Technology[/TD]
[TD]Computer Hardware - NEC[/TD]
[/TR]
[TR]
[TD]GOOGL[/TD]
[TD]Google inc[/TD]
[TD]Technology[/TD]
[TD]Search Engines[/TD]
[/TR]
[TR]
[TD]MSFT[/TD]
[TD]Microsoft Corp.[/TD]
[TD]Technology[/TD]
[TD]Software - NEC[/TD]
[/TR]
</tbody>[/TABLE]
And does if I step through the code manually. But if I run the script the output looks like the loop is getting ahead of itself like so:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Symbol[/TD]
[TD]Name[/TD]
[TD]Sector[/TD]
[TD]Industry[/TD]
[/TR]
[TR]
[TD]AAPL[/TD]
[TD]Apple inc[/TD]
[TD]Technology[/TD]
[TD]Computer Hardware - NEC[/TD]
[/TR]
[TR]
[TD]GOOGL[/TD]
[TD]Apple inc[/TD]
[TD]Technology[/TD]
[TD]Computer Hardware - NEC[/TD]
[/TR]
[TR]
[TD]MSFT[/TD]
[TD]Microsoft Corp.[/TD]
[TD]Technology[/TD]
[TD]Software - NEC[/TD]
[/TR]
</tbody>[/TABLE]
Basically one company symbol is being used for two rows (sometimes rows are skipped, or partially done), and the only thing I can think of to fix it is to force the script to pause every loop for 10 seconds for everything to catch up. Does anybody have a more elegant solution?
A follow up question to this, is that it will be applied to data pulled using power pivot, and I'd like to have it run on the symbols while still in the power pivot table instead of being exported and pulled back into power pivot. Is this possible with user made macros?
Thanks!
Last edited: