FastMM documentation
FastMM C++ API 0.14.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
position.hpp File Reference

Position tracking, average-cost method (5.8). More...

#include "fastmm/core/config_macros.hpp"
#include "fastmm/core/enums.hpp"
#include "fastmm/core/fixed_point.hpp"
#include "fastmm/core/fx.hpp"
#include "fastmm/core/instrument.hpp"
#include "fastmm/core/strong_id.hpp"
#include <array>
#include <cstddef>
#include <cstdint>
#include <memory>

Go to the source code of this file.

Classes

struct  fastmm::Position
 
struct  fastmm::Portfolio
 PnL totals over every instrument (StrategyContext::portfolio()), in the reporting currency when the tracker converts (PositionTracker::set_accounting). More...
 
class  fastmm::PositionTracker
 
struct  fastmm::PositionTracker::Totals
 Totals of one currency, in that currency (converting() only). More...
 

Namespaces

namespace  fastmm
 

Functions

constexpr std::int64_t fastmm::opening_qty (std::int64_t q, Side side, std::int64_t ahead, std::int64_t qty) noexcept
 The part of an order of side for qty that position q does not absorb once ahead (our open orders on that side) has taken its share of the way to zero: what the order opens, raw.
 
constexpr bool fastmm::nearer_zero (std::int64_t q, Side side, std::int64_t ahead, std::int64_t qty) noexcept
 Reduce-only mode: counted as opening_qty counts, the order leaves the position nearer zero than ahead left it.
 
Notional fastmm::notional_share (Notional n, std::int64_t part, std::int64_t qty) noexcept
 part of an order of qty whose notional is n, rounded up (a cap check is not lenient).
 

Detailed Description

Position tracking, average-cost method (5.8).

All arithmetic is integer with __int128 intermediates; realized/unrealized/fees feed the max-loss kill switch.