mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 15:09:42 +00:00
* Ramshackle early leads to GRPC backtester * Adds GRPC server, default config generation * Partial support for GRPC backtester config * Update to use Buf, merge fixes * Full config for GRPC * Adds new commands, causes big panic * Fixes panics * Setup for the future * Docs update * test * grpc tests * Fix merge issues. Lint and test * minor fixes after rebase * Docs, formatting and main fixes * Change buf owner * shazNits * test-123 * rpc fixes * string fixes * Removes --singlerun flag and just relies on --singlerunstrategypath * fixes test * initial post merge compatability fixes * this actually all seems to work? unexpected * adds pluginpath to config * rm unused func. add gitignore * rm unused func. add gitignore * lintle * tITLE cASE lOG fIX,rm auth package, gitignore, tmpdir fix * buf updates + gen. go mod tidy * x2 * Update default port, update error text
200 lines
4.3 KiB
Protocol Buffer
200 lines
4.3 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package btrpc;
|
|
|
|
import "google/api/annotations.proto";
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
option go_package = "github.com/thrasher-corp/gocryptotrader/backtester/btrpc";
|
|
|
|
// struct definitions
|
|
message StrategySettings {
|
|
string name = 1;
|
|
bool use_simultaneous_signal_processing = 2;
|
|
bool disable_usd_tracking = 3;
|
|
repeated CustomSettings custom_settings = 4;
|
|
}
|
|
|
|
message CustomSettings {
|
|
string key_field = 1;
|
|
string key_value = 2;
|
|
}
|
|
|
|
message ExchangeLevelFunding {
|
|
string exchange_name = 1;
|
|
string asset = 2;
|
|
string currency = 3;
|
|
string initial_funds = 4;
|
|
string transfer_fee = 5;
|
|
}
|
|
|
|
message FundingSettings {
|
|
bool use_exchange_level_funding = 1;
|
|
repeated ExchangeLevelFunding exchange_level_funding = 2;
|
|
}
|
|
|
|
message PurchaseSide {
|
|
string minimum_size = 1;
|
|
string maximum_size = 2;
|
|
string maximum_total = 3;
|
|
}
|
|
|
|
message SpotDetails {
|
|
string initial_base_funds = 1;
|
|
string initial_quote_funds = 2;
|
|
}
|
|
|
|
message FuturesDetails {
|
|
Leverage leverage = 1;
|
|
}
|
|
|
|
message CurrencySettings {
|
|
string exchange_name = 1;
|
|
string asset = 2;
|
|
string base = 3;
|
|
string quote = 4;
|
|
PurchaseSide buy_side = 5;
|
|
PurchaseSide sell_side = 6;
|
|
string min_slippage_percent = 7;
|
|
string max_slippage_percent = 8;
|
|
string maker_fee_override = 9;
|
|
string taker_fee_override = 10;
|
|
string maximum_holdings_ratio = 11;
|
|
bool skip_candle_volume_fitting = 12;
|
|
bool use_exchange_order_limits = 13;
|
|
bool use_exchange_pnl_calculation = 14;
|
|
SpotDetails spot_details = 15;
|
|
FuturesDetails futures_details = 16;
|
|
}
|
|
|
|
message ApiData {
|
|
google.protobuf.Timestamp start_date = 1;
|
|
google.protobuf.Timestamp end_date = 2;
|
|
bool inclusive_end_date = 3;
|
|
}
|
|
|
|
message DbConfig {
|
|
bool enabled = 1;
|
|
bool verbose = 2;
|
|
string driver = 3;
|
|
string host = 4;
|
|
uint32 port = 5;
|
|
string username = 6;
|
|
string password = 7;
|
|
string database = 8;
|
|
string ssl_mode = 9;
|
|
}
|
|
|
|
message DbData {
|
|
google.protobuf.Timestamp start_date = 1;
|
|
google.protobuf.Timestamp end_date = 2;
|
|
DbConfig config = 3;
|
|
string path = 4;
|
|
bool inclusive_end_date = 5;
|
|
}
|
|
|
|
message CsvData {
|
|
string path = 1;
|
|
}
|
|
|
|
message DatabaseConnectionDetails {
|
|
string host = 1;
|
|
uint32 port = 2;
|
|
string user_name = 3;
|
|
string password = 4;
|
|
string database = 5;
|
|
string ssl_mode = 6;
|
|
}
|
|
|
|
message DatabaseConfig {
|
|
bool enabled = 1;
|
|
bool verbose = 2;
|
|
string driver = 3;
|
|
DatabaseConnectionDetails config = 4;
|
|
}
|
|
|
|
message DatabaseData {
|
|
google.protobuf.Timestamp start_date = 1;
|
|
google.protobuf.Timestamp end_date = 2;
|
|
DatabaseConfig config = 3;
|
|
string path = 4;
|
|
bool inclusive_end_date = 5;
|
|
}
|
|
|
|
message CSVData {
|
|
string path = 1;
|
|
}
|
|
|
|
message LiveData {
|
|
string api_key_override = 1;
|
|
string api_secret_override = 2;
|
|
string api_client_id_override = 3;
|
|
string api_2fa_override = 4;
|
|
string api_sub_account_override = 5;
|
|
bool use_real_orders = 6;
|
|
}
|
|
|
|
message DataSettings {
|
|
uint64 interval = 1;
|
|
string datatype = 2;
|
|
ApiData api_data = 3;
|
|
DatabaseData database_data = 4;
|
|
CSVData csv_data = 5;
|
|
LiveData live_data = 6;
|
|
}
|
|
|
|
message Leverage {
|
|
bool can_use_leverage = 1;
|
|
string maximum_orders_with_leverage_ratio = 2;
|
|
string maximum_leverage_rate = 3;
|
|
string maximum_collateral_leverage_rate = 4;
|
|
}
|
|
|
|
message PortfolioSettings {
|
|
Leverage leverage = 1;
|
|
PurchaseSide buy_side = 2;
|
|
PurchaseSide sell_side = 3;
|
|
}
|
|
|
|
message StatisticSettings {
|
|
string risk_free_rate = 1;
|
|
}
|
|
|
|
message Config {
|
|
string nickname = 1;
|
|
string goal = 2;
|
|
StrategySettings strategy_settings = 3;
|
|
FundingSettings funding_settings = 4;
|
|
repeated CurrencySettings currency_settings = 5;
|
|
DataSettings data_settings = 6;
|
|
PortfolioSettings portfolio_settings = 7;
|
|
StatisticSettings statistic_settings = 8;
|
|
}
|
|
|
|
// Requests and responses
|
|
message ExecuteStrategyFromFileRequest {
|
|
string strategy_file_path = 1;
|
|
}
|
|
|
|
message ExecuteStrategyResponse {
|
|
bool success = 1;
|
|
string message = 2;
|
|
}
|
|
|
|
message ExecuteStrategyFromConfigRequest {
|
|
btrpc.Config config = 1;
|
|
}
|
|
|
|
service BacktesterService {
|
|
rpc ExecuteStrategyFromFile(ExecuteStrategyFromFileRequest) returns (ExecuteStrategyResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v1/executestrategyfromfile"
|
|
};
|
|
}
|
|
rpc ExecuteStrategyFromConfig(ExecuteStrategyFromConfigRequest) returns (ExecuteStrategyResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v1/executestrategyfromconfig"
|
|
};
|
|
}
|
|
}
|