77 lines
2.2 KiB
C++
77 lines
2.2 KiB
C++
#ifdef SPARK_ENABLE_CCAPI
|
|
|
|
#include "CCMain.h"
|
|
#include "lib/api/md/MarketDataConfig.pb.h"
|
|
#include "lib/config/config.h"
|
|
#include "lib/config/protos/market_data.pb.h"
|
|
#include "lib/logging/logging.h"
|
|
#include "lib/md/GeneralMarketDataListener.h"
|
|
#include "lib/md/GeneralSecurityIndex.h"
|
|
#include "lib/md/MDProducer.h"
|
|
#include "lib/md/MarketDataGateway.h"
|
|
#include "lib/md/MarketDataRegistration.h"
|
|
#include "lib/md/MarketDataSubscription.h"
|
|
#include "lib/md/SecurityDB.h"
|
|
#include "lib/md/SecurityIDRecorder.h"
|
|
#include "lib/md/ccApi/CCDemoListener.h"
|
|
#include "lib/md/coconut2.h"
|
|
#include "lib/md/common.h"
|
|
#include "lib/md/protos/co2.pb.h"
|
|
#include "lib/os/os.h"
|
|
#include "lib/utils/Dispatcher.h"
|
|
#include "lib/utils/PBUtils.h"
|
|
#include "lib/utils/bts_assert.h"
|
|
#include "lib/utils/bts_chrono.h"
|
|
#include "lib/utils/proto_helper.h"
|
|
#include "lib/utils/thread_manager.h"
|
|
#include "server/sparkd/cmds/crypto/DeribitDemoConfiguration.h"
|
|
#include <emumba-deribit-connector/deribit_listener.h>
|
|
|
|
#include "lib/md/GeneralSecurityIndex.h"
|
|
#include <boost/filesystem.hpp>
|
|
#include <memory>
|
|
#include <optional>
|
|
#include <set>
|
|
|
|
using namespace std;
|
|
|
|
namespace bts::md {
|
|
|
|
struct CCMain::PImpl {
|
|
GeneralSecurityIndex sec_index;
|
|
SecurityIDRecorder recorder;
|
|
MDProducer producer;
|
|
bts::md::MarketDataGateway gw;
|
|
PImpl()
|
|
: sec_index(), recorder(
|
|
{utils::Dispatcher::current(),
|
|
[=](ExchangeKey k) {
|
|
return SecurityKey(sec_index.get_key(k.value()));
|
|
}}),
|
|
producer(bts::co2::PLATFORM_SIM, recorder) {}
|
|
};
|
|
|
|
CCMain::CCMain()
|
|
: // me(std::make_unique<PImpl>()) {
|
|
me(new PImpl()) {
|
|
LOG(md, Info, "CCMain::CCMain constructed on t_id: {} t_name: {}",
|
|
bts::os::get_thread_id(), bts::os::get_thread_name());
|
|
}
|
|
|
|
void CCMain::send_heartbeats() {}
|
|
|
|
CCMain::~CCMain() {}
|
|
|
|
void CCMain::run() {
|
|
LOG(md, Info, "Run::run_ccapi t_id:{} t_name:{}", os::get_thread_id(),
|
|
os::get_thread_name());
|
|
me->gw.run();
|
|
while (true) {
|
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
|
}
|
|
std::cout << "Exiting run_ccapi" << std::endl;
|
|
}
|
|
|
|
} // namespace bts::md
|
|
#endif
|