ScrewTurn

Active Trader Strategies API Community ChartStyles Community Commissions Community Components Community Indicators Knowledge Base Misc Optimizers PosSizers Providers Standard Indicators TASC Traders Tips TASCIndicators Tutorial Videos Visualizers
RSS

Navigation







Quick Search
»
Advanced Search »

PoweredBy
In some cases you would like to find out the exchange (e.g. NYSE, XETRA) where a given symbol is traded at. One of the possible ways would be to grab a bulky symbol list from the Internet, save into file on your disk (and don't forget to update it periodically), run a query in your Strategy and optionally place the result in Wealth-Lab's global memory.

However, one don't always have the need in a complex solution like that. As shown in other KB articles (#1, #2), downloading historical data and fundamental items is a hands down task. The same technique can be applied to symbol lookup.

Using the same .NET classes as we did before, let's figure out the exchange where a given symbol is trading at by using trusty Yahoo! Finance:


using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using System.Net; 			// access the Internet
using System.Text.RegularExpressions;	// regular expressions

namespace WealthLab.Strategies { public class ExchangeDemo : WealthScript { public string GetExchange( string symbol ) { string URI = @"http://download.finance.yahoo.com/d/quotes.csv?s=" + symbol + "&f=x"; WebClient client = new WebClient(); string text = client.DownloadString(URI); if( !String.IsNullOrEmpty(text) ) return Regex.Replace(text, @"[^\w\.@-]", ""); else return "Yahoo! Connection failed";

} protected override void Execute() { PrintDebug( GetExchange( Bars.Symbol ) ); } } }

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes.

Used under license from FMR Corp. Copyright 2008 FMR Corp. All rights reserved.


ScrewTurn Wiki version 3.0.2.509. Some of the icons created by FamFamFam.