ORE Studio 0.0.4
Loading...
Searching...
No Matches
importer.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301, USA.
19 *
20 */
21#ifndef ORES_ORE_XML_IMPORTER_HPP
22#define ORES_ORE_XML_IMPORTER_HPP
23
24#include <vector>
25#include <filesystem>
26#include "ores.logging/make_logger.hpp"
27#include "ores.refdata.api/domain/currency.hpp"
28#include "ores.trading.api/domain/trade.hpp"
29
30namespace ores::ore::xml {
31
46 std::filesystem::path source_file;
47};
48
52class importer {
53private:
54 inline static std::string_view logger_name = "ores.ore.xml.importer";
55
56 static auto& lg() {
57 using namespace ores::logging;
58 static auto instance = make_logger(logger_name);
59 return instance;
60 }
61
62public:
72 static std::string validate_currency(const refdata::domain::currency& currency);
73
74 static std::vector<refdata::domain::currency>
75 import_currency_config(const std::filesystem::path& path);
76
88 static std::string validate_trade(const trading::domain::trade& trade);
89
101 static std::vector<trading::domain::trade>
102 import_portfolio(const std::filesystem::path& path);
103
115 static std::vector<trade_import_item>
116 import_portfolio_with_context(const std::filesystem::path& path);
117};
118
119}
120
121#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Provides XML serialisation support for ORE types.
Definition exporter.hpp:28
A trade with its ORE source context for import mapping.
Definition importer.hpp:43
std::string ore_counterparty_name
ORE CounterParty string, empty if absent.
Definition importer.hpp:45
std::filesystem::path source_file
ORE XML file this trade was read from.
Definition importer.hpp:46
Imports domain objects from their ORE XML representation.
Definition importer.hpp:52
static std::string validate_trade(const trading::domain::trade &trade)
Validates a trade against minimum import requirements.
Definition importer.cpp:81
static std::string validate_currency(const refdata::domain::currency &currency)
Validates a currency against XSD schema requirements.
Definition importer.cpp:35
static std::vector< trade_import_item > import_portfolio_with_context(const std::filesystem::path &path)
Imports trades from an ORE portfolio XML file with mapping context.
Definition importer.cpp:113
static std::vector< trading::domain::trade > import_portfolio(const std::filesystem::path &path)
Imports trades from an ORE portfolio XML file.
Definition importer.cpp:94
Represents a currency with its metadata and formatting rules.
Definition currency.hpp:34
Trade capturing FpML Trade Header properties.
Definition trade.hpp:38