Reducing the logs and couts that were put while interfacing with CC

This commit is contained in:
Taha Afzal committed 2022-10-21 13:36:21 -04:00
1 parent 649be1e74e
commit 4c4bc3d451
2 files changed
+20 -18

No files matched your search

+1 -1
View File
@@ -83,7 +83,7 @@ void CCMain::run() {
size_t n = 0;
while (true) {
std::cout << "Main loop iter " << n + 1 << std::endl << std::endl;
std::cout << "Main loop iter " << n++ << std::endl << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(1));
}
std::cout << "Exiting run_ccapi" << std::endl;
+19 -17
View File
@@ -1,3 +1,4 @@
#include "lib/orderman/orderman_utils/Book.h"
#ifdef SPARK_ENABLE_CCAPI
#include "CCMarketDataListener.h"
@@ -237,10 +238,26 @@ void CCMarketDataListener::on_security_statistics(
handle->handle.set_total_volume(sec_stats.volume.value());
}
void print_books(const domain::Book &book, size_t n_updates) {
auto bids = book[domain::Side::Buy];
auto asks = book[domain::Side::Sell];
size_t idx = 0;
std::cout << "Book no: " << n_updates
<< " sec_id: " << book.security_id().value() << std::endl;
for (const auto &b : bids) {
std::cout << "idx: " << idx++ << " pr: " << b.price
<< " sz: " << b.total_quantity << std::endl;
}
for (const auto &a : asks) {
std::cout << "idx: " << idx++ << " pr: " << a.price
<< " sz: " << a.total_quantity << std::endl;
}
std::cout << "-----------------" << std::endl;
}
void CCMarketDataListener::on_book(const bts::domain::Book &book) {
LOG(md, Info, "CCMarketDataListener::on_book sec_id: {}",
LOG(md, Diag, "CCMarketDataListener::on_book sec_id: {}",
book.security_id());
//_temp_add_security();
me->n_bk_updates++;
auto handle = _find_handle(book.security_id());
if (handle == nullptr) {
@@ -252,21 +269,6 @@ void CCMarketDataListener::on_book(const bts::domain::Book &book) {
copy_books(book, me->bids, bts::domain::Side::Value::Buy);
copy_books(book, me->asks, bts::domain::Side::Value::Sell);
handle->handle.update_direct(utils::TimeStamp::now(), me->bids, me->asks);
auto bids = book[domain::Side::Buy];
auto asks = book[domain::Side::Sell];
size_t idx = 0;
std::cout << "Book no: " << me->n_bk_updates
<< " sec_id: " << book.security_id().value() << std::endl;
for (const auto &b : bids) {
std::cout << "idx: " << idx++ << " pr: " << b.price
<< " sz: " << b.total_quantity << std::endl;
}
for (const auto &a : asks) {
std::cout << "idx: " << idx++ << " pr: " << a.price
<< " sz: " << a.total_quantity << std::endl;
}
std::cout << "-----------------" << std::endl;
}
void CCMarketDataListener::on_trades(