#ifndef __SimpleMarketData_h_ #define __SimpleMarketData_h_ #include "../misc_framework/DataNodes.h" // This provides access to simple market data as a set of generic data nodes. // For the most part these are trivial wrappers around other types of data // nodes with the same data. However, some deal with details specific to one // data feed or another. // // This file is based on MarketData.pas. (It is not based on // SimpleMarketData.pas.) // This stores examples of each factory by name. This assumes that you will // only call it once and only call it in the appropriate thread. Names are the // preferred way to access this type of data. void initializeSimpleMarketData(); // These will create a data node, so you must be in an apropriate thread to // call them. DataNode::Integer getAverageDailyVolume(std::string const &symbol); double getTickVolatility(std::string const &symbol); std::string getListedExchange(std::string const &symbol); double getPreviousClose(std::string const &symbol); // This only looks at the symbol itself, and no other data sources. This was // once in a sperate file, with other things that didn't require data nodes. // It probably should be again. bool symbolIsIndex(std::string const &symbol); // This works on the exchange field in the TOS data. That is in the format // that comes from the data feed. This does not work on the standard internal // form we use in our database. std::string longExchangeName(std::string const &dataFeedExchangeName); // This is the code that you can read from the exchange field on the TOS data // node. std::string const &nyseOnDataFeed(); std::string const &amexOnDataFeed(); std::string const &nasdaqOnDataFeed(); std::string const &arcaOnDataFeed(); // Activ allows you to limit your TOS request to only one exchange. Or to see // the best bid and ask for a specific exchange. The former is a convenience // but the latter is the only way to see the regional bid and ask. The way // you access this from other data providers is slightly different. This won't // translate directly for them. But at least it will make sure that we find // all of these cases if we need to. // // This will return "" if we can't create the regional. That's a rough // estimate. We do only very limited checking. std::string compositeToRegional(std::string const &symbol, std::string const &exchangeCode); // We could use a better number here, but this will at least avoid the divided // by 0 problem. static const double MIN_VOLATILITY = 0.001; // These are our internal names for the exchanges. These are used in our // database and on our web pages. For the most part the users won't see them, // although they might be part of a url. extern const std::string s_AMEX; extern const std::string s_NASD; extern const std::string s_NYSE; extern const std::string s_NDX; extern const std::string s_ARCA; #endif