@@ -524,39 +524,6 @@ std::vector<databento::Compression> Historical::MetadataListCompressions() {
524524 return compressions;
525525}
526526
527- databento::DatasetConditions Historical::MetadataListDatasetConditions (
528- const std::string& dataset, const std::string& start_date,
529- const std::string& end_date) {
530- static const std::string kEndpoint =
531- " Historical::MetadataListDatasetConditions" ;
532- static const std::string kPath =
533- ::BuildMetadataPath (" .list_dataset_conditions" );
534-
535- const nlohmann::json json =
536- client_.GetJson (kPath , httplib::Params{{" dataset" , dataset},
537- {" start_date" , start_date},
538- {" end_date" , end_date}});
539- if (!json.is_object ()) {
540- throw JsonResponseError::TypeMismatch (kEndpoint , " object" , json);
541- }
542- const auto & details_json = CheckedAt (kEndpoint , json, " details" );
543- if (!details_json.is_array ()) {
544- throw JsonResponseError::TypeMismatch (kEndpoint , " details array" , json);
545- }
546- std::vector<DatasetConditionDetail> details;
547- details.reserve (details_json.size ());
548- for (const auto & detail_json : details_json.items ()) {
549- details.emplace_back (DatasetConditionDetail{
550- ParseAt<std::string>(kEndpoint , detail_json.value (), " date" ),
551- FromCheckedAtString<DatasetCondition>(kEndpoint , detail_json.value (),
552- " condition" )});
553- }
554- return {FromCheckedAtString<DatasetCondition>(kEndpoint , json, " condition" ),
555- std::move (details),
556- ParseAt<std::string>(kEndpoint , json, " adjusted_start_date" ),
557- ParseAt<std::string>(kEndpoint , json, " adjusted_end_date" )};
558- }
559-
560527static const std::string kListUnitPricesEndpoint =
561528 " Historical::MetadataListUnitPrices" ;
562529static const std::string kListUnitPricesPath =
@@ -657,6 +624,39 @@ double Historical::MetadataListUnitPrices(const std::string& dataset,
657624 return json;
658625}
659626
627+ databento::DatasetConditionInfo Historical::MetadataGetDatasetCondition (
628+ const std::string& dataset, const std::string& start_date,
629+ const std::string& end_date) {
630+ static const std::string kEndpoint =
631+ " Historical::MetadataGetDatasetCondition" ;
632+ static const std::string kPath =
633+ ::BuildMetadataPath (" .get_dataset_condition" );
634+
635+ const nlohmann::json json =
636+ client_.GetJson (kPath , httplib::Params{{" dataset" , dataset},
637+ {" start_date" , start_date},
638+ {" end_date" , end_date}});
639+ if (!json.is_object ()) {
640+ throw JsonResponseError::TypeMismatch (kEndpoint , " object" , json);
641+ }
642+ const auto & details_json = CheckedAt (kEndpoint , json, " details" );
643+ if (!details_json.is_array ()) {
644+ throw JsonResponseError::TypeMismatch (kEndpoint , " details array" , json);
645+ }
646+ std::vector<DatasetConditionDetail> details;
647+ details.reserve (details_json.size ());
648+ for (const auto & detail_json : details_json.items ()) {
649+ details.emplace_back (DatasetConditionDetail{
650+ ParseAt<std::string>(kEndpoint , detail_json.value (), " date" ),
651+ FromCheckedAtString<DatasetCondition>(kEndpoint , detail_json.value (),
652+ " condition" )});
653+ }
654+ return {FromCheckedAtString<DatasetCondition>(kEndpoint , json, " condition" ),
655+ std::move (details),
656+ ParseAt<std::string>(kEndpoint , json, " adjusted_start_date" ),
657+ ParseAt<std::string>(kEndpoint , json, " adjusted_end_date" )};
658+ }
659+
660660std::size_t Historical::MetadataGetRecordCount (
661661 const std::string& dataset, UnixNanos start, UnixNanos end,
662662 const std::vector<std::string>& symbols, Schema schema) {
@@ -959,8 +959,8 @@ void Historical::TimeseriesStream(const HttplibParams& params,
959959 std::exception_ptr exception_ptr{};
960960 std::mutex exception_ptr_mutex;
961961 // no initialized lambda captures until C++14
962- ScopedThread stream{[this , &channel, &exception_ptr, &exception_ptr_mutex ,
963- ¶ms, &should_continue] {
962+ const ScopedThread stream{[this , &channel, &exception_ptr,
963+ &exception_ptr_mutex, ¶ms, &should_continue] {
964964 try {
965965 this ->client_ .GetRawStream (
966966 kTimeseriesStreamPath , params,
@@ -972,7 +972,7 @@ void Historical::TimeseriesStream(const HttplibParams& params,
972972 channel.Finish ();
973973 } catch (const std::exception&) {
974974 channel.Finish ();
975- std::lock_guard<std::mutex> guard{exception_ptr_mutex};
975+ const std::lock_guard<std::mutex> guard{exception_ptr_mutex};
976976 // rethrowing here will cause the process to be terminated
977977 exception_ptr = std::current_exception ();
978978 }
@@ -990,7 +990,7 @@ void Historical::TimeseriesStream(const HttplibParams& params,
990990 } catch (const std::exception& exc) {
991991 should_continue = false ;
992992 // check if there's an exception from stream thread
993- std::lock_guard<std::mutex> guard{exception_ptr_mutex};
993+ const std::lock_guard<std::mutex> guard{exception_ptr_mutex};
994994 if (exception_ptr) {
995995 std::rethrow_exception (exception_ptr);
996996 }
0 commit comments