FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.
C++ ai-agentsalgorithmic-tradingbloomberg-terminalcppfinancefinancial-marketsfintechgood-first-issueinvestmentinvestment-researchmachine-learningopensourcepythonqtquantitative-financestock-markettrading
#pragma once
// MacroCalendarService — DataHub producer for the upcoming macro/economic
// events feed served by Fincept's API (`api.fincept.in/macro/upcoming-events`).
//
// Topic: `econ:fincept:upcoming_events`. Payload: `QJsonArray` (the events
// array as returned by the API). One topic, one producer, one HTTP fetch
// per refresh — the hub fans out to the EconomicCalendarWidget and any
// future consumers (report builder, MCP tools, agents).
//
// TTL: 5 min. Min interval: 60 s. Both honour the upstream cache and keep
// rate-limit pressure low.
#include "datahub/Producer.h"
#include <QJsonArray>
#include <QObject>
#include <QString>
#include <QStringList>
namespace fincept::services {
class MacroCalendarService : public QObject, public fincept::datahub::Producer {
Q_OBJECT
public:
static MacroCalendarService& instance();
/// Register with the hub + install the topic policy. Idempotent.
void ensure_registered_with_hub();
// ── fincept::datahub::Producer ────────────────────────────────────────
QStringList topic_patterns() const override;
void refresh(const QStringList& topics) override;
int max_requests_per_sec() const override { return 2; }
private:
explicit MacroCalendarService(QObject* parent = nullptr);
Q_DISABLE_COPY(MacroCalendarService)
bool hub_registered_ = false;
};
} // namespace fincept::services
// QJsonArray is built into QtCore's metatype system — no explicit
// Q_DECLARE_METATYPE needed.