Feature: Data history manager engine subsystem (#693)

* Adds lovely initial concept for historical data doer

* Adds ability to save tasks. Adds config. Adds startStop to engine

* Has a database microservice without use of globals! Further infrastructure design. Adds readme

* Commentary to help design

* Adds migrations for database

* readme and adds database models

* Some modelling that doesn't work end of day

* Completes datahistoryjob sql.Begins datahistoryjobresult

* Adds datahistoryjob functions to retreive job results. Adapts subsystem

* Adds process for upserting jobs and job results to the database

* Broken end of day weird sqlboiler crap

* Fixes issue with SQL generation.

* RPC generation and addition of basic upsert command

* Renames types

* Adds rpc functions

* quick commit before context swithc. Exchanges aren't being populated

* Begin the tests!

* complete sql tests. stop failed jobs. CLI command creation

* Defines rpc commands

* Fleshes out RPC implementation

* Expands testing

* Expands testing, removes double remove

* Adds coverage of data history subsystem, expands errors and nil checks

* Minor logic improvement

* streamlines datahistory test setup

* End of day minor linting

* Lint, convert simplify, rpc expansion, type expansion, readme expansion

* Documentation update

* Renames for consistency

* Completes RPC server commands

* Fixes tests

* Speeds up testing by reducing unnecessary actions. Adds maxjobspercycle config

* Comments for everything

* Adds missing result string. checks interval supported. default start end cli

* Fixes ID problem. Improves binance trade fetch. job ranges are processed

* adds dbservice coverage. adds rpcserver coverage

* docs regen, uses dbcon interface, reverts binance, fixes races, toggle manager

* Speed up tests, remove bad global usage, fix uuid check

* Adds verbose. Updates docs. Fixes postgres

* Minor changes to logging and start stop

* Fixes postgres db tests, fixes postgres column typo

* Fixes old string typo,removes constraint,error parsing for nonreaders

* prevents dhm running when table doesn't exist. Adds prereq documentation

* Adds parallel, rmlines, err fix, comment fix, minor param fixes

* doc regen, common time range check and test updating

* Fixes job validation issues. Updates candle range checker.

* Ensures test cannot fail due to time.Now() shenanigans

* Fixes oopsie, adds documentation and a warn

* Fixes another time test, adjusts copy

* Drastically speeds up data history manager tests via function overrides

* Fixes summary bug and better logs

* Fixes local time test, fixes websocket tests

* removes defaults and comment,updates error messages,sets cli command args

* Fixes FTX trade processing

* Fixes issue where jobs got stuck if data wasn't returned but retrieval was successful

* Improves test speed. Simplifies trade verification SQL. Adds command help

* Fixes the oopsies

* Fixes use of query within transaction. Fixes trade err

* oopsie, not needed

* Adds missing data status. Properly ends job even when data is missing

* errors are more verbose and so have more words to describe them

* Doc regen for new status

* tiny test tinkering

* str := string("Removes .String()").String()

* Merge fixups

* Fixes a data race discovered during github actions

* Allows websocket test to pass consistently

* Fixes merge issue preventing datahistorymanager from starting via config

* Niterinos cmd defaults and explanations

* fixes default oopsie

* Fixes lack of nil protection

* Additional oopsie

* More detailed error for validating job exchange
This commit is contained in:
Scott
2021-07-01 16:21:48 +10:00
committed by GitHub
parent c109cfb6b4
commit 197ef2df21
133 changed files with 17770 additions and 1367 deletions

View File

@@ -256,6 +256,48 @@
]
}
},
"/v1/deletedatahistoryjob": {
"delete": {
"operationId": "GoCryptoTrader_DeleteDataHistoryJob",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/gctrpcGenericResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/runtimeError"
}
}
},
"parameters": [
{
"name": "id",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "nickname",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "fullDetails",
"in": "query",
"required": false,
"type": "boolean"
}
],
"tags": [
"GoCryptoTrader"
]
}
},
"/v1/disableexchange": {
"post": {
"operationId": "GoCryptoTrader_DisableExchange",
@@ -846,6 +888,28 @@
]
}
},
"/v1/getactivedatahistoryjobs": {
"get": {
"operationId": "GoCryptoTrader_GetActiveDataHistoryJobs",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/gctrpcDataHistoryJobs"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/runtimeError"
}
}
},
"tags": [
"GoCryptoTrader"
]
}
},
"/v1/getauditevent": {
"get": {
"operationId": "GoCryptoTrader_GetAuditEvent",
@@ -1010,6 +1074,126 @@
]
}
},
"/v1/getdatahistoryjobdetails": {
"get": {
"operationId": "GoCryptoTrader_GetDataHistoryJobDetails",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/gctrpcDataHistoryJob"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/runtimeError"
}
}
},
"parameters": [
{
"name": "id",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "nickname",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "fullDetails",
"in": "query",
"required": false,
"type": "boolean"
}
],
"tags": [
"GoCryptoTrader"
]
}
},
"/v1/getdatahistoryjobsbetween": {
"get": {
"operationId": "GoCryptoTrader_GetDataHistoryJobsBetween",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/gctrpcDataHistoryJobs"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/runtimeError"
}
}
},
"parameters": [
{
"name": "start_date",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "end_date",
"in": "query",
"required": false,
"type": "string"
}
],
"tags": [
"GoCryptoTrader"
]
}
},
"/v1/getdatahistoryjobsummary": {
"get": {
"operationId": "GoCryptoTrader_GetDataHistoryJobSummary",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/gctrpcDataHistoryJob"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/runtimeError"
}
}
},
"parameters": [
{
"name": "id",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "nickname",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "fullDetails",
"in": "query",
"required": false,
"type": "boolean"
}
],
"tags": [
"GoCryptoTrader"
]
}
},
"/v1/getevents": {
"get": {
"operationId": "GoCryptoTrader_GetEvents",
@@ -2128,13 +2312,13 @@
},
"parameters": [
{
"name": "exchange",
"name": "Exchange",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "status",
"name": "Status",
"in": "query",
"required": false,
"type": "boolean"
@@ -2307,6 +2491,38 @@
]
}
},
"/v1/upsertdatahistoryjob": {
"post": {
"operationId": "GoCryptoTrader_UpsertDataHistoryJob",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/gctrpcUpsertDataHistoryJobResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/runtimeError"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/gctrpcUpsertDataHistoryJobRequest"
}
}
],
"tags": [
"GoCryptoTrader"
]
}
},
"/v1/websocketgetinfo": {
"get": {
"operationId": "GoCryptoTrader_WebsocketGetInfo",
@@ -2963,6 +3179,97 @@
}
}
},
"gctrpcDataHistoryJob": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"nickname": {
"type": "string"
},
"exchange": {
"type": "string"
},
"asset": {
"type": "string"
},
"pair": {
"$ref": "#/definitions/gctrpcCurrencyPair"
},
"start_date": {
"type": "string"
},
"end_date": {
"type": "string"
},
"interval": {
"type": "string",
"format": "int64"
},
"request_size_limit": {
"type": "string",
"format": "int64"
},
"max_retry_attempts": {
"type": "string",
"format": "int64"
},
"batch_size": {
"type": "string",
"format": "int64"
},
"status": {
"type": "string"
},
"data_type": {
"type": "string"
},
"job_results": {
"type": "array",
"items": {
"$ref": "#/definitions/gctrpcDataHistoryJobResult"
}
},
"result_summaries": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"gctrpcDataHistoryJobResult": {
"type": "object",
"properties": {
"start_date": {
"type": "string"
},
"end_date": {
"type": "string"
},
"has_data": {
"type": "boolean"
},
"message": {
"type": "string"
},
"run_date": {
"type": "string"
}
}
},
"gctrpcDataHistoryJobs": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"$ref": "#/definitions/gctrpcDataHistoryJob"
}
}
}
},
"gctrpcFiatWithdrawalEvent": {
"type": "object",
"properties": {
@@ -4167,6 +4474,63 @@
}
}
},
"gctrpcUpsertDataHistoryJobRequest": {
"type": "object",
"properties": {
"nickname": {
"type": "string"
},
"exchange": {
"type": "string"
},
"asset": {
"type": "string"
},
"pair": {
"$ref": "#/definitions/gctrpcCurrencyPair"
},
"start_date": {
"type": "string"
},
"end_date": {
"type": "string"
},
"interval": {
"type": "string",
"format": "int64"
},
"request_size_limit": {
"type": "string",
"format": "int64"
},
"data_type": {
"type": "string",
"format": "int64"
},
"max_retry_attempts": {
"type": "string",
"format": "int64"
},
"batch_size": {
"type": "string",
"format": "int64"
},
"insert_only": {
"type": "boolean"
}
}
},
"gctrpcUpsertDataHistoryJobResponse": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"job_id": {
"type": "string"
}
}
},
"gctrpcWebsocketGetInfoResponse": {
"type": "object",
"properties": {