Skip to content

Commit

Permalink
.hpp files
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-spooner committed Oct 21, 2023
1 parent ebc1a71 commit 686a4c8
Show file tree
Hide file tree
Showing 37 changed files with 5,060 additions and 5,064 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#pragma once

#include "constants.h"
#include "data_types.h"
#include "engine.h"
#include "limit_buffer.h"
#include "limit_entry_buffer.h"
#include "limit_tree.h"
#include "constants.hpp"
#include "data_types.hpp"
#include "engine.hpp"
#include "limit_buffer.hpp"
#include "limit_entry_buffer.hpp"
#include "limit_tree.hpp"

class Engine;

Expand Down Expand Up @@ -47,8 +47,7 @@ class Book {
Limit* askMin;

bool match_at_limit(Engine& parentEngine, Order& order, Limit& limit);
void update_limit(const bool limitEntryFilled, Limit& limit,
LimitEntry* limitEntry);
void update_limit(const bool limitEntryFilled, Limit& limit, LimitEntry* limitEntry);
void update_limit_entries(Limit* limit, LimitEntry* newEntry, const Order& order);
void refresh_bid_max();
void refresh_ask_min();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <cassert>
#include <string>

#include "constants.h"
#include "constants.hpp"

/**
* Order ID assigned by order entry gateway.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include <unordered_map>

#include "SimpleAmqpClient/SimpleAmqpClient.h"
#include "book.h"
#include "constants.h"
#include "data_types.h"
#include "book.hpp"
#include "constants.hpp"
#include "data_types.hpp"

#ifdef _DEBUG
extern int execNum;
Expand All @@ -26,8 +26,7 @@ class Engine {
bookMap.emplace("FB", std::make_unique<Book>(*this, "FB"));

channel = AmqpClient::Channel::CreateFromUri("amqp://guest:guest@rabbitmq:5672/%2F");
channel->DeclareExchange("stock_exchange", AmqpClient::Channel::EXCHANGE_TYPE_DIRECT,
true);
channel->DeclareExchange("stock_exchange", AmqpClient::Channel::EXCHANGE_TYPE_DIRECT, true);
}

~Engine() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <string>

#include "SimpleAmqpClient/SimpleAmqpClient.h"
#include "engine.h"
#include "engine.hpp"

class EngineOperator {
public:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "data_types.h"
#include "data_types.hpp"

/**
* A buffer to hold the price limits of an order book.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <cassert>

#include "data_types.h"
#include "data_types.hpp"

/**
* A buffer to hold the limit entries for a given book.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <iostream>
#include <optional>

#include "data_types.h"
#include "data_types.hpp"

struct Node {
Limit* limit;
Expand Down
6 changes: 3 additions & 3 deletions core-services/matching-engine/src/book.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "book.h"
#include "book.hpp"

#include <algorithm>
#include <cassert>
Expand Down Expand Up @@ -153,8 +153,8 @@ bool Book::match_at_limit(Engine& parentEngine, Order& order, Limit& limit) {
Order& buyOrder = buySide ? order : currentEntry->order;
Order& sellOrder = buySide ? currentEntry->order : order;
Quantity execQuantity = std::min(order.quantity, currentEntry->order.quantity);
if (execQuantity > 0) { // ignore cancelled orders

if (execQuantity > 0) { // ignore cancelled orders
parentEngine.execute(buyOrder, sellOrder, execQuantity);
buyOrder.quantity -= execQuantity;
sellOrder.quantity -= execQuantity;
Expand Down
6 changes: 3 additions & 3 deletions core-services/matching-engine/src/engine.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "engine.h"
#include "engine.hpp"

#include <stdio.h>
#include <stdlib.h>
Expand All @@ -7,8 +7,8 @@

#include <iostream>

#include "utils/json.h"
#include "utils/logger.h"
#include "utils/json.hpp"
#include "utils/logger.hpp"

#ifdef _DEBUG
int execNum;
Expand Down
4 changes: 2 additions & 2 deletions core-services/matching-engine/src/engine_operator.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "engine_operator.h"
#include "engine_operator.hpp"

#include <arpa/inet.h>
#include <netinet/in.h>
Expand All @@ -7,7 +7,7 @@

#include <iostream>

#include "utils/json.h"
#include "utils/json.hpp"

// Helper functions

Expand Down
2 changes: 1 addition & 1 deletion core-services/matching-engine/src/limit_tree.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "limit_tree.h"
#include "limit_tree.hpp"

Node* LimitTree::makeEmpty(Node* t) {
if (t == nullptr) return nullptr;
Expand Down
6 changes: 3 additions & 3 deletions core-services/matching-engine/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

#include "SimpleAmqpClient/Envelope.h"
#include "SimpleAmqpClient/SimpleAmqpClient.h"
#include "engine_operator.h"
#include "utils/json.h"
#include "utils/logger.h"
#include "engine_operator.hpp"
#include "utils/json.hpp"
#include "utils/logger.hpp"

int init_client(const std::string &host, int port) {
int client_sock = socket(AF_INET, SOCK_STREAM, 0);
Expand Down
2 changes: 1 addition & 1 deletion core-services/matching-engine/src/utils/json.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "utils/json.h"
#include "utils/json.hpp"

#include <stdexcept>

Expand Down
2 changes: 1 addition & 1 deletion core-services/matching-engine/src/utils/logger.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "utils/logger.h"
#include "utils/logger.hpp"

Logger& Logger::get_instance() {
static Logger instance;
Expand Down
Loading

0 comments on commit 686a4c8

Please sign in to comment.