This repository contains a C++ application that accomplishes the following tasks:
-
Connect to OKX Crypto Exchange API: ๐ The application connects to the OKX Crypto Exchange API using pure requests without external libraries.
-
Extract Last 1m L1 LOB Data: ๐ Continuously extracts the last 1 minute Level 1 Limit Order Book (LOB) data for BTC-USDT from the OKX API with less than 1-second lag via HTTP Requests and less than 100ms lag via WebSocket connector.
-
Model Difficult Calculation Task: ๐งฎ Implements a separate class for a difficult calculation task, involving memory and time-expensive operations. The task involves solving the equation AX = E, where A is a matrix and E is the identity matrix (inverse matrix of A).
-
Simultaneous Execution: โ๏ธ The application runs the OKX API connector and the difficult calculation task class simultaneously. It logs messages about the number of OKX requests made and the number of heavy tasks completed, demonstrating the correctness of parallel execution.
- C++ compiler
- Standard C++ libraries
- Clone the repository to your local machine.
- Compile the C++ files using your preferred C++ compiler (e.g., g++):
REST: g++ main.cpp -o main CalculationClass.cpp OKXClass.cpp -lcurl -lssl -lcrypto WebSocket: g++ main.cpp -o main CalculationClass.cpp WebSocketClass.cpp -lssl -lcrypto
- Run the compiled executable.
- REST
- main.cpp
- CalculationClass.h
- CalculationClass.cpp
- OKXClass.h
- OKXClass.cpp
- Recycle Bin (contains additional files)
- WebSocket
- main.cpp
- CalculationClass.h
- CalculationClass.cpp
- WebSocketClass.h
- WebSocketClass.cpp
- Recycle Bin (contains additional files)
main.cpp
: Contains the main program logic for the HTTP requests implementation, including the simultaneous execution of the OKX API connector and the difficult calculation task.CalculationClass.h
andCalculationClass.cpp
: Define and implement theCalculationClass
, which handles the difficult calculation task.OKXClass.h
andOKXClass.cpp
: Define and implement theOKXClass
, which connects to the OKX Crypto Exchange API using HTTP requests via libcurl.
main.cpp
: Contains the main program logic for the WebSocket implementation, including the simultaneous execution of the OKX API connector and the difficult calculation task.CalculationClass.h
andCalculationClass.cpp
: Define and implement theCalculationClass
, which handles the difficult calculation task.WebSocketClass.h
andWebSocketClass.cpp
: Define and implement theWebSocketClass
, which connects to the OKX Crypto Exchange API using WebSocket via the WebSocket++ library.
This project is licensed under the MIT License. ๐๐