algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
conversion.hpp File Reference

Conversions between exact Decimal64 values and the analytics Scalar. More...

#include "./numeric.hpp"
#include <algotradelib/core>
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <limits>
#include <optional>
Include dependency graph for conversion.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  algotradelib
 The library: broker-neutral types (core), and the modules below.
namespace  algotradelib::analytics
 Returns, rolling statistics, indicators and performance metrics over numeric series.

Functions

Scalar algotradelib::analytics::to_scalar (const Decimal64 &value)
 Converts an exact decimal to the nearest Scalar.
std::optional< Decimal64 > algotradelib::analytics::to_decimal (Scalar value, std::uint8_t scale)
 Converts a Scalar to an exact decimal with a given number of decimal places.
std::optional< Decimal64 > algotradelib::analytics::round_scalar_to_tick (Scalar value, const PriceRule &rule, OrderSide side, std::uint8_t scale=0)
 Converts a computed value into a price an order can carry.

Detailed Description

Conversions between exact Decimal64 values and the analytics Scalar.

Use to_scalar to analyze a price or quantity, and round_scalar_to_tick to turn a computed value back into an order price.

Definition in file conversion.hpp.