Initial commit
This commit is contained in:
17
docs/tasks/distribution.md
Normal file
17
docs/tasks/distribution.md
Normal file
@@ -0,0 +1,17 @@
|
||||
## How to process distribution for users
|
||||
|
||||
1. Create `csv` files with the following format
|
||||
|
||||
### Distribution table
|
||||
|
||||
| uid | currency_id | amount |
|
||||
|---------------|-------------|--------|
|
||||
| ID1000003837 | usdt | 100 |
|
||||
|
||||
uid, currency_id, amount - required params
|
||||
|
||||
2. For process distribution
|
||||
|
||||
```ruby
|
||||
bundle exec rake distribution:process['file_name.csv']
|
||||
```
|
||||
31
docs/tasks/import.md
Normal file
31
docs/tasks/import.md
Normal file
@@ -0,0 +1,31 @@
|
||||
## How to import users and account balances database Peatio
|
||||
|
||||
1. Create `csv` files for users and accounts with those templates.
|
||||
|
||||
### Users table
|
||||
|
||||
| uid | email | level | role | state | referral_uid |
|
||||
|---------------|----------------|-------|--------------|---------|---------------|
|
||||
| ID1000003837 | peatio@tech.io | 3 | superadmin | active | ID1000003828 |
|
||||
|
||||
uid, email - require params
|
||||
|
||||
### Accounts table
|
||||
|
||||
| uid | currency_id | main_balance | locked_balance |
|
||||
|---------------|--------------|--------------|------------------|
|
||||
| ID1000003837 | ETH | 10 | 5 |
|
||||
|
||||
uid, currency_id - require params
|
||||
|
||||
2. For import users
|
||||
|
||||
```ruby
|
||||
bundle exec rake import:users['file_name.csv']
|
||||
```
|
||||
|
||||
3. For import accounts
|
||||
|
||||
```ruby
|
||||
bundle exec rake import:accounts['file_name.csv']
|
||||
```
|
||||
29
docs/tasks/order_archive.md
Normal file
29
docs/tasks/order_archive.md
Normal file
@@ -0,0 +1,29 @@
|
||||
## Archive and delete cancelled orders without any trade older than one week
|
||||
|
||||
This job archives orders that were cancelled more than a week ago and didn't produce any trade.
|
||||
Those orders are stored in the archive database and cleaned up from the main database.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* Deploy archive database
|
||||
* Configure database.yml (archive_db section)
|
||||
|
||||
For process order archive job:
|
||||
|
||||
```bash
|
||||
bundle exec rake job job:order:archive
|
||||
```
|
||||
|
||||
New DB Job record:
|
||||
|
||||
| Column | Value |
|
||||
|--------|-------|
|
||||
| id | 10 |
|
||||
| name | archive_orders |
|
||||
| pointer | 1607603942 |
|
||||
| counter | 6674 |
|
||||
| data | nil |
|
||||
| error_code | 0 |
|
||||
| error_message | nil |
|
||||
| started_at | Thu 10 Dec 2020 13:39:02 CET +01:00 |
|
||||
| finished_at | Thu 10 Dec 2020 13:39:28 CET +01:00 |
|
||||
27
docs/tasks/order_close.md
Normal file
27
docs/tasks/order_close.md
Normal file
@@ -0,0 +1,27 @@
|
||||
## Cancel orders older than max_age
|
||||
|
||||
1. Set ORDER_MAX_AGE env in seconds (e.g. 28 days):
|
||||
|
||||
```bash
|
||||
export ORDER_MAX_AGE=2_419_200
|
||||
```
|
||||
|
||||
2. For process order cancel job:
|
||||
|
||||
```bash
|
||||
bundle exec rake job job:order:close
|
||||
```
|
||||
|
||||
New DB Job record:
|
||||
|
||||
| Column | Value |
|
||||
|--------|-------|
|
||||
| id | 9 |
|
||||
| name | close_orders |
|
||||
| pointer | 1607603942 |
|
||||
| counter | 2000 |
|
||||
| data | nil |
|
||||
| error_code | 0 |
|
||||
| error_message | nil |
|
||||
| started_at | Thu 10 Dec 2020 13:39:02 CET +01:00 |
|
||||
| finished_at | Thu 10 Dec 2020 13:39:28 CET +01:00 |
|
||||
38
docs/tasks/order_liabilities_compact.md
Normal file
38
docs/tasks/order_liabilities_compact.md
Normal file
@@ -0,0 +1,38 @@
|
||||
## Compact order liabilities using Stored Procedure
|
||||
|
||||
Submit and cancel order processes create 4 records in the liabilities table (classic bots behaviour).
|
||||
Because of those processes liabilities table can grow to significant sizes.
|
||||
|
||||
Compaction job will process liabilities for the previous week (by default) group them by code, currency_id, and date:
|
||||
|
||||
```sql
|
||||
GROUP BY code, currency_id, member_id, DATE(`created_at`)
|
||||
```
|
||||
|
||||
Due to the size of the liabilities table, it is recommended to run this job every day.
|
||||
|
||||
For process order liabilities compaction job:
|
||||
|
||||
```bash
|
||||
bundle exec rake job job:liabilities:compact_orders
|
||||
```
|
||||
|
||||
It will compact liabilities for orders from previous week. Also you can specify timerange (e.g.):
|
||||
|
||||
```bash
|
||||
bundle exec rake job job:liabilities:compact_orders['2020-12-09 00:00:00','2020-12-10 00:00:00']
|
||||
```
|
||||
|
||||
New DB Job record:
|
||||
|
||||
| Column | Value |
|
||||
|--------|-------|
|
||||
| id | 8 |
|
||||
| name | compact_orders |
|
||||
| pointer | 1607603942 |
|
||||
| counter | 6675 |
|
||||
| data | nil |
|
||||
| error_code | 0 |
|
||||
| error_message | nil |
|
||||
| started_at | Thu 10 Dec 2020 13:39:02 CET +01:00 |
|
||||
| finished_at | Thu 10 Dec 2020 13:39:28 CET +01:00 |
|
||||
Reference in New Issue
Block a user