JayBeams  0.1
Another project to have fun coding.
security_id.hpp
Go to the documentation of this file.
1 #ifndef jb_mktdata_security_id_hpp
2 #define jb_mktdata_security_id_hpp
3 
4 #include <boost/endian/buffers.hpp>
5 
6 namespace jb {
7 namespace mktdata {
8 
9 /**
10  * Security identifiers in JayBeam messages.
11  *
12  * Market feeds often use a short string (or sometimes a number,
13  * represented as a decimal string) to represent a security.
14  * Using strings to represent the most common identifier in market
15  * data applications is wasteful, JayBeams assigns a unique number to
16  * each security, and propagates the number through the system.
17  *
18  * Applications that need to print the identifier in human readable
19  * form, or send it outside the system (say for clearing, or order
20  * placement) need to lookup the identifier in a table.
21  * TODO() - implement the table using etcd and updates from market
22  * feeds.
23  * TODO() - implement the table using a well known list for testing
24  * TODO() - implement the table using flat files for testing
25  */
26 struct security_id {
27  /// The JayBeams internal identifier for the security
28  boost::endian::little_uint32_buf_t id;
29 
30  /**
31  * The maximum size for normalized security tickers in JayBeams.
32  *
33  * We do not have an authoritative source for the maximum ticker
34  * name globally. ISO-6166 (ISIN) only require 12 characters.
35  * In my experience no US equity market requires more than
36  * 8 characters. The US option markets require 21
37  * characters for a security:
38  * https://en.wikipedia.org/wiki/Option_symbol
39  * TODO() - check global markets, particularly Japan and the UK.
40  * Japan as I recall uses a long number, and UK uses SEDOLs.
41  */
42  static constexpr std::size_t normalized_size = 24;
43 
44  /**
45  * The maximum expected size for security tickers in JayBeams.
46  *
47  * See the comment for the normalized ticker sizes.
48  */
49  static constexpr std::size_t feed_size = normalized_size;
50 };
51 
52 } // namespace mktdata
53 } // namespace jb
54 
55 #endif // jb_mktdata_security_id_hpp
Security identifiers in JayBeam messages.
Definition: security_id.hpp:26
boost::endian::little_uint32_buf_t id
The JayBeams internal identifier for the security.
Definition: security_id.hpp:28
static constexpr std::size_t normalized_size
The maximum size for normalized security tickers in JayBeams.
Definition: security_id.hpp:42
The top-level namespace for the JayBeams library.
Definition: as_hhmmss.hpp:7
static constexpr std::size_t feed_size
The maximum expected size for security tickers in JayBeams.
Definition: security_id.hpp:49