PineForge v0.13.1-379-g9b50973
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
native_fx_curve.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <cstdint>
5#include <vector>
6
7namespace pineforge {
8inline namespace native_fx_curve_v1 {
9
10/// An immutable account-currency FX curve: parallel arrays of effective-from
11/// timestamps in epoch milliseconds and the account-currency units per one unit of
12/// the symbol's quote currency. The latest point whose timestamp is at or before
13/// the current broker event is active, and NativeRunSpec::account_fx is the
14/// fallback before the first point. Staged with
15/// NativeStrategyHost::configure_native_fx_curve while the host is Ready, it is
16/// the run's FX epoch for a batch and a confirmed-bar stream alike, and a step of
17/// it is a NativeMarginCheckKind::FxRoll check point. Pinned by
18/// tests/test_native_fx_curve.cpp and tests/test_native_margin_fx_roll.cpp.
20 std::vector<std::int64_t> effective_from_ms;
21 std::vector<double> account_per_quote;
22};
23
24/// Why a curve was refused. LengthMismatch means the two arrays differ in length
25/// (reported at index 0); NotStrictlyIncreasing and NotFinitePositive name the
26/// first bad timestamp or rate; WrongPhase means the host was no longer Ready.
27/// A refusal leaves the staged curve as it was.
36
37/// What validate_native_fx_curve and configure_native_fx_curve report: the error
38/// and the index of the element that failed. Success is None at index 0, and so
39/// is an empty pair of arrays, which clears the curve.
44
45// Empty parallel arrays are valid and represent clearing the curve. Length
46// mismatch reports index 0; otherwise the first bad element wins, with its
47// timestamp checked before its rate. Success reports None/index 0.
49
50// Total for any vector lengths: fold both lengths, timestamps first, then
51// ordered timestamp/rate bit pairs through the shorter vector. Empty arrays
52// fold two zero lengths. Validation remains the gate for using a curve.
53std::uint64_t native_fx_curve_digest(const NativeFxCurve& curve) noexcept;
54
55} // inline namespace native_fx_curve_v1
56} // namespace pineforge
NativeFxCurveValidation validate_native_fx_curve(const NativeFxCurve &curve) noexcept
NativeFxCurveError
Why a curve was refused.
std::uint64_t native_fx_curve_digest(const NativeFxCurve &curve) noexcept
What validate_native_fx_curve and configure_native_fx_curve report: the error and the index of the el...
An immutable account-currency FX curve: parallel arrays of effective-from timestamps in epoch millise...