Crates.io | ohlcv-ctl |
lib.rs | ohlcv-ctl |
version | 0.0.3 |
source | src |
created_at | 2024-08-27 08:47:05.51364 |
updated_at | 2024-08-27 12:44:10.789384 |
description | Data collector library for fetching, analyzing, predicting and charting time series data (OHLC) of cryptocurrencies from various exchanges |
homepage | https://github.com/typedduck/ohlcv |
repository | https://github.com/typedduck/ohlcv |
max_upload_size | |
id | 1353062 |
size | 95,630 |
The OHLCV command line interface is a tool for downloading historical OHLCV (Open, High, Low, Close, Volume) data from various cryptocurrency exchanges.
The functionality provided by the command line interface is implemented in the OHLCV library.
This project is in the early stages of development and is not yet ready for production use.
init
.drop
.fetch
.export
.import
.The command line interface provides the following functionality:
Usage: ohlcv-ctl [COMMAND]
Commands:
init Initialize the database tables
drop Remove the database tables
fetch Fetch data from the origin
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
-V, --version Print version
The fetch
command is used to download historical OHLCV data from various
cryptocurrency exchanges. The data is downloaded in a 5-minute interval of the
previous day, resulting in 288 candles per day. The candles are aggregated in
the database to form larger candles, such as 15-minute, 1-hour, 4-hour, and
1-day candles.
The data can be downloaded for multiple trading pairs and multiple exchanges at the same time. The data is downloaded in parallel to speed up the process. Care is taken to avoid rate limiting and to handle errors gracefully.
To get a consistent time-series of the data, the command line tool must be run at least once a day. The tool will download the data for the previous day and aggregate it in the database. If the tool is run more than once a day, it will only download the missing trading pairs. All times are in UTC only.
Usage: ohlcv-ctl fetch [OPTIONS]
Options:
-c, --config <FILE> optional path to the configuration file
-h, --help Print help
The init
command is used to initialize the database schema. The schema
includes tables for the candles of the trading pairs.
Usage: ohlcv-ctl init [OPTIONS]
Options:
-c, --config <FILE> optional path to the configuration file
-h, --help Print help
The drop
command is used to drop the database schema. This will remove the
tables and data from the database of the defined trading pairs. If the --all
option is used, all tables for all coins will be removed.
Usage: ohlcv-ctl drop [OPTIONS]
Options:
-a, --all remove tables for all coins
-c, --config <FILE> optional path to the configuration file
-h, --help Print help
The command line interface uses a configuration file to specify the database and exchange settings. The configuration file is in TOML format and has the following structure:
# If user_agent is not set, the default user agent `ohlcv-ctl/<version>` will be
# used.
user_agent = "<optional user-agent>"
[database]
# The type of the database. Supported types are `mysql`, `postgres` and
# `sqlite`. Which are available depends on the features enabled during
# compilation.
type = "mysql"
host = "localhost"
database = "ohlcv"
username = "<ohlcv user>"
password = "<secret password>"
[[coins]]
name = "Bitcoin"
symbol = "BTC"
currency = "USD"
exchanges = { "Binance" = "BTCUSDC" }
See the implementation of the database configuration for more details about the
fields in the OHLCV
crate.