1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
//! Finance Library API.
//!
//! The 'finance_api` crate includes several traits that abstract multiple objects
//! related to financial markets and analysis. This crate does not implement any
//! particular feature, but defines a public API that other libraries can import and
//! use without knowing what implementation will be behind.
//!
//! Binary crates shall choose a crate that actually implements the needed traits
//! defined herein. Thus this crate targets other libraries, so these can abstract
//! whether a stock exchange is the _NASDAQ100_ or the _S&P500_.
use fmt;
/// A stock market description.
///
/// The [Market] trait provides an abstract definition of the functionality that is
/// expected for an object that implements a stock Market. This trait follows
/// a facade design-pattern, hence modules can rely on the interface defined herein
/// without worrying about the final implementation for a particular stock market.
///
/// A stock market is a data object that contains information relative to a particular
/// stock exchange, such as the _NASDAQ100_ or the _IBEX35_.
///
/// Key information for every stock market includes:
/// - Opening and closing time.
/// - A collection of stocks that are exchanged in the market.
/// - Monetary unit used.
/// A company description.
///
/// The [Company] trait provides a data object that gathers information for a
/// company that is included in some stock market.
///
/// A `Company` is a description of the features that any company included in a
/// `Market` shall have. It is described as a trait and follows a facade design-pattern.
///
/// Key features of any `Company` object includes:
/// - Short name: This is the name that is most often used to refer to the company
/// in a stock exchange.
/// - Full name: This is the full official name that identifies the company.
/// - ISIN: International Securities Identification Number.
/// - Ticker: The abbreviation that identifies the stock in a market.
/// - Extra ID: National markets usually add internal identifiers to the companies.
/// - Market: A reference to the [Market] in which the company is included.