Skip to content

Commit 48cefaa

Browse files
committed
Move financial examples to their own page
1 parent 51b8ddb commit 48cefaa

File tree

3 files changed

+40
-32
lines changed

3 files changed

+40
-32
lines changed

doc/modules/ROOT/nav.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
** xref:examples.adoc#examples_charconv[`<charconv>`]
77
** xref:examples.adoc#examples_generic_programming[Generic Programming]
88
** xref:examples.adoc#examples_literals_constants[Literals and Constants]
9-
** xref:examples.adoc#examples_finance[Financial Applications]
10-
** xref:examples.adoc#examples_boost_math[Boost.Math Integration]
119
** xref:examples.adoc#examples_format[Formatting]
1210
*** xref:examples.adoc#examples_fmt_format[pass:[{fmt}]]
1311
*** xref:examples.adoc#examples_std_format[`<format>`]
14-
** xref:examples.adoc#examples_print[`<print>`]
12+
*** xref:examples.adoc#examples_print[`<print>`]
13+
* xref:financial_examples.adoc[]
14+
** xref:financial_examples.adoc#examples_boost_math[Boost.Math Integration]
1515
* xref:api_reference.adoc[]
1616
** xref:api_reference.adoc#api_ref_types[Types]
1717
** xref:api_reference.adoc#api_ref_structs[Structs]

doc/modules/ROOT/pages/examples.adoc

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -105,49 +105,28 @@ sin(-0.5) = -0.479426
105105
decimal128_t:
106106
sin(-0.5) = -0.479426
107107
-sin(0.5) = -0.479426
108-
----
108+
....
109+
====
109110

110111
[#examples_literals_constants]
111112
== Literals and Constants
112-
113-
This example can be found in the `examples/` folder as https://github.com/cppalliance/decimal/blob/develop/examples/literals.cpp[literals.cpp].
114-
113+
.This example demonstrates how to construct values using literals, and the usage of numerical constants that are provided by the library
114+
====
115115
[source, c++]
116116
----
117117
include::example$literals.cpp[]
118118
----
119119

120120
Expected Output:
121-
----
121+
....
122122
32-bit Pi: 3.141593
123123
64-bit Pi: 3.141592653589793
124124
32-bit UDL Pi: 3.141593
125125
Rounded UDL has the same value as the 32-bit constant
126126
64-bit UDL Pi: 3.141592653589793
127127
Rounded UDL has the same value as the 64-bit constant
128-
----
129-
130-
[#examples_finance]
131-
== Financial Applications
132-
133-
=== Simple Moving Average
134-
135-
In the examples folder there is a file named `moving_average.cpp`.
136-
This example shows how to parse historical stock data from a file and use it.
137-
This serves as a framework for other calculations for securities.
138-
139-
=== Currency Conversion
140-
In the examples folder there is a file named `currency_conversion.cpp`.
141-
This example shows how to simply convert currencies based off a given exchange rate.
142-
143-
[#examples_boost_math]
144-
== Boost.Math Integration
145-
146-
=== Bollinger Bands
147-
148-
In the examples folder there is a file named `statistics.cpp`.
149-
This example demonstrates how to parse a file, and then leverage Boost.Math to compute statistics of that data set culminating with the values of the Bollinger Bands.
150-
This example could be extended with the simple moving average to create full bands based on the period of the moving average you would like.
128+
....
129+
====
151130

152131
[#examples_format]
153132
== Formatting
@@ -263,7 +242,6 @@ Scientific Format with Specified Precision and Padding:
263242
We can make one final change to our `<format>` example where instead of using `std::cout`, we use pass:[C++23's] `<print>`.
264243
This example can be found in the `examples/` folder as https://github.com/cppalliance/decimal/blob/develop/examples/print.cpp[print.cpp].
265244

266-
267245
.`<print>` Example
268246
====
269247
[source, c++]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
////
2+
Copyright 2023 Matt Borland
3+
Distributed under the Boost Software License, Version 1.0.
4+
https://www.boost.org/LICENSE_1_0.txt
5+
////
6+
7+
[#examples_finance]
8+
= Financial Examples
9+
:idprefix: financial_examples_
10+
11+
== Financial Applications
12+
13+
=== Simple Moving Average
14+
15+
In the examples folder there is a file named `moving_average.cpp`.
16+
This example shows how to parse historical stock data from a file and use it.
17+
This serves as a framework for other calculations for securities.
18+
19+
=== Currency Conversion
20+
In the examples folder there is a file named `currency_conversion.cpp`.
21+
This example shows how to simply convert currencies based off a given exchange rate.
22+
23+
[#examples_boost_math]
24+
== Boost.Math Integration
25+
26+
=== Bollinger Bands
27+
28+
In the examples folder there is a file named `statistics.cpp`.
29+
This example demonstrates how to parse a file, and then leverage Boost.Math to compute statistics of that data set culminating with the values of the Bollinger Bands.
30+
This example could be extended with the simple moving average to create full bands based on the period of the moving average you would like.

0 commit comments

Comments
 (0)