{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Home","text":""},{"location":"#what-is-kekkai","title":"What is Kekkai?","text":"
Kekkai \u2014 The first free Open-Source Tool for Saving Historical Currency data
It is a simple tool for collecting historical currency data from open sources, with the ability to create currency exchange rate charts.
"},{"location":"#why-kekkai","title":"Why Kekkai?","text":"Kekkai is used by Nginx
to redirect to the correct microservice.
Change localhost to your domain
or ipv4
based on your needs. If you need to use Kekkai locally, you don't need to change anything,
...\nserver_name localhost; # Your domain\n...\n
"},{"location":"config/conf-nginx/#change-name-for-ssl","title":"Change name for SSL","text":"This is where the name of the SSL files changes. This needs to be edited if you have a different one
Change privkey.pem
and fullchain.pem
to the names of the files you have.
...\nssl_certificate /etc/nginx/ssl/fullchain.pem;\nssl_certificate_key /etc/nginx/ssl/privkey.pem;\n...\n
"},{"location":"config/config-env/","title":"Configure .env","text":"Kekkai can be configured using the .env
file in the working directory. .env.example
.
.env
config is used to configure PosgreSQL running in Docker Compose.
Info
If you are not using Docker Compose, you do not need to edit this config
Example file.env.example
# Connection secret for postgres. You should change it to a random password\n# Please use only the characters `A-Za-z0-9`, without special characters or spaces\n\nPOSTGRES_PASSWORD=my_password\n\n# If you do not know what you are doing, then you should not edit the values below\n###################################################################################\nPOSTGRES_DB=kekkai\nDB_HOST=postgres\nPOSTGRES_USER=postgres\n
This config only edits the password for PosgreSQL.
Please use only the characters A-Za-z0-9
, without special characters or spaces
Kekkai can be configured using the config.yaml
file in the working directory. config.example.yaml
.
config.example.yaml
# For more information, see the documentation\n# https://kekkai-docs.redume.su/\n\ndatabase:\n user: 'DATABASE_USERNAME'\n password: 'DATABASE_PASSWORD'\n host: 'DATABASE_HOST'\n name: 'DATABASE_NAME'\n port: 5432\nserver:\n host: '0.0.0.0'\n ssl:\n private_key: '/CertSSL/privkey.pem'\n cert: '/CertSSL/fullchain.pem'\n work: true\n log:\n print: true\n level: 'info'\nanalytics:\n plausible_api: 'https://plausible.io/api/event/'\n plausible_domain: 'PLAUSIBLE_DOMAIN'\n plausible_token: 'PLAUSIBLE_TOKEN'\n work: true\ncurrency:\n chart:\n save: false\n collecting:\n fiat: true\n schedule: '30 8 * * *'\n fiat:\n - USD\n - RUB\n - EUR\n - UAH\n - TRY\n - KZT\n
"},{"location":"config/config-yaml/#database","title":"Database","text":"Kekkai is used as a PostgreSQL
database.
Info
If you installed Kekkai via Docker Compose, then install it in the database.host
value of postgres
. The rest of the data does not have to be filled in. They need to be filled in .env
.
What should it look like:
database:\n ...\n host: 'postgres'\n ...\n...\n
"},{"location":"config/config-yaml/#server","title":"Server","text":"Info
If you installed Kekkai via Docker Compose, then changing server.host
, server.ssl
is not recommended.
Create a folder CertSSL to store your certificates
mkdir CertSSL\n
Copy your certificates to the CertSSL folder.
It is recommended to rename the certificates to privkey.pem
and fullchain.pem
. If this is not possible, you need to change the SSL name in nginx.conf
(if using Docker Compose)
Kekkai uses Plausbile
as an analyst. Minimal data is transferred for anilithics. Such as: browser, OS, status code, url, where the user came from. Most of the data is built on User Agent. It is possible to disable analytics in Kekkai.
...\nanalytics:\n plausible_api: 'https://plausible.io/api/event/'\n plausible_domain: 'PLAUSIBLE_DOMAIN'\n plausible_token: 'PLAUSIBLE_TOKEN'\n work: true\n...\n
plausible_api
: This is where the Plausible instance is specified. The official instance is specified by default.plausible_domain
: Kekkai Instance Domain. It should be added to Plausible first, and then to the config. You can add the domain here.plausible_token
: Api token for authorization and sending requests. You can create it here.work
: Enable or disable analytics. DuckDuckGo
(fiat currency collection) and CoinMarketCap
(cryptocurrency collection) are used to collect currency rates.
...\ncurrency:\n chart:\n save: false # Enable or disable saving graphs to an image (Boolean)\n collecting:\n fiat: true # Turn off or turn on the collection of the fiat currency rate [Boolean]\n crypto: false\n schedule: '30 8 * * *' # Currency collection schedule in crontab format [String]\n crypto_apikey: 'APIKEY'\n fiat: # List of fiat currency to save the exchange rate [Array]\n - USD\n - RUB\n - EUR\n - UAH\n - TRY\n - KZT\n crypto:\n - ETH\n - TON\n - USDT\n
currency.chart.save
: Enable or disable saving graphs.currency.collecting
: Enable or disable cryptocurrency or fiat currency exchange rate collection.currency.schedule
: Currency collection interval (Configurable via cron. It is recommended to use crontab.guru, not supported in Non-standard format
, like @daily
).crypto.crypto_apiKey
: API-key from CoinMarketCap servicecurrency.fiat
: A list of fiat currencies that will be saved to the database.currency.crypto
: A list of crypto currencies that will be saved to the database.Creating a currency rate chart.
"},{"location":"endpoints/create-chart/#creating-a-graph-for-a-certain-period","title":"Creating a graph for a certain period","text":""},{"location":"endpoints/create-chart/#request","title":"Request","text":"ShellPythonNode.JS Curlcurl --request GET \\\n--url https://kekkai-api.redume.su/api/getChart/week?from_currency=RUB&conv_currency=USD\n
Request import requests\n\nres = requests.get('https://kekkai-api.redume.su/api/getChart/week', {\n 'from_currency': 'USD',\n 'conv_currency': 'RUB',\n}, timeout=3)\n\nprint(res.json())\n
Axios const axios = require('axios');\n\naxios.get('https://kekkai-api.redume.su/api/getChart/week', {\n timeout: 3000,\n 'from_currency': 'USD',\n 'conv_currency': 'RUB', \n})\n .then((res) => {\n console.log(res['data']);\n })\n .catch((err) => {\n console.error(err);\n });\n
"},{"location":"endpoints/create-chart/#query-params","title":"Query params","text":"Parameter Description from_currency
* ISO 4217
code of the currency from which the conversion takes place conv_currency
* ISO 4217
code of the currency to which the conversion is performed"},{"location":"endpoints/create-chart/#url-params","title":"URL params","text":"Parameter Description period
Available parameters: week
, month
, quarter
, year
*
- Required arguments
Output
{\n \"status\": 201,\n \"message\": \"http://kekkai-api.redume.su/static/charts/RUB_USD_20241108_DQVDN7.png\"\n}\n
"},{"location":"endpoints/create-chart/#creating-a-schedule-for-specific-days","title":"Creating a schedule for specific days","text":""},{"location":"endpoints/create-chart/#request_1","title":"Request","text":"ShellPythonNode.JS Curl curl --request GET \\\n--url https://kekkai-api.redume.su/api/getChart/?\nfrom_currency=RUB&\nconv_currency=USD&\nstart_date=2024-10-31&\nend_date=2024-11-08\n
Request import requests\n\nres = requests.get('https://kekkai-api.redume.su/api/getChart/', {\n 'from_currency': 'USD',\n 'conv_currency': 'RUB',\n 'start_date': '2024-10-31',\n 'end_date': '2024-11-08'\n}, timeout=3)\n\nprint(res.json())\n
Axios const axios = require('axios');\n\naxios.get('https://kekkai-api.redume.su/api/getChart/', {\n timeout: 3000,\n 'from_currency': 'USD',\n 'conv_currency': 'RUB', \n 'start_date': '2024-10-31',\n 'end_date': '2024-11-08'\n})\n .then((res) => {\n console.log(res['data']);\n })\n .catch((err) => {\n console.error(err);\n });\n
"},{"location":"endpoints/create-chart/#query-params_1","title":"Query params","text":"Parameter Description from_currency
* ISO 4217
code of the currency from which the conversion takes place conv_currency
* ISO 4217
code of the currency to which the conversion is performed start_date
* Start date of the period in the format YYYYY-DD-MM
end_date
* Period end date in the format YYYYY-DD-MM
*
- Required arguments
Output
{\n \"status\": 400,\n \"message\": \"http://kekkai-api.redume.su/static/charts/RUB_USD_20241108_1T2RI3.png\"\n}\n
"},{"location":"endpoints/create-chart/#what-the-name-of-the-chart-file-consists-of","title":"What the name of the chart file consists of","text":"Example: .../RUB_USD_20241108_DQVDN7.png
RUB_USD
- Name of currencies.20241108
- Schedule request date in YYYMMDD
format.DQVDN7
- Random file character identifier.All charts are in the charts folder, which is in the root directory (./kekkai/chart
)
Currencies are identified by standard three-letter ISO 4217
currency codes.
curl --request GET \\\n--url https://kekkai-api.redume.su/api/getRate/?from_currency=RUB&conv_currency=USD&date=2024-10-16\n
Requests import requests\n\nres = requests.get('https://kekkai-api.redume.su/api/getRate/', {\n 'from_currency': 'RUB',\n 'conv_currency': 'USD',\n 'date': '2024-10-16',\n}, timeout=3)\n\nprint(res.json())\n
Axios const axios = require('axios');\n\naxios.get('https://kekkai-api.redume.su/api/getRate/', {\n timeout: 3000,\n 'from_currency': 'RUB',\n 'conv_currency': 'USD',\n 'date': '2024-10-16',\n }\n)\n .then((res) => {\n console.log(JSON.stringify(res.json()));\n })\n .catch((err) => {\n console.error(err);\n });\n
"},{"location":"endpoints/get-rate/#query-parameters","title":"Query Parameters","text":"Parameter Description from_currency
* ISO 4217
code of the currency from which the conversion takes place conv_currency
* ISO 4217
code of the currency to which the conversion is performed date
* Currency rate date in the format YYYYY-DD-MM
conv_amount
Multiplier for number conversion (Optional) *
- Required arguments
Output
[\n {\n \"from_currency\": \"RUB\",\n \"conv_currency\": \"USD\",\n \"rate\": 0.01,\n \"date\": \"2024-10-17T00:00:00.000Z\"\n }\n]\n
"},{"location":"endpoints/get-rate/#get-currency-exchange-rate-for-a-certain-period","title":"Get currency exchange rate for a certain period","text":"Getting the list of the array with currency rate for a certain period of time.
"},{"location":"endpoints/get-rate/#request_1","title":"Request","text":"ShellPythonNode.JS Curlcurl --request GET \\\n--url https://kekkai-api.redume.su/api/getRate/?from_currency=RUB&conv_currency=USD&start_date=2024-10-16&end_date=2024-10-20\n
Requests import requests\n\nres = requests.get('https://kekkai-api.redume.su/api/getRate/', {\n 'from_currency': 'RUB',\n 'conv_currency': 'USD',\n 'start_date': '2024-10-16',\n 'end_date': '2024-10-20',\n}, timeout=3)\n\nprint(res.json())\n
Axios const axios = require('axios');\n\naxios.get('https://kekkai-api.redume.su/api/getRate/', {\n timeout: 3000,\n 'from_currency': 'RUB',\n 'conv_currency': 'USD',\n 'start_date': '2024-10-16',\n 'end_date': '2024-10-20',\n }\n)\n .then((res) => {\n console.log(res['data']);\n })\n .catch((err) => {\n console.error(err);\n });\n
"},{"location":"endpoints/get-rate/#query-params","title":"Query params","text":"Parameter Description from_currency
* ISO 4217
code of the currency from which the conversion takes place conv_currency
* ISO 4217
code of the currency to which the conversion is performed start_date
* Start date of the period in the format YYYYY-DD-MM
end_date
* Period end date in the format YYYYY-DD-MM
*
- Required arguments
Output
[\n {\n \"from_currency\": \"RUB\",\n \"conv_currency\": \"USD\",\n \"rate\": 0.01,\n \"date\": \"2024-10-17T00:00:00.000Z\"\n },\n {\n \"from_currency\": \"RUB\",\n \"conv_currency\": \"USD\",\n \"rate\": 0.01,\n \"date\": \"2024-10-18T00:00:00.000Z\"\n },\n {\n \"from_currency\": \"RUB\",\n \"conv_currency\": \"USD\",\n \"rate\": 0.01,\n \"date\": \"2024-10-19T00:00:00.000Z\"\n },\n {\n \"from_currency\": \"RUB\",\n \"conv_currency\": \"USD\",\n \"rate\": 0.01,\n \"date\": \"2024-10-20T00:00:00.000Z\"\n },\n {\n \"from_currency\": \"RUB\",\n \"conv_currency\": \"USD\",\n \"rate\": 0.01,\n \"date\": \"2024-10-21T00:00:00.000Z\"\n }\n]\n
"},{"location":"endpoints/list-endpoints/","title":"Endpoints list","text":""},{"location":"endpoints/list-endpoints/#api-base-url","title":"API Base URL","text":"All requests to our API should be directed to the URL below:
https://kekkai-api.redume.su/api/\n
"},{"location":"endpoints/list-endpoints/#api-endpoints","title":"API Endpoints","text":"Kekkai has 3 API endpoints: getRate
, getChart
and metadata
. Below you will find a list of parameters that each endpoint requires and a description of what the API does.
https://kekkai-api.redume.su/api/getRate/
Get currency exchange rate for a specific day or period Create Chart https://kekkai-api.redume.su/api/getChart/
Creating a chart with exchange rate Metadata https://kekkai-api.redume.su/api/metadata/
Shows the last and first dates of currency rate collection, as well as available currencies"},{"location":"endpoints/metadata/","title":"Get Metadata - /api/metadata","text":"Currencies are identified by standard three-letter ISO 4217
currency codes.
curl --request GET \\\n--url https://kekkai-api.redume.su/api/metadata/\n
Requests import requests\n\nres = requests.get('https://kekkai-api.redume.su/api/metadata/', timeout=3)\n\nprint(res.json())\n
Axios const axios = require('axios');\n\naxios.get('https://kekkai-api.redume.su/api/metadata/')\n .then((res) => {\n console.log(JSON.stringify(res.json()));\n })\n .catch((err) => {\n console.error(err);\n });\n
"},{"location":"endpoints/metadata/#response","title":"Response","text":"Output
{\n \"first_date\": \"2024-11-26T21:00:00.000Z\",\n \"last_date\": \"2025-01-01T21:00:00.000Z\",\n \"currencies\": {\n \"crypto\": [\n \"USDT\",\n \"TON\",\n \"BTC\",\n \"ETH\"\n ],\n \"fiat\": [\n \"USD\",\n \"RUB\",\n \"EUR\",\n \"UAH\",\n \"TRY\",\n \"KZT\"\n ]\n }\n}\n
"},{"location":"getting-started/contributing/","title":"Contributing","text":"If you have any questions, you can write to the mail or Telegram
"},{"location":"getting-started/contributing/#fork-and-clone-your-repository","title":"Fork and clone your repository","text":"git clone https://github.com/<nickname>/Kekkai.git\n
git branch <name_new_branch>\n
git checkout <name_new_branch>\n
Before sending a Pull Request, test the functionality. Everything should work both in Docker Compose and without it.
It is recommended to use Debugger and Debug log for testing. The logging level is changed in config.yaml
Pylint
, mypy
, eslint
and prettier
are used as code syntax checks
To check the code, you must first download the necessary libraries, which are located at the root of the project
npm install\n
eslint
and prettier
is used to check and automatically correct the Node.JS code
npx eslint .\n
Or add the --fix
flag to automatically fix the code"},{"location":"getting-started/contributing/#checking-the-python-code","title":"Checking the Python code","text":"To check code, you need to install libraries mypy
and pylint
python3 -m pip install -U mypy\n
and install pylint
pip install pylint\n
Start check the code for pylint
:
pylint /chart/\n
and for mypy
:
mypy /chart/ \n
"},{"location":"getting-started/docker/","title":"Docker [Recommended]","text":"Docker Compose is the recommended method to run Kekkai in production. Below are the steps to deploy Kekkai with Docker Compose.
Kekkai requires Docker Compose version 2.x.
"},{"location":"getting-started/docker/#steps-1-preparing-files","title":"Steps 1 - Preparing files","text":"git clone https://github.com/Redume/Kekkai.git\n
cd Kekkai\n
"},{"location":"getting-started/docker/#steps-2-change-config-files","title":"Steps 2 - Change config files","text":"Nginx Configuration In nginx.conf
, you need to specify your domain or ipv4 address
...\n listen 443 ssl;\n server_name localhost; # Your domain\n...\n
To set up SSL
mkdir CertSLL\n
After that, copy the SSL certificates to the CertSSL
folder, if the names are different, then change either the name of the certificates or in nginx.conf
ssl_certificate /etc/nginx/ssl/fullchain.pem;\nssl_certificate_key /etc/nginx/ssl/privkey.pem;\n
The main config is config.sample.yaml
for Kekkai database: \n user: 'DATABASE_USERNAME'\n password: 'DATABASE_PASSWORD'\n host: 'DATABASE_HOST'\n name: 'DATABASE_NAME'\n port: 5432\n...\n
Fill in the data in the database
item, as well as in the .env
config
.env.sample
config for PostgreSQL # Connection secret for postgres. You should change it to a random password\n# Please use only the characters `A-Za-z0-9`, without special characters or spaces\n\nPOSTGRES_PASSWORD=my_password\n\n# If you do not know what you are doing, then you should not edit the values below\n###################################################################################\nPOSTGRES_DB=kekkai\nDB_HOST=postgres\nPOSTGRES_USER=postgres\n
DB_PASSWORD
to a custom value. Postgres is not publically exposed, so this password is only used for - local authentication. To avoid issues with Docker parsing this value, it is best to use only the characters A-Za-z0-9
.Note
After editing, rename the config files by removing .sample
in the name
docker compose -f \"docker-compose.yaml\" up -d --build\n
"},{"location":"getting-started/manual/","title":"Manual","text":"For full use, you need to install Node.JS v20
, PostgreSQL v15
, Python v13.3
, Nginx
git clone https://github.com/Redume/Kekkai.git\n
cd Kekkai\n
"},{"location":"getting-started/manual/#steps-2-change-config-files","title":"Steps 2 - Change config files","text":"Nginx Configuration In nginx.conf
, you need to specify your domain or ipv4 address
...\n listen 443 ssl;\n server_name localhost; # Your domain\n ...\n
The main config is config.sample.yaml
for Kekkai database: \n user: 'DATABASE_USERNAME'\n password: 'DATABASE_PASSWORD'\n host: 'DATABASE_HOST'\n name: 'DATABASE_NAME'\n port: 5432\n...\n
Fill in the data in the database
item, as well as in the .env
config
Install library. In /shared/logger
, /shared/config
, /shared/database
, /collect-currency
,/server
, the required node.JS libraries In each of the directories, you need to write this command
npm install\n
and install python libs
pip install -r requirements.txt\n
Start the nginx service
sudo systemctl start nginx.service\n
"},{"location":"getting-started/manual/#steps-4-launch-services","title":"Steps 4 - Launch Services","text":"Launch each of the services There are all three services MainService
, Collect-currency
, Chart
MainService
is an API for getting the exchange rate cd server & node .\n
Collect-Currency
is a service for collecting and save the rate in a database cd collect-currency/src/ && node .\n
ChartService
is a service for creating currency rate charts python3 main.py\n