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

ParamSchedule: parameter updates of a backtest, delivered to the engine at simulated times (ADR-0013). More...

#include "fastmm/core/messages.hpp"
#include "fastmm/core/time.hpp"
#include "fastmm/strategies/param_publisher.hpp"
#include <atomic>
#include <cstddef>
#include <cstdint>
#include <map>
#include <mutex>
#include <thread>
#include <vector>

Go to the source code of this file.

Classes

class  fastmm::sim::ParamSchedule
 

Namespaces

namespace  fastmm
 
namespace  fastmm::sim
 

Detailed Description

ParamSchedule: parameter updates of a backtest, delivered to the engine at simulated times (ADR-0013).

SimDriver hands the earliest update to the engine when its time comes, like any other input, so the journal records it at that time and a replay applies it at the same point.

sim::ParamSchedule schedule; schedule.at(start + seconds(1), update); // an update built elsewhere schedule.set_delay(milliseconds(5)); // sink(): 5 ms after the publish ParamPublisher pub(schedule.sink(backend.clock), strategy.params()); session.set_param_schedule(&schedule); // bt::BacktestSession

Pending updates do not keep a run alive: SimDriver ends when its data does.

threaded_sink() also accepts updates from other threads (a model thread of a Python strategy): they wait in an inbox until SimDriver next looks at the schedule, and are delivered delay() after the simulated time of that moment, which depends on thread timing.