diff --git a/include/dxfeed_graal_cpp_api/model/MarketDepthModel.hpp b/include/dxfeed_graal_cpp_api/model/MarketDepthModel.hpp index 56ee4ed2..f6e764aa 100644 --- a/include/dxfeed_graal_cpp_api/model/MarketDepthModel.hpp +++ b/include/dxfeed_graal_cpp_api/model/MarketDepthModel.hpp @@ -8,18 +8,83 @@ DXFCXX_DISABLE_MSC_WARNINGS_PUSH(4251) #include "../entity/SharedEntity.hpp" +#include "../event/EventSourceWrapper.hpp" +#include "../event/market/OrderBase.hpp" #include "../internal/JavaObjectHandle.hpp" +#include "IndexedTxModel.hpp" +#include "MarketDepthModelListener.hpp" #include #include DXFCPP_BEGIN_NAMESPACE +struct DXFeed; +struct SymbolWrapper; + struct DXFCPP_EXPORT MarketDepthModel : RequireMakeShared { struct DXFCPP_EXPORT Builder : RequireMakeShared { + std::shared_ptr builder; + std::shared_ptr listener; + std::size_t depthLimit; + std::int64_t aggregationPeriodMillis; + + std::shared_ptr withFeed(std::shared_ptr feed) { + builder = builder->withFeed(feed); + + return sharedAs(); + } + + std::shared_ptr withSymbol(const SymbolWrapper &symbol) { + builder = builder->withSymbol(symbol); + + return sharedAs(); + } + + template E> + std::shared_ptr withListener(std::shared_ptr> listener) { + //TODO: implement + + return sharedAs(); + } + + template + std::shared_ptr withSources(EventSourceIt begin, EventSourceIt end) const { + builder = builder->withSources(begin, end); + + return sharedAs(); + } + + template + std::shared_ptr withSources(EventSourceCollection &&sources) const { + return withSources(std::begin(sources), std::end(sources)); + } + + std::shared_ptr withSources(std::initializer_list sources) const; + std::shared_ptr withDepthLimit(std::size_t depthLimit) const; + + std::shared_ptr withAggregationPeriod(std::int64_t aggregationPeriodMillis) const; + + std::shared_ptr withAggregationPeriod(std::chrono::milliseconds aggregationPeriod) const; + + std::shared_ptr build() const; }; + + static std::shared_ptr newBuilder(); + + std::size_t getDepthLimit() const; + + void setDepthLimit(std::size_t depthLimit); + + std::int64_t getAggregationPeriod() const; + + void setAggregationPeriod(std::int64_t aggregationPeriodMillis); + + void setAggregationPeriod(std::chrono::milliseconds aggregationPeriod); + + void close(); }; DXFCPP_END_NAMESPACE diff --git a/include/dxfeed_graal_cpp_api/model/MarketDepthModelListener.hpp b/include/dxfeed_graal_cpp_api/model/MarketDepthModelListener.hpp index a850f177..c12af65f 100644 --- a/include/dxfeed_graal_cpp_api/model/MarketDepthModelListener.hpp +++ b/include/dxfeed_graal_cpp_api/model/MarketDepthModelListener.hpp @@ -16,8 +16,12 @@ DXFCXX_DISABLE_MSC_WARNINGS_PUSH(4251) DXFCPP_BEGIN_NAMESPACE +struct DXFCPP_EXPORT MarketDepthModelListenerCommon : virtual SharedEntity { + +}; + template E> -struct DXFCPP_EXPORT MarketDepthModelListener : RequireMakeShared> { +struct DXFCPP_EXPORT MarketDepthModelListener : MarketDepthModelListenerCommon, RequireMakeShared> { static std::shared_ptr> create(std::function> & /* buy */, const std::vector> & /* sell */)>