Skip to content

Instantly share code, notes, and snippets.

@reportbase
Created March 22, 2015 21:22
Show Gist options
  • Save reportbase/04a58d1f5404a815461a to your computer and use it in GitHub Desktop.
Save reportbase/04a58d1f5404a815461a to your computer and use it in GitHub Desktop.
compare markets
market marketlst [] =
{
{"AMEX", "American Stock Exchange", "www.nyse.com", "www.nyse.com"},
{"AMS", "Euronext Amsterdam", "www.aex.nl", "www.aex.nl"},
{"ASX", "Australian Stock Exchange", "www.asx.com.au", "www.asx.com.au"},
{"BRU", "Euronext Brussels", "www.euronext.com", "www.euronext.com"},
{"BSE", "Bombay Stock Exchange", "www.bseindia.com", "www.bseindia.com"},
{"CBOT", "Chicago Board of Trade", "www.cmegroup.com", "www.cmegroup.com"},
{"CFE", "Chicago Futures Exchange", "cfe.cboe.com", "cfe.cboe.com"},
{"CME", "Chicago Merchantile Exchange", "www.cmegroup.com", "www.cmegroup.com"},
{"COMEX", "New York Commodity Exchange", "www.cmegroup.com", "www.cmegroup.com"},
{"EUREX", "EUREX Futures Exchange", "www.eurexchange.com", "www.eurexchange.com"},
{"FOREX", "Foreign Exchange (Interbank)", "en.wikipedia.org", "en.wikipedia.org/wiki/Foreign_exchange_market"},
{"HKEX", "Hong Kong Stock Exchange", "www.hkex.com.hk", "www.hkex.com.hk"},
{"INDEX", "Global Indices", ""},
{"KCBT", "Kansas City Board of Trade", "en.wikipedia.org", "en.wikipedia.org/wiki/Kansas_City_Board_of_Trade"},
{"LIFFE", "London Futures Exchange", "en.wikipedia.org", "en.wikipedia.org/wiki/London_International_Financial_Futures_and_Options_Exchange"},
{"LIS", "Euronext Lisbon", "en.wikipedia.org", "en.wikipedia.org/wiki/Euronext_Lisbon"},
{"LSE", "London Stock Exchange", "www.londonstockexchange.com"},
{"MGEX", "Minneapolis Grain Exchange", "www.mgex.com/"},
{"MLSE", "Milan Stock Exchange", ""},
{"MSE", "Madrid Stock Exchange", "en.wikipedia.org", "en.wikipedia.org/wiki/Madras_Stock_Exchange"},
{"NASDAQ", "NASDAQ Stock Exchange", "www.nasdaq.com"},
{"NSE", "National Stock Exchange of India", "www.nseindia.com/"},
{"NYBOT", "New York Board of Trade", "en.wikipedia.org", "en.wikipedia.org/wiki/New_York_Board_of_Trade"},
{"NYMEX", "New York Merchantile Exchange", "www.cmegroup.com"},
{"NYSE", "New York Stock Exchange", "www.nyse.com"},
{"NZX", "New Zealand Stock Exchange", "www.nzx.com"},
{"OTCBB", "OTC Bulletin Board", "www.otcbb.com/"},
{"PAR", "Euronext Paris", "www.euronext.com/"},
{"SGX", "Singapore Stock Exchange", "www.sgx.com/"},
{"TSX", "Toronto Stock Exchange", "www.tmx.com/"},
{"TSXV", "Vancouver Stock Exchange", "www.tmx.com/"},
{"USMF", "US Mutual Funds", ""},
{"WCE", "Winnipeg Commodity Exchange", "en.wikipedia.org", "en.wikipedia.org/wiki/Winnipeg_Commodity_Exchange"},
};
const market* const get_marketlst(int& size)
{
size = sizeof(marketlst) / sizeof(market);
return marketlst;
}
const market* marketfind = (market*) bsearch(exchange,
marketlst, sizeof(marketlst) / sizeof(market), sizeof(market), compare_markets);
if(!marketfind)
{
push_message(errors, 0, 0, 1, __FILE__, __FUNCTION__, __LINE__, "bad market - %s", exchange);
return;
}
inline int compare_markets(const void* _a, const void* _b)
{
const market* a = (market*) _a;
const market* b = (market*) _b;
return strcmp(a->name, b->name);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment