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

The events a runner delivers to a strategy's handlers, and the market phase. More...

#include <algotradelib/core>
#include <array>
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <optional>
#include <ratio>
#include <string>
#include <utility>
#include <vector>
Include dependency graph for event.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  algotradelib::strategy::SessionWindow
 The intraday session of a market, as the operator states it. More...
struct  algotradelib::strategy::BarEvent
 One bar, delivered to on_bar. More...
struct  algotradelib::strategy::SessionEdge
 Whether a bar opens or closes its session, as SessionEdges::next decided it. More...
class  algotradelib::strategy::SessionEdges
 Follows a strategy's bars and says which bar opens its session and which closes it, by the session window, whatever the bar interval. More...
struct  algotradelib::strategy::BarSlice
 Every instrument's bar of one interval for one period end, delivered to on_bars. More...
struct  algotradelib::strategy::QuoteEvent
 A quote the runner has just read, delivered to on_quote. More...
struct  algotradelib::strategy::DataEvent< T >
 A record of data from outside the broker, delivered to on_data. More...
struct  algotradelib::strategy::Fill
 One execution of an order the strategy placed, delivered to on_fill. More...

Namespaces

namespace  algotradelib
 The library: broker-neutral types (core), and the modules below.
namespace  algotradelib::strategy
 What a strategy sees and emits: events, intents, the portfolio, reconciliation and risk limits.

Enumerations

enum class  algotradelib::strategy::MarketPhase {
  algotradelib::strategy::UNKNOWN , algotradelib::strategy::CLOSED , algotradelib::strategy::PRE_OPEN , algotradelib::strategy::OPEN ,
  algotradelib::strategy::POST_CLOSE
}
 Where the clock stands relative to the trading session. More...

Functions

constexpr std::string_view algotradelib::strategy::market_phase_name (MarketPhase phase) noexcept
 Returns a lowercase name for a phase, such as "pre_open", for logs and display.
constexpr bool algotradelib::strategy::market_phase_session_ended (MarketPhase phase) noexcept
 Tests whether a phase means the day's session is over (or never opened), so a day order no longer works.
MarketPhase algotradelib::strategy::stated_session_phase (const TradingCalendar &calendar, std::chrono::system_clock::time_point now)
 Returns the market phase at an instant from the session hours filled in a calendar.
std::chrono::system_clock::time_point algotradelib::strategy::bar_period_end (const Bar &bar, BarInterval interval, BarStamp stamp)
 Computes the instant a bar's period ended.
BarEvent algotradelib::strategy::make_bar_event (InstrumentId instrument, BarInterval interval, BarStamp stamp, Bar bar)
 Makes a bar event, computing its period_end_ with bar_period_end.
std::optional< std::chrono::system_clock::time_point > algotradelib::strategy::bar_period_start (const BarEvent &event, const SessionWindow &session)
 Returns when a bar's period began, where the bar says so.

Variables

constexpr std::array< MarketPhase, 5 > algotradelib::strategy::all_market_phases
 Every MarketPhase, in declaration order.

Detailed Description

The events a runner delivers to a strategy's handlers, and the market phase.

Each event is complete when the handler receives it; a handler decides and returns without requesting more data.

Definition in file event.hpp.