xbazzi 8861f112f8
All checks were successful
Simple Mirror to GitHub / mirror (push) Successful in 11s
Remove all that nasty html
2025-08-18 21:53:24 -06:00

47 lines
1.2 KiB
C++

#pragma once
// C++ Includes
#include <memory>
#include <queue>
#include <atomic>
#include <thread>
#include <future>
// FastInAHurry includes
#include "Publisher.hh"
#include "utils/ThreadSafeQueue.hh"
#include "utils/ThreadPool.hh"
class Algo {
public:
Algo();
void initialize();
void generate_orders();
void process();
void start_background_processing();
void start_market_data_streaming();
grpc::Status send(trading::Order&);
bool initialized();
void stop();
bool is_running();
void cleanup_completed_futures();
private:
std::queue<trading::Order> _orders;
std::atomic<bool> _initialized{false};
std::atomic<bool> _stopping{false};
std::atomic<bool> _running{false};
std::shared_ptr<Publisher> _pub;
utils::ThreadSafeQueue<trading::Order> _order_queue;
utils::ThreadPool _thread_pool;
std::mutex _orders_mutex;
std::mutex _send_mutex;
std::mutex _futures_mutex;
std::jthread _reader_thread;
std::vector<std::jthread> _worker_threads;
std::vector<std::future<bool>> _futures;
};