-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
129 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
include/dxfeed_graal_cpp_api/ipf/InstrumentProfileType.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) 2023 Devexperts LLC. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
#pragma once | ||
|
||
#include "../internal/Conf.hpp" | ||
|
||
#include "../internal/Common.hpp" | ||
|
||
#include <cstdint> | ||
|
||
namespace dxfcpp { | ||
|
||
/** | ||
* Defines standard types of InstrumentProfile. Note that other (unknown) types | ||
* can be used without listing in this class - use it for convenience only. | ||
* Please see <b>Instrument Profile Format</b> documentation for complete description. | ||
*/ | ||
struct InstrumentProfileType : Enum<InstrumentProfileType, std::uint32_t> { | ||
using Enum::Enum; | ||
|
||
static const DXFCPP_EXPORT InstrumentProfileType CURRENCY; | ||
static const DXFCPP_EXPORT InstrumentProfileType FOREX; | ||
static const DXFCPP_EXPORT InstrumentProfileType BOND; | ||
static const DXFCPP_EXPORT InstrumentProfileType INDEX; | ||
static const DXFCPP_EXPORT InstrumentProfileType STOCK; | ||
static const DXFCPP_EXPORT InstrumentProfileType ETF; | ||
static const DXFCPP_EXPORT InstrumentProfileType MUTUAL_FUND; | ||
static const DXFCPP_EXPORT InstrumentProfileType MONEY_MARKET_FUND; | ||
static const DXFCPP_EXPORT InstrumentProfileType PRODUCT; | ||
static const DXFCPP_EXPORT InstrumentProfileType FUTURE; | ||
static const DXFCPP_EXPORT InstrumentProfileType OPTION; | ||
static const DXFCPP_EXPORT InstrumentProfileType WARRANT; | ||
static const DXFCPP_EXPORT InstrumentProfileType CFD; | ||
static const DXFCPP_EXPORT InstrumentProfileType SPREAD; | ||
static const DXFCPP_EXPORT InstrumentProfileType OTHER; | ||
static const DXFCPP_EXPORT InstrumentProfileType REMOVED; | ||
}; | ||
|
||
template <> | ||
const std::unordered_map<InstrumentProfileType::CodeType, std::reference_wrapper<const InstrumentProfileType>> | ||
InstrumentProfileType::ParentType::ALL; | ||
|
||
} // namespace dxfcpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright (c) 2023 Devexperts LLC. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
#include <dxfg_api.h> | ||
|
||
#include <dxfeed_graal_c_api/api.h> | ||
#include <dxfeed_graal_cpp_api/api.hpp> | ||
|
||
#include <cstring> | ||
#include <memory> | ||
#include <utf8.h> | ||
#include <utility> | ||
|
||
namespace dxfcpp { | ||
|
||
const InstrumentProfileType InstrumentProfileType::CURRENCY{0, "CURRENCY"}; | ||
const InstrumentProfileType InstrumentProfileType::FOREX{1, "FOREX"}; | ||
const InstrumentProfileType InstrumentProfileType::BOND{2, "BOND"}; | ||
const InstrumentProfileType InstrumentProfileType::INDEX{3, "INDEX"}; | ||
const InstrumentProfileType InstrumentProfileType::STOCK{4, "STOCK"}; | ||
const InstrumentProfileType InstrumentProfileType::ETF{5, "ETF"}; | ||
const InstrumentProfileType InstrumentProfileType::MUTUAL_FUND{6, "MUTUAL_FUND"}; | ||
const InstrumentProfileType InstrumentProfileType::MONEY_MARKET_FUND{7, "MONEY_MARKET_FUND"}; | ||
const InstrumentProfileType InstrumentProfileType::PRODUCT{8, "PRODUCT"}; | ||
const InstrumentProfileType InstrumentProfileType::FUTURE{9, "FUTURE"}; | ||
const InstrumentProfileType InstrumentProfileType::OPTION{10, "OPTION"}; | ||
const InstrumentProfileType InstrumentProfileType::WARRANT{11, "WARRANT"}; | ||
const InstrumentProfileType InstrumentProfileType::CFD{12, "CFD"}; | ||
const InstrumentProfileType InstrumentProfileType::SPREAD{13, "SPREAD"}; | ||
const InstrumentProfileType InstrumentProfileType::OTHER{14, "OTHER"}; | ||
const InstrumentProfileType InstrumentProfileType::REMOVED{15, "REMOVED"}; | ||
|
||
template <> | ||
const std::unordered_map<InstrumentProfileType::CodeType, std::reference_wrapper<const InstrumentProfileType>> | ||
InstrumentProfileType::ParentType::ALL = | ||
[](std::initializer_list<std::reference_wrapper<const InstrumentProfileType>> orders) { | ||
std::unordered_map<InstrumentProfileType::CodeType, std::reference_wrapper<const InstrumentProfileType>> | ||
result{}; | ||
|
||
for (auto &&o : orders) { | ||
result.emplace(o.get().getCode(), o); | ||
} | ||
|
||
return result; | ||
}({InstrumentProfileType::CURRENCY, InstrumentProfileType::FOREX, InstrumentProfileType::BOND, | ||
InstrumentProfileType::INDEX, InstrumentProfileType::STOCK, InstrumentProfileType::ETF, | ||
InstrumentProfileType::MUTUAL_FUND, InstrumentProfileType::MONEY_MARKET_FUND, InstrumentProfileType::PRODUCT, | ||
InstrumentProfileType::FUTURE, InstrumentProfileType::OPTION, InstrumentProfileType::WARRANT, | ||
InstrumentProfileType::CFD, InstrumentProfileType::SPREAD, InstrumentProfileType::OTHER, | ||
InstrumentProfileType::REMOVED}); | ||
|
||
} // namespace dxfcpp |