-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 86393ca
Showing
27 changed files
with
27,821 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
EVDS_APIKEY=ABCDEFG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: CMake Build and Test | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
env: | ||
BUILD_TYPE: Release | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# Set up EVDS_APIKEY environment variable from GitHub Secrets | ||
- name: Set up EVDS API Key | ||
run: echo "EVDS_APIKEY=${{ secrets.EVDS_APIKEY }}" >> $GITHUB_ENV | ||
|
||
# Install dependencies, including libcurl | ||
- name: Install Dependencies | ||
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev | ||
|
||
|
||
- name: Configure CMake | ||
# run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | ||
run : mkdir build ; cd build ; cmake .. ; make | ||
|
||
# - name: Build | ||
# run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | ||
|
||
- name: Test | ||
run: ${{github.workspace}}/build/bin/evdscpp bie_yssk --test true | ||
|
||
|
||
# - name: Test | ||
# working-directory: ${{github.workspace}}/build | ||
# run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.caches/ | ||
*.xlsx | ||
output/Demo* | ||
_deps/ | ||
--/ | ||
build/*.* | ||
build/*/ | ||
|
||
build/ | ||
.vscode/ | ||
|
||
.env | ||
.json | ||
|
||
*.csv | ||
|
||
evdscpp | ||
evdscpp.dSYM | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
|
||
cmake_minimum_required(VERSION 3.20) | ||
project(evdscpp LANGUAGES CXX) | ||
|
||
|
||
# Top-level CMakeLists.txt | ||
|
||
# Set output directories for executables and libraries | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
|
||
|
||
|
||
# Enable testing | ||
enable_testing() | ||
|
||
set(CMAKE_CXX_STANDARD 20) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
include_directories(include) | ||
include_directories(extern/nlohmann) # External dependencies | ||
include_directories(extern/dotenv) # External dependencies | ||
|
||
find_package(CURL REQUIRED) | ||
|
||
add_subdirectory(src) | ||
|
||
add_subdirectory(tests) | ||
|
||
|
||
|
||
|
||
# #======================================================================================================================= | ||
# # Valgrind check target | ||
# #======================================================================================================================= | ||
# find_program(VALGRIND "valgrind") | ||
|
||
# if (VALGRIND) | ||
# add_custom_target(valgrind_check | ||
# COMMAND ${VALGRIND} --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose | ||
# $<TARGET_FILE:evdscpp> | ||
# COMMENT "Running Valgrind memory check on evdscpp" | ||
# DEPENDS evdscpp | ||
# ) | ||
# else() | ||
# message(WARNING "Valgrind not found. 'valgrind_check' target will not be available.") | ||
# endif() | ||
|
||
|
||
|
||
# Enable AddressSanitizer for memory error detection | ||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -g") | ||
|
||
|
||
#======================================================================================================================= | ||
# Build instructions | ||
#======================================================================================================================= | ||
# To build and run the project: | ||
# mkdir build | ||
# cd build | ||
# cmake .. | ||
# make | ||
# ./evdscpp | ||
# | ||
# To run Valgrind check: | ||
# make valgrind_check | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Sermet Pekin | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
[![CMake Build and Test](https://github.com/SermetPekin/evdscpp/actions/workflows/cmake-single-platform.yml/badge.svg?1)](https://github.com/SermetPekin/evdscpp/actions/workflows/cmake-single-platform.yml?1) | ||
|
||
## evdscpp | ||
|
||
To build use this | ||
```bash | ||
|
||
mkdir build | ||
cd build | ||
|
||
cmake .. | ||
make | ||
./evdscpp | ||
|
||
``` | ||
|
||
|
||
# evdscpp | ||
|
||
**evdscpp** is a C++ library for fast, efficient, and user-friendly interaction with the EVDS API Server. Designed with performance in mind, it provides built-in caching, an Excel export option, and an intuitive user interface for configuring and retrieving data. `evdscpp` can be extended for integration with other C++ projects and offers options for use as a standalone application. | ||
|
||
## Features | ||
|
||
- **Fast Data Fetching**: Optimized C++ code enables quick and efficient data retrieval from the EVDS API. | ||
- **Caching**: Caches results locally to avoid redundant requests, minimizing API calls and improving performance. | ||
- **Excel Export**: Automatically exports data to Excel format for easy analysis and sharing. | ||
- **Configuration Support**: Reads configuration files for API keys, date ranges, and other options. | ||
- **Command-Line Interface**: Simple and flexible CLI for specifying data queries and configuration options. | ||
- **Extensible for Other Projects**: Can be used as a library in other C++ projects, enabling seamless data access from the EVDS API. | ||
|
||
## Build Instructions | ||
|
||
To build `evdscpp`, use the following commands: | ||
|
||
```bash | ||
cd src/build | ||
cmake .. | ||
make | ||
./evdscpp | ||
``` | ||
|
||
|
||
|
||
|
||
## Environment Configuration | ||
|
||
This project uses an `.env` file to store sensitive information, such as your EVDS API key. The `.env` file should be created in the root directory of the project to keep your API keys and other sensitive information secure and organized. | ||
|
||
### Example `.env` File | ||
|
||
Below is an example of what your `.env` file might look like. Replace `ABCDEFG` with your actual API key. | ||
|
||
``` | ||
# .env file | ||
# EVDS API key for authenticating API requests | ||
EVDS_APIKEY=ABCDEFG | ||
``` | ||
|
||
### Usage | ||
|
||
The program automatically reads the `.env` file and retrieves the `EVDS_APIKEY` value when making requests to the EVDS API. Ensure that this file is present in the root directory before running the program. | ||
|
||
|
||
### How to Get Your EVDS API Key | ||
|
||
You can obtain a free EVDS API key by registering on the EVDS website provided by the Central Bank of Turkey. Visit [EVDS API Documentation and Key Registration](https://evds2.tcmb.gov.tr/index.php?/evds/userDocs) to sign up and receive your API key. | ||
|
||
|
||
|
||
|
||
## Example Usage | ||
|
||
```bash | ||
# 1. each index will have its own file : | ||
./evdscpp TP.DK.USD.A,TP.DK.EUR.A | ||
|
||
|
||
# 2 two indexes in the same file : | ||
./evdscpp TP.DK.USD.A-TP.DK.EUR.A | ||
|
||
# 3. Using indexes with named arguments: | ||
./evdscpp TP.DK.USD.A,TP.DK.EUR.A --start_date 01-01-2021 --end_date 31-12-2021 --cache true | ||
|
||
# Another example with a different index: | ||
./evdscpp bie_yssk --cache true | ||
|
||
# Another example with a 3 different indexes : | ||
# this will create two different files. One for the first index `bie_yssk` and one for these indexes TP.DK.USD.A-TP.DK.EUR.A | ||
./evdscpp bie_yssk,TP.DK.USD.A-TP.DK.EUR.A --cache true | ||
|
||
``` | ||
|
||
|
||
|
||
## Manual Compilation | ||
|
||
If you prefer to compile `evdscpp` manually, you can use the following `g++` command. Make sure you have all necessary dependencies, including `libcurl` and `nlohmann-json`, installed and available in your include/library paths. | ||
|
||
```bash | ||
g++ -g -o ./evdscpp ./src/main.cpp -lcurl -I./include -L./extern/nlohmann --std=c++20 | ||
|
||
``` | ||
|
||
### Explanation of the Command | ||
|
||
- `-g`: Enables debugging information in the compiled binary. | ||
- `-o ./evdscpp`: Specifies the output path and name of the compiled executable (`./evdscpp`). | ||
- `./src/main.cpp`: The main source file for your program. | ||
- `-lcurl`: Links the `libcurl` library, necessary for making HTTP requests. | ||
- `-L./extern/nlohmann`: Specifies the path to the `nlohmann-json` library. Adjust this path based on your setup. | ||
- `--std=c++20`: Specifies the C++ standard to use (C++20). | ||
|
||
After running this command, you should have an executable `evdscpp` located in the current directory. | ||
|
||
|
||
|
||
## Configuration | ||
|
||
`evdscpp` reads configuration parameters directly from the command line. You can specify options such as: | ||
|
||
- **`--start_date`**: The start date for the data request (format: DD-MM-YYYY). | ||
- **`--end_date`**: The end date for the data request (format: DD-MM-YYYY). | ||
- **`--cache`**: Set to `true` to enable caching, which reduces redundant API requests. | ||
|
||
If no start or end dates are specified, `evdscpp` defaults to a predefined date range. | ||
|
||
## Integration with Other C++ Projects | ||
|
||
`evdscpp` is designed to be easily integrated into other C++ projects, allowing developers to fetch data from the EVDS API with minimal setup. Simply include the library in your project and use the available functions. | ||
|
||
## License | ||
|
||
This project is licensed under the MIT License. See the `LICENSE` file for details. | ||
|
||
|
||
## About This Project | ||
|
||
This project is an open-source data wrapper designed to connect to the EVDS API provided by the Central Bank of the Republic of Türkiye. It enables users to easily access and retrieve economic data through a simplified interface. | ||
|
||
**Note:** This project is not affiliated with, endorsed, or supported by the Central Bank of Turkey. It is an independent tool developed solely to assist users in interacting with the EVDS API. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
```mermaid | ||
classDiagram | ||
%% High-level components and relationships in main.cpp | ||
class Config { | ||
%% Configuration for data requests | ||
+ cache: bool | ||
+ start_date: std::string | ||
+ end_date: std::string | ||
} | ||
class DataFrame { | ||
%% Represents tabular data with columns as Series | ||
+ to_excel(filename: std::string): void | ||
+ print(): void | ||
+ show(): void | ||
+ operator[](col: std::string): Series | ||
} | ||
class Series { | ||
%% Represents a single column of data in DataFrame | ||
+ values(): std::vector<double> | ||
+ size(): size_t | ||
+ at(index: size_t): T | ||
+ print(): void | ||
} | ||
class get_series { | ||
%% Fetches data based on the index and configuration | ||
+ get_series(index: std::string, config: Config): DataFrame | ||
} | ||
class getShortFilename { | ||
%% Utility function to generate concise filenames | ||
+ getShortFilename(input: std::string): std::string | ||
} | ||
class check_df { | ||
%% Utility function to check a specific column in DataFrame | ||
+ check_df(df: DataFrame, col: std::string): std::vector<double> | ||
} | ||
%% External Dependencies | ||
class JSONParser { | ||
%% External library for JSON parsing | ||
+ parse(res: std::string): JSONParser | ||
} | ||
%% Define Relationships Between Components | ||
main --> Config : creates | ||
main --> get_series : calls | ||
get_series --> DataFrame : returns | ||
DataFrame --> Series : holds columns as Series | ||
main --> check_df : calls | ||
main --> getShortFilename : calls | ||
check_df --> Series : retrieves column values | ||
get_series --> JSONParser : parses response |
Oops, something went wrong.