From eeac38acd0ba04326dbbd1d07cc9f110c8090de2 Mon Sep 17 00:00:00 2001 From: h-varmazyar Date: Wed, 10 Jan 2024 19:59:07 +0330 Subject: [PATCH] feat(indicators): calculate sma --- services/chipmunk/api/proto/candle.pb.go | 200 +-- services/chipmunk/api/proto/src/candle.proto | 7 +- .../chipmunk/api/proto/src/indicator.proto | 135 -- services/eagle/api/proto/indicator.pb.go | 1381 +++++++++++++++++ services/eagle/api/proto/indicator_grpc.pb.go | 139 ++ services/eagle/api/proto/order.pb.go | 54 +- services/eagle/api/proto/src/indicator.proto | 134 ++ services/eagle/api/proto/src/strategy.proto | 4 +- services/eagle/api/proto/strategy.pb.go | 319 ++-- services/eagle/internal/app/strategies/app.go | 23 +- .../strategies/workers/signalCheckWorker.go | 13 +- .../strategies/automatedStrategy/automated.go | 14 +- services/indicators/api/proto/configs.pb.go | 553 +++++++ .../indicators/api/proto/indicators.pb.go | 359 +++++ .../api/proto/indicators_grpc.pb.go | 139 ++ services/indicators/api/proto/misc.pb.go | 218 +++ .../indicators/api/proto/src/configs.proto | 44 + .../indicators/api/proto/src/indicators.proto | 117 ++ services/indicators/api/proto/src/misc.proto | 23 + .../indicators/api/proto/src/values.proto | 37 + services/indicators/api/proto/values.pb.go | 599 +++++++ services/indicators/cmd/configs.go | 14 + services/indicators/cmd/main.go | 98 ++ services/indicators/configs/deafult.go | 5 + services/indicators/internal/app.go | 20 + services/indicators/internal/configs.go | 7 + .../internal/repository/repository.go | 10 + .../indicators/internal/service/configs.go | 4 + .../indicators/internal/service/service.go | 38 + .../indicators/internal/workers/calculator.go | 96 ++ .../indicators/internal/workers/configs.go | 8 + services/indicators/pkg/calculator/rsi.go | 1 + services/indicators/pkg/calculator/sma.go | 228 +++ .../indicators/pkg/calculator/sma_test.go | 76 + services/indicators/pkg/db/db.go | 53 + services/indicators/pkg/db/indicator.go | 15 + services/indicators/pkg/db/migrations.go | 23 + services/indicators/pkg/entity/indicator.go | 7 + services/telegramBot/cmd/main.go | 11 +- .../telegramBot/internal/pkg/tgBotApi/bot.go | 4 +- .../internal/pkg/tgBotApi/configs.go | 4 +- 41 files changed, 4765 insertions(+), 469 deletions(-) delete mode 100644 services/chipmunk/api/proto/src/indicator.proto create mode 100644 services/eagle/api/proto/indicator.pb.go create mode 100644 services/eagle/api/proto/indicator_grpc.pb.go create mode 100644 services/eagle/api/proto/src/indicator.proto create mode 100644 services/indicators/api/proto/configs.pb.go create mode 100644 services/indicators/api/proto/indicators.pb.go create mode 100644 services/indicators/api/proto/indicators_grpc.pb.go create mode 100644 services/indicators/api/proto/misc.pb.go create mode 100644 services/indicators/api/proto/src/configs.proto create mode 100644 services/indicators/api/proto/src/indicators.proto create mode 100644 services/indicators/api/proto/src/misc.proto create mode 100644 services/indicators/api/proto/src/values.proto create mode 100644 services/indicators/api/proto/values.pb.go create mode 100644 services/indicators/cmd/configs.go create mode 100644 services/indicators/cmd/main.go create mode 100644 services/indicators/configs/deafult.go create mode 100644 services/indicators/internal/app.go create mode 100644 services/indicators/internal/configs.go create mode 100644 services/indicators/internal/repository/repository.go create mode 100644 services/indicators/internal/service/configs.go create mode 100644 services/indicators/internal/service/service.go create mode 100644 services/indicators/internal/workers/calculator.go create mode 100644 services/indicators/internal/workers/configs.go create mode 100644 services/indicators/pkg/calculator/rsi.go create mode 100644 services/indicators/pkg/calculator/sma.go create mode 100644 services/indicators/pkg/calculator/sma_test.go create mode 100644 services/indicators/pkg/db/db.go create mode 100644 services/indicators/pkg/db/indicator.go create mode 100644 services/indicators/pkg/db/migrations.go create mode 100644 services/indicators/pkg/entity/indicator.go diff --git a/services/chipmunk/api/proto/candle.pb.go b/services/chipmunk/api/proto/candle.pb.go index cdbf321..2737752 100644 --- a/services/chipmunk/api/proto/candle.pb.go +++ b/services/chipmunk/api/proto/candle.pb.go @@ -46,12 +46,10 @@ type Candle struct { Low float64 `protobuf:"fixed64,9,opt,name=Low,proto3" json:"low"` // @inject_tag: json:"id" ID uint64 `protobuf:"varint,10,opt,name=ID,proto3" json:"id"` - // @inject_tag: json:"indicator_values" - IndicatorValues map[string]*IndicatorValue `protobuf:"bytes,11,rep,name=IndicatorValues,proto3" json:"indicator_values" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // key is indicator id // @inject_tag: json:"market_id" - MarketID string `protobuf:"bytes,12,opt,name=MarketID,proto3" json:"market_id"` + MarketID string `protobuf:"bytes,11,opt,name=MarketID,proto3" json:"market_id"` // @inject_tag: json:"resolution_id" - ResolutionID string `protobuf:"bytes,13,opt,name=ResolutionID,proto3" json:"resolution_id"` + ResolutionID string `protobuf:"bytes,12,opt,name=ResolutionID,proto3" json:"resolution_id"` } func (x *Candle) Reset() { @@ -156,13 +154,6 @@ func (x *Candle) GetID() uint64 { return 0 } -func (x *Candle) GetIndicatorValues() map[string]*IndicatorValue { - if x != nil { - return x.IndicatorValues - } - return nil -} - func (x *Candle) GetMarketID() string { if x != nil { return x.MarketID @@ -492,89 +483,75 @@ var file_services_chipmunk_api_proto_src_candle_proto_rawDesc = []byte{ 0x0a, 0x2c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x72, 0x63, 0x2f, 0x63, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, - 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x1a, 0x2f, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x72, 0x63, 0x2f, 0x69, 0x6e, 0x64, - 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x70, - 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x72, 0x63, 0x2f, 0x6d, 0x69, 0x73, 0x63, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdd, 0x03, 0x0a, 0x06, 0x43, 0x61, 0x6e, 0x64, 0x6c, - 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, - 0x1c, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x16, 0x0a, - 0x06, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x56, - 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, - 0x05, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x43, 0x6c, - 0x6f, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x4f, 0x70, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x01, 0x52, 0x04, 0x4f, 0x70, 0x65, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x69, 0x6d, 0x65, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x48, - 0x69, 0x67, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, 0x52, 0x04, 0x48, 0x69, 0x67, 0x68, 0x12, - 0x10, 0x0a, 0x03, 0x4c, 0x6f, 0x77, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x4c, 0x6f, - 0x77, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x49, - 0x44, 0x12, 0x52, 0x0a, 0x0f, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x63, 0x68, 0x69, - 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x43, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x2e, - 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0f, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x49, - 0x44, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x49, - 0x44, 0x12, 0x22, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, - 0x44, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, - 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x1a, 0x5f, 0x0a, 0x14, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, - 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x31, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x69, 0x6e, 0x64, - 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x50, 0x0a, 0x07, 0x43, 0x61, 0x6e, 0x64, 0x6c, 0x65, - 0x73, 0x12, 0x2f, 0x0a, 0x08, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, - 0x69, 0x2e, 0x43, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x08, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x65, 0x0a, 0x0d, 0x43, 0x61, 0x6e, 0x64, - 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x52, 0x65, 0x73, - 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0c, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x1a, 0x0a, - 0x08, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, - 0xd0, 0x01, 0x0a, 0x0f, 0x43, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x01, 0x52, 0x06, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x43, - 0x6c, 0x6f, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x43, 0x6c, 0x6f, 0x73, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x4f, 0x70, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, - 0x04, 0x4f, 0x70, 0x65, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x04, 0x44, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x69, 0x67, - 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, 0x52, 0x04, 0x48, 0x69, 0x67, 0x68, 0x12, 0x10, 0x0a, - 0x03, 0x4c, 0x6f, 0x77, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x4c, 0x6f, 0x77, 0x12, - 0x16, 0x0a, 0x06, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x12, 0x29, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, - 0x6f, 0x72, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, - 0x72, 0x6d, 0x22, 0x97, 0x01, 0x0a, 0x12, 0x43, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x73, 0x41, 0x73, - 0x79, 0x6e, 0x63, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x43, 0x61, 0x6e, - 0x64, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x68, 0x69, - 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x43, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x52, - 0x07, 0x43, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x72, 0x6b, - 0x65, 0x74, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, 0x61, 0x72, 0x6b, - 0x65, 0x74, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x52, 0x65, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x32, 0x86, 0x01, 0x0a, - 0x0d, 0x43, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x38, - 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1a, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, - 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x43, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, - 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, - 0x2e, 0x43, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x73, 0x12, 0x3b, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x12, 0x1c, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, - 0x2e, 0x43, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, - 0x1a, 0x13, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x43, - 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x42, 0x39, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x2d, 0x76, 0x61, 0x72, 0x6d, 0x61, 0x7a, 0x79, 0x61, 0x72, 0x2f, - 0x47, 0x61, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x63, 0x68, - 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x1a, 0x18, 0x61, 0x70, 0x69, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x72, 0x63, 0x2f, 0x6d, 0x69, 0x73, 0x63, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa8, 0x02, 0x0a, 0x06, 0x43, 0x61, 0x6e, 0x64, 0x6c, 0x65, + 0x12, 0x1c, 0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, + 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x16, 0x0a, 0x06, + 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x56, 0x6f, + 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, + 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x43, 0x6c, 0x6f, + 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x4f, 0x70, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, + 0x52, 0x04, 0x4f, 0x70, 0x65, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x69, + 0x67, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, 0x52, 0x04, 0x48, 0x69, 0x67, 0x68, 0x12, 0x10, + 0x0a, 0x03, 0x4c, 0x6f, 0x77, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x4c, 0x6f, 0x77, + 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x49, 0x44, + 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x18, 0x0b, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x0c, + 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0c, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, + 0x22, 0x50, 0x0a, 0x07, 0x43, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x73, 0x12, 0x2f, 0x0a, 0x08, 0x45, + 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, + 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x43, 0x61, 0x6e, 0x64, + 0x6c, 0x65, 0x52, 0x08, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x14, 0x0a, 0x05, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x22, 0x65, 0x0a, 0x0d, 0x43, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, + 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, + 0x6e, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x52, 0x65, 0x73, 0x6f, 0x6c, + 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xd0, 0x01, 0x0a, 0x0f, 0x43, 0x61, + 0x6e, 0x64, 0x6c, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, + 0x06, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x56, + 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x4f, + 0x70, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x04, 0x4f, 0x70, 0x65, 0x6e, 0x12, + 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x44, + 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x69, 0x67, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x01, 0x52, 0x04, 0x48, 0x69, 0x67, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x4c, 0x6f, 0x77, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x4c, 0x6f, 0x77, 0x12, 0x16, 0x0a, 0x06, 0x4d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x12, 0x29, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, + 0x72, 0x6d, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x22, 0x97, 0x01, 0x0a, + 0x12, 0x43, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x73, 0x41, 0x73, 0x79, 0x6e, 0x63, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x43, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, + 0x70, 0x69, 0x2e, 0x43, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x07, 0x43, 0x61, 0x6e, 0x64, 0x6c, + 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x20, + 0x0a, 0x0b, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x49, 0x44, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x49, 0x44, + 0x12, 0x14, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x32, 0x86, 0x01, 0x0a, 0x0d, 0x43, 0x61, 0x6e, 0x64, 0x6c, + 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x38, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, + 0x12, 0x1a, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x43, + 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x63, + 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x43, 0x61, 0x6e, 0x64, 0x6c, + 0x65, 0x73, 0x12, 0x3b, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x2e, 0x63, + 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x43, 0x61, 0x6e, 0x64, 0x6c, + 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x63, 0x68, 0x69, + 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x43, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x42, + 0x39, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x2d, + 0x76, 0x61, 0x72, 0x6d, 0x61, 0x7a, 0x79, 0x61, 0x72, 0x2f, 0x47, 0x61, 0x74, 0x65, 0x2f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -589,32 +566,28 @@ func file_services_chipmunk_api_proto_src_candle_proto_rawDescGZIP() []byte { return file_services_chipmunk_api_proto_src_candle_proto_rawDescData } -var file_services_chipmunk_api_proto_src_candle_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_services_chipmunk_api_proto_src_candle_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_services_chipmunk_api_proto_src_candle_proto_goTypes = []interface{}{ (*Candle)(nil), // 0: chipmunkApi.Candle (*Candles)(nil), // 1: chipmunkApi.Candles (*CandleListReq)(nil), // 2: chipmunkApi.CandleListReq (*CandleUpdateReq)(nil), // 3: chipmunkApi.CandleUpdateReq (*CandlesAsyncUpdate)(nil), // 4: chipmunkApi.CandlesAsyncUpdate - nil, // 5: chipmunkApi.Candle.IndicatorValuesEntry - (proto.Platform)(0), // 6: api.Platform - (*IndicatorValue)(nil), // 7: chipmunkApi.indicatorValue + (proto.Platform)(0), // 5: api.Platform } var file_services_chipmunk_api_proto_src_candle_proto_depIdxs = []int32{ - 5, // 0: chipmunkApi.Candle.IndicatorValues:type_name -> chipmunkApi.Candle.IndicatorValuesEntry - 0, // 1: chipmunkApi.Candles.Elements:type_name -> chipmunkApi.Candle - 6, // 2: chipmunkApi.CandleUpdateReq.Platform:type_name -> api.Platform - 0, // 3: chipmunkApi.CandlesAsyncUpdate.Candles:type_name -> chipmunkApi.Candle - 7, // 4: chipmunkApi.Candle.IndicatorValuesEntry.value:type_name -> chipmunkApi.indicatorValue - 2, // 5: chipmunkApi.CandleService.List:input_type -> chipmunkApi.CandleListReq - 3, // 6: chipmunkApi.CandleService.Update:input_type -> chipmunkApi.CandleUpdateReq - 1, // 7: chipmunkApi.CandleService.List:output_type -> chipmunkApi.Candles - 0, // 8: chipmunkApi.CandleService.Update:output_type -> chipmunkApi.Candle - 7, // [7:9] is the sub-list for method output_type - 5, // [5:7] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 0, // 0: chipmunkApi.Candles.Elements:type_name -> chipmunkApi.Candle + 5, // 1: chipmunkApi.CandleUpdateReq.Platform:type_name -> api.Platform + 0, // 2: chipmunkApi.CandlesAsyncUpdate.Candles:type_name -> chipmunkApi.Candle + 2, // 3: chipmunkApi.CandleService.List:input_type -> chipmunkApi.CandleListReq + 3, // 4: chipmunkApi.CandleService.Update:input_type -> chipmunkApi.CandleUpdateReq + 1, // 5: chipmunkApi.CandleService.List:output_type -> chipmunkApi.Candles + 0, // 6: chipmunkApi.CandleService.Update:output_type -> chipmunkApi.Candle + 5, // [5:7] is the sub-list for method output_type + 3, // [3:5] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_services_chipmunk_api_proto_src_candle_proto_init() } @@ -622,7 +595,6 @@ func file_services_chipmunk_api_proto_src_candle_proto_init() { if File_services_chipmunk_api_proto_src_candle_proto != nil { return } - file_services_chipmunk_api_proto_src_indicator_proto_init() if !protoimpl.UnsafeEnabled { file_services_chipmunk_api_proto_src_candle_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Candle); i { @@ -691,7 +663,7 @@ func file_services_chipmunk_api_proto_src_candle_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_services_chipmunk_api_proto_src_candle_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 5, NumExtensions: 0, NumServices: 1, }, diff --git a/services/chipmunk/api/proto/src/candle.proto b/services/chipmunk/api/proto/src/candle.proto index 6813899..14df84b 100644 --- a/services/chipmunk/api/proto/src/candle.proto +++ b/services/chipmunk/api/proto/src/candle.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package chipmunkApi; option go_package = "github.com/h-varmazyar/Gate/services/chipmunk/api/proto"; -import "services/chipmunk/api/proto/src/indicator.proto"; import "api/proto/src/misc.proto"; service CandleService { @@ -30,12 +29,10 @@ message Candle { double Low = 9; // @inject_tag: json:"id" uint64 ID = 10; - // @inject_tag: json:"indicator_values" - map IndicatorValues = 11; // key is indicator id // @inject_tag: json:"market_id" - string MarketID = 12; + string MarketID = 11; // @inject_tag: json:"resolution_id" - string ResolutionID = 13; + string ResolutionID = 12; } message Candles { diff --git a/services/chipmunk/api/proto/src/indicator.proto b/services/chipmunk/api/proto/src/indicator.proto deleted file mode 100644 index 508d196..0000000 --- a/services/chipmunk/api/proto/src/indicator.proto +++ /dev/null @@ -1,135 +0,0 @@ -syntax = "proto3"; -package chipmunkApi; -option go_package = "github.com/h-varmazyar/Gate/services/chipmunk/api/proto"; - -service indicatorService{ - rpc Return(IndicatorReturnReq) returns (Indicator); - rpc List(IndicatorListReq) returns (Indicators); -} - -enum Source { - Custom = 0; - OHLC4 = 1; - Close = 2; - Open = 3; - High = 4; - HLC3 = 5; - Low = 6; - HL2 = 7; -} - -message Indicator { - enum type{ - All = 0; - RSI = 1; - Stochastic = 2; - MovingAverage = 3; - BollingerBands = 4; - } - // @inject_tag: json:"id" - string ID = 1; - // @inject_tag: json:"name" - type Type = 2; - // @inject_tag: json:"configs" - IndicatorConfigs Configs = 3; -} - -message IndicatorConfigs { - // @inject_tag: json:"rsi,omitempty" - RsiConfigs RSI = 1; - // @inject_tag: json:"stochastic,omitempty" - StochasticConfigs Stochastic = 2; - // @inject_tag: json:"moving_average,omitempty" - MovingAverageConfigs MovingAverage = 3; - // @inject_tag: json:"bollinger_bands,omitempty" - BollingerBandsConfigs BollingerBands = 4; -} - -message indicatorValue{ - // @inject_tag: json:"type" - Indicator.type Type = 1; - // @inject_tag: json:"value" - oneof Value{ - // @inject_tag: json:"bollinger_band,omitempty" - BollingerBands BollingerBands = 2; - // @inject_tag: json:"moving_average,omitempty" - MovingAverage MovingAverage = 3; - // @inject_tag: json:"stochastic,omitempty" - Stochastic Stochastic = 4; - // @inject_tag: json:"rsi,omitempty" - RSI RSI = 5; - } -} - -message BollingerBands { - // @inject_tag: json:"upper_band" - double UpperBand = 1; - // @inject_tag: json:"lower_band" - double LowerBand = 2; - // @inject_tag: json:"ma" - double MA = 3; -} - -message MovingAverage { - // @inject_tag: json:"simple" - double Simple = 1; - // @inject_tag: json:"exponential" - double Exponential = 2; -} - -message Stochastic { - // @inject_tag: json:"index_k" - double IndexK = 1; - // @inject_tag: json:"index_d" - double IndexD = 2; -} - -message RSI { - // @inject_tag: json:"rsi" - double RSI = 1; -} - -message IndicatorReturnReq{ - // @inject_tag: json:"id" - string ID = 1; -} - -message RsiConfigs{ - // @inject_tag: json:"length" - int32 Length = 1; -} - -message StochasticConfigs{ - // @inject_tag: json:"length" - int32 Length = 1; - // @inject_tag: json:"smooth_k" - int32 SmoothK = 2; - // @inject_tag: json:"smooth_d" - int32 SmoothD = 3; -} - -message MovingAverageConfigs{ - // @inject_tag: json:"length" - int32 Length = 1; - // @inject_tag: json:"source" - Source Source = 2; -} - -message BollingerBandsConfigs{ - // @inject_tag: json:"length" - int32 Length = 1; - // @inject_tag: json:"deviation" - int32 Deviation = 2; - // @inject_tag: json:"source" - Source Source = 3; -} - -message IndicatorListReq{ - // @inject_tag: json:"type" - Indicator.type Type = 1; -} - -message Indicators{ - // @inject_tag: json:"elements" - repeated Indicator Elements = 1; -} diff --git a/services/eagle/api/proto/indicator.pb.go b/services/eagle/api/proto/indicator.pb.go new file mode 100644 index 0000000..7badbba --- /dev/null +++ b/services/eagle/api/proto/indicator.pb.go @@ -0,0 +1,1381 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.12.4 +// source: services/eagle/api/proto/src/indicator.proto + +package proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Source int32 + +const ( + Source_Custom Source = 0 + Source_OHLC4 Source = 1 + Source_Close Source = 2 + Source_Open Source = 3 + Source_High Source = 4 + Source_HLC3 Source = 5 + Source_Low Source = 6 + Source_HL2 Source = 7 +) + +// Enum value maps for Source. +var ( + Source_name = map[int32]string{ + 0: "Custom", + 1: "OHLC4", + 2: "Close", + 3: "Open", + 4: "High", + 5: "HLC3", + 6: "Low", + 7: "HL2", + } + Source_value = map[string]int32{ + "Custom": 0, + "OHLC4": 1, + "Close": 2, + "Open": 3, + "High": 4, + "HLC3": 5, + "Low": 6, + "HL2": 7, + } +) + +func (x Source) Enum() *Source { + p := new(Source) + *p = x + return p +} + +func (x Source) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Source) Descriptor() protoreflect.EnumDescriptor { + return file_services_eagle_api_proto_src_indicator_proto_enumTypes[0].Descriptor() +} + +func (Source) Type() protoreflect.EnumType { + return &file_services_eagle_api_proto_src_indicator_proto_enumTypes[0] +} + +func (x Source) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Source.Descriptor instead. +func (Source) EnumDescriptor() ([]byte, []int) { + return file_services_eagle_api_proto_src_indicator_proto_rawDescGZIP(), []int{0} +} + +type IndicatorType int32 + +const ( + IndicatorType_Unknown IndicatorType = 0 + IndicatorType_RSI IndicatorType = 1 + IndicatorType_Stochastic IndicatorType = 2 + IndicatorType_MovingAverage IndicatorType = 3 + IndicatorType_BollingerBands IndicatorType = 4 +) + +// Enum value maps for IndicatorType. +var ( + IndicatorType_name = map[int32]string{ + 0: "Unknown", + 1: "RSI", + 2: "Stochastic", + 3: "MovingAverage", + 4: "BollingerBands", + } + IndicatorType_value = map[string]int32{ + "Unknown": 0, + "RSI": 1, + "Stochastic": 2, + "MovingAverage": 3, + "BollingerBands": 4, + } +) + +func (x IndicatorType) Enum() *IndicatorType { + p := new(IndicatorType) + *p = x + return p +} + +func (x IndicatorType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (IndicatorType) Descriptor() protoreflect.EnumDescriptor { + return file_services_eagle_api_proto_src_indicator_proto_enumTypes[1].Descriptor() +} + +func (IndicatorType) Type() protoreflect.EnumType { + return &file_services_eagle_api_proto_src_indicator_proto_enumTypes[1] +} + +func (x IndicatorType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use IndicatorType.Descriptor instead. +func (IndicatorType) EnumDescriptor() ([]byte, []int) { + return file_services_eagle_api_proto_src_indicator_proto_rawDescGZIP(), []int{1} +} + +type Indicator struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // @inject_tag: json:"id" + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` + // @inject_tag: json:"type" + Type IndicatorType `protobuf:"varint,2,opt,name=type,proto3,enum=eagleApi.IndicatorType" json:"type"` + // @inject_tag: json:"configs" + // + // Types that are assignable to Configs: + // *Indicator_Rsi + // *Indicator_Stochastic + // *Indicator_MovingAverage + // *Indicator_BollingerBands + Configs isIndicator_Configs `protobuf_oneof:"configs" json:"configs"` +} + +func (x *Indicator) Reset() { + *x = Indicator{} + if protoimpl.UnsafeEnabled { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Indicator) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Indicator) ProtoMessage() {} + +func (x *Indicator) ProtoReflect() protoreflect.Message { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Indicator.ProtoReflect.Descriptor instead. +func (*Indicator) Descriptor() ([]byte, []int) { + return file_services_eagle_api_proto_src_indicator_proto_rawDescGZIP(), []int{0} +} + +func (x *Indicator) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Indicator) GetType() IndicatorType { + if x != nil { + return x.Type + } + return IndicatorType_Unknown +} + +func (m *Indicator) GetConfigs() isIndicator_Configs { + if m != nil { + return m.Configs + } + return nil +} + +func (x *Indicator) GetRsi() *RsiConfigs { + if x, ok := x.GetConfigs().(*Indicator_Rsi); ok { + return x.Rsi + } + return nil +} + +func (x *Indicator) GetStochastic() *StochasticConfigs { + if x, ok := x.GetConfigs().(*Indicator_Stochastic); ok { + return x.Stochastic + } + return nil +} + +func (x *Indicator) GetMovingAverage() *MovingAverageConfigs { + if x, ok := x.GetConfigs().(*Indicator_MovingAverage); ok { + return x.MovingAverage + } + return nil +} + +func (x *Indicator) GetBollingerBands() *BollingerBandsConfigs { + if x, ok := x.GetConfigs().(*Indicator_BollingerBands); ok { + return x.BollingerBands + } + return nil +} + +type isIndicator_Configs interface { + isIndicator_Configs() +} + +type Indicator_Rsi struct { + // @inject_tag: json:"rsi" + Rsi *RsiConfigs `protobuf:"bytes,3,opt,name=rsi,proto3,oneof" json:"rsi"` +} + +type Indicator_Stochastic struct { + // @inject_tag: json:"stochastic" + Stochastic *StochasticConfigs `protobuf:"bytes,4,opt,name=stochastic,proto3,oneof" json:"stochastic"` +} + +type Indicator_MovingAverage struct { + // @inject_tag: json:"moving_average" + MovingAverage *MovingAverageConfigs `protobuf:"bytes,5,opt,name=moving_average,json=movingAverage,proto3,oneof" json:"moving_average"` +} + +type Indicator_BollingerBands struct { + // @inject_tag: json:"bollinger_bands" + BollingerBands *BollingerBandsConfigs `protobuf:"bytes,6,opt,name=bollinger_bands,json=bollingerBands,proto3,oneof" json:"bollinger_bands"` +} + +func (*Indicator_Rsi) isIndicator_Configs() {} + +func (*Indicator_Stochastic) isIndicator_Configs() {} + +func (*Indicator_MovingAverage) isIndicator_Configs() {} + +func (*Indicator_BollingerBands) isIndicator_Configs() {} + +type RsiConfigs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // @inject_tag: json:"length" + Length int32 `protobuf:"varint,1,opt,name=length,proto3" json:"length"` +} + +func (x *RsiConfigs) Reset() { + *x = RsiConfigs{} + if protoimpl.UnsafeEnabled { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RsiConfigs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RsiConfigs) ProtoMessage() {} + +func (x *RsiConfigs) ProtoReflect() protoreflect.Message { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RsiConfigs.ProtoReflect.Descriptor instead. +func (*RsiConfigs) Descriptor() ([]byte, []int) { + return file_services_eagle_api_proto_src_indicator_proto_rawDescGZIP(), []int{1} +} + +func (x *RsiConfigs) GetLength() int32 { + if x != nil { + return x.Length + } + return 0 +} + +type StochasticConfigs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // @inject_tag: json:"length" + Length int32 `protobuf:"varint,1,opt,name=length,proto3" json:"length"` + // @inject_tag: json:"smooth_k" + SmoothK int32 `protobuf:"varint,2,opt,name=smooth_k,json=smoothK,proto3" json:"smooth_k"` + // @inject_tag: json:"smooth_d" + SmoothD int32 `protobuf:"varint,3,opt,name=smooth_d,json=smoothD,proto3" json:"smooth_d"` +} + +func (x *StochasticConfigs) Reset() { + *x = StochasticConfigs{} + if protoimpl.UnsafeEnabled { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StochasticConfigs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StochasticConfigs) ProtoMessage() {} + +func (x *StochasticConfigs) ProtoReflect() protoreflect.Message { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StochasticConfigs.ProtoReflect.Descriptor instead. +func (*StochasticConfigs) Descriptor() ([]byte, []int) { + return file_services_eagle_api_proto_src_indicator_proto_rawDescGZIP(), []int{2} +} + +func (x *StochasticConfigs) GetLength() int32 { + if x != nil { + return x.Length + } + return 0 +} + +func (x *StochasticConfigs) GetSmoothK() int32 { + if x != nil { + return x.SmoothK + } + return 0 +} + +func (x *StochasticConfigs) GetSmoothD() int32 { + if x != nil { + return x.SmoothD + } + return 0 +} + +type MovingAverageConfigs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // @inject_tag: json:"length" + Length int32 `protobuf:"varint,1,opt,name=length,proto3" json:"length"` + // @inject_tag: json:"source" + Source Source `protobuf:"varint,2,opt,name=source,proto3,enum=eagleApi.Source" json:"source"` +} + +func (x *MovingAverageConfigs) Reset() { + *x = MovingAverageConfigs{} + if protoimpl.UnsafeEnabled { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MovingAverageConfigs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MovingAverageConfigs) ProtoMessage() {} + +func (x *MovingAverageConfigs) ProtoReflect() protoreflect.Message { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MovingAverageConfigs.ProtoReflect.Descriptor instead. +func (*MovingAverageConfigs) Descriptor() ([]byte, []int) { + return file_services_eagle_api_proto_src_indicator_proto_rawDescGZIP(), []int{3} +} + +func (x *MovingAverageConfigs) GetLength() int32 { + if x != nil { + return x.Length + } + return 0 +} + +func (x *MovingAverageConfigs) GetSource() Source { + if x != nil { + return x.Source + } + return Source_Custom +} + +type BollingerBandsConfigs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // @inject_tag: json:"length" + Length int32 `protobuf:"varint,1,opt,name=length,proto3" json:"length"` + // @inject_tag: json:"deviation" + Deviation int32 `protobuf:"varint,2,opt,name=deviation,proto3" json:"deviation"` + // @inject_tag: json:"source" + Source Source `protobuf:"varint,3,opt,name=source,proto3,enum=eagleApi.Source" json:"source"` +} + +func (x *BollingerBandsConfigs) Reset() { + *x = BollingerBandsConfigs{} + if protoimpl.UnsafeEnabled { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BollingerBandsConfigs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BollingerBandsConfigs) ProtoMessage() {} + +func (x *BollingerBandsConfigs) ProtoReflect() protoreflect.Message { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BollingerBandsConfigs.ProtoReflect.Descriptor instead. +func (*BollingerBandsConfigs) Descriptor() ([]byte, []int) { + return file_services_eagle_api_proto_src_indicator_proto_rawDescGZIP(), []int{4} +} + +func (x *BollingerBandsConfigs) GetLength() int32 { + if x != nil { + return x.Length + } + return 0 +} + +func (x *BollingerBandsConfigs) GetDeviation() int32 { + if x != nil { + return x.Deviation + } + return 0 +} + +func (x *BollingerBandsConfigs) GetSource() Source { + if x != nil { + return x.Source + } + return Source_Custom +} + +type IndicatorValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // @inject_tag: json:"type" + Type IndicatorType `protobuf:"varint,1,opt,name=type,proto3,enum=eagleApi.IndicatorType" json:"type"` + // @inject_tag: json:"value" + // + // Types that are assignable to Value: + // *IndicatorValue_BollingerBands + // *IndicatorValue_MovingAverage + // *IndicatorValue_Stochastic + // *IndicatorValue_Rsi + Value isIndicatorValue_Value `protobuf_oneof:"value" json:"value"` +} + +func (x *IndicatorValue) Reset() { + *x = IndicatorValue{} + if protoimpl.UnsafeEnabled { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IndicatorValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IndicatorValue) ProtoMessage() {} + +func (x *IndicatorValue) ProtoReflect() protoreflect.Message { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IndicatorValue.ProtoReflect.Descriptor instead. +func (*IndicatorValue) Descriptor() ([]byte, []int) { + return file_services_eagle_api_proto_src_indicator_proto_rawDescGZIP(), []int{5} +} + +func (x *IndicatorValue) GetType() IndicatorType { + if x != nil { + return x.Type + } + return IndicatorType_Unknown +} + +func (m *IndicatorValue) GetValue() isIndicatorValue_Value { + if m != nil { + return m.Value + } + return nil +} + +func (x *IndicatorValue) GetBollingerBands() *BollingerBandsValue { + if x, ok := x.GetValue().(*IndicatorValue_BollingerBands); ok { + return x.BollingerBands + } + return nil +} + +func (x *IndicatorValue) GetMovingAverage() *MovingAverageValue { + if x, ok := x.GetValue().(*IndicatorValue_MovingAverage); ok { + return x.MovingAverage + } + return nil +} + +func (x *IndicatorValue) GetStochastic() *StochasticValue { + if x, ok := x.GetValue().(*IndicatorValue_Stochastic); ok { + return x.Stochastic + } + return nil +} + +func (x *IndicatorValue) GetRsi() *RSIValue { + if x, ok := x.GetValue().(*IndicatorValue_Rsi); ok { + return x.Rsi + } + return nil +} + +type isIndicatorValue_Value interface { + isIndicatorValue_Value() +} + +type IndicatorValue_BollingerBands struct { + // @inject_tag: json:"bollinger_band" + BollingerBands *BollingerBandsValue `protobuf:"bytes,2,opt,name=bollinger_bands,json=bollingerBands,proto3,oneof" json:"bollinger_band"` +} + +type IndicatorValue_MovingAverage struct { + // @inject_tag: json:"moving_average" + MovingAverage *MovingAverageValue `protobuf:"bytes,3,opt,name=moving_average,json=movingAverage,proto3,oneof" json:"moving_average"` +} + +type IndicatorValue_Stochastic struct { + // @inject_tag: json:"stochastic" + Stochastic *StochasticValue `protobuf:"bytes,4,opt,name=stochastic,proto3,oneof" json:"stochastic"` +} + +type IndicatorValue_Rsi struct { + // @inject_tag: json:"rsi" + Rsi *RSIValue `protobuf:"bytes,5,opt,name=rsi,proto3,oneof" json:"rsi"` +} + +func (*IndicatorValue_BollingerBands) isIndicatorValue_Value() {} + +func (*IndicatorValue_MovingAverage) isIndicatorValue_Value() {} + +func (*IndicatorValue_Stochastic) isIndicatorValue_Value() {} + +func (*IndicatorValue_Rsi) isIndicatorValue_Value() {} + +type BollingerBandsValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // @inject_tag: json:"upper_band" + UpperBand float64 `protobuf:"fixed64,1,opt,name=upper_band,json=upperBand,proto3" json:"upper_band"` + // @inject_tag: json:"lower_band" + LowerBand float64 `protobuf:"fixed64,2,opt,name=lower_band,json=lowerBand,proto3" json:"lower_band"` + // @inject_tag: json:"ma" + Ma float64 `protobuf:"fixed64,3,opt,name=ma,proto3" json:"ma"` +} + +func (x *BollingerBandsValue) Reset() { + *x = BollingerBandsValue{} + if protoimpl.UnsafeEnabled { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BollingerBandsValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BollingerBandsValue) ProtoMessage() {} + +func (x *BollingerBandsValue) ProtoReflect() protoreflect.Message { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BollingerBandsValue.ProtoReflect.Descriptor instead. +func (*BollingerBandsValue) Descriptor() ([]byte, []int) { + return file_services_eagle_api_proto_src_indicator_proto_rawDescGZIP(), []int{6} +} + +func (x *BollingerBandsValue) GetUpperBand() float64 { + if x != nil { + return x.UpperBand + } + return 0 +} + +func (x *BollingerBandsValue) GetLowerBand() float64 { + if x != nil { + return x.LowerBand + } + return 0 +} + +func (x *BollingerBandsValue) GetMa() float64 { + if x != nil { + return x.Ma + } + return 0 +} + +type MovingAverageValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // @inject_tag: json:"simple" + Simple float64 `protobuf:"fixed64,1,opt,name=simple,proto3" json:"simple"` + // @inject_tag: json:"exponential" + Exponential float64 `protobuf:"fixed64,2,opt,name=exponential,proto3" json:"exponential"` +} + +func (x *MovingAverageValue) Reset() { + *x = MovingAverageValue{} + if protoimpl.UnsafeEnabled { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MovingAverageValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MovingAverageValue) ProtoMessage() {} + +func (x *MovingAverageValue) ProtoReflect() protoreflect.Message { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MovingAverageValue.ProtoReflect.Descriptor instead. +func (*MovingAverageValue) Descriptor() ([]byte, []int) { + return file_services_eagle_api_proto_src_indicator_proto_rawDescGZIP(), []int{7} +} + +func (x *MovingAverageValue) GetSimple() float64 { + if x != nil { + return x.Simple + } + return 0 +} + +func (x *MovingAverageValue) GetExponential() float64 { + if x != nil { + return x.Exponential + } + return 0 +} + +type StochasticValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // @inject_tag: json:"index_k" + IndexK float64 `protobuf:"fixed64,1,opt,name=index_k,json=indexK,proto3" json:"index_k"` + // @inject_tag: json:"index_d" + IndexD float64 `protobuf:"fixed64,2,opt,name=index_d,json=indexD,proto3" json:"index_d"` +} + +func (x *StochasticValue) Reset() { + *x = StochasticValue{} + if protoimpl.UnsafeEnabled { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StochasticValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StochasticValue) ProtoMessage() {} + +func (x *StochasticValue) ProtoReflect() protoreflect.Message { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StochasticValue.ProtoReflect.Descriptor instead. +func (*StochasticValue) Descriptor() ([]byte, []int) { + return file_services_eagle_api_proto_src_indicator_proto_rawDescGZIP(), []int{8} +} + +func (x *StochasticValue) GetIndexK() float64 { + if x != nil { + return x.IndexK + } + return 0 +} + +func (x *StochasticValue) GetIndexD() float64 { + if x != nil { + return x.IndexD + } + return 0 +} + +type RSIValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // @inject_tag: json:"rsi" + Rsi float64 `protobuf:"fixed64,1,opt,name=rsi,proto3" json:"rsi"` +} + +func (x *RSIValue) Reset() { + *x = RSIValue{} + if protoimpl.UnsafeEnabled { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RSIValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RSIValue) ProtoMessage() {} + +func (x *RSIValue) ProtoReflect() protoreflect.Message { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RSIValue.ProtoReflect.Descriptor instead. +func (*RSIValue) Descriptor() ([]byte, []int) { + return file_services_eagle_api_proto_src_indicator_proto_rawDescGZIP(), []int{9} +} + +func (x *RSIValue) GetRsi() float64 { + if x != nil { + return x.Rsi + } + return 0 +} + +type IndicatorReturnReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // @inject_tag: json:"id" + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` +} + +func (x *IndicatorReturnReq) Reset() { + *x = IndicatorReturnReq{} + if protoimpl.UnsafeEnabled { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IndicatorReturnReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IndicatorReturnReq) ProtoMessage() {} + +func (x *IndicatorReturnReq) ProtoReflect() protoreflect.Message { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IndicatorReturnReq.ProtoReflect.Descriptor instead. +func (*IndicatorReturnReq) Descriptor() ([]byte, []int) { + return file_services_eagle_api_proto_src_indicator_proto_rawDescGZIP(), []int{10} +} + +func (x *IndicatorReturnReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type IndicatorListReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // @inject_tag: json:"type" + Type IndicatorType `protobuf:"varint,1,opt,name=Type,proto3,enum=eagleApi.IndicatorType" json:"type"` +} + +func (x *IndicatorListReq) Reset() { + *x = IndicatorListReq{} + if protoimpl.UnsafeEnabled { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IndicatorListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IndicatorListReq) ProtoMessage() {} + +func (x *IndicatorListReq) ProtoReflect() protoreflect.Message { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IndicatorListReq.ProtoReflect.Descriptor instead. +func (*IndicatorListReq) Descriptor() ([]byte, []int) { + return file_services_eagle_api_proto_src_indicator_proto_rawDescGZIP(), []int{11} +} + +func (x *IndicatorListReq) GetType() IndicatorType { + if x != nil { + return x.Type + } + return IndicatorType_Unknown +} + +type Indicators struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // @inject_tag: json:"elements" + Elements []*Indicator `protobuf:"bytes,1,rep,name=Elements,proto3" json:"elements"` +} + +func (x *Indicators) Reset() { + *x = Indicators{} + if protoimpl.UnsafeEnabled { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Indicators) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Indicators) ProtoMessage() {} + +func (x *Indicators) ProtoReflect() protoreflect.Message { + mi := &file_services_eagle_api_proto_src_indicator_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Indicators.ProtoReflect.Descriptor instead. +func (*Indicators) Descriptor() ([]byte, []int) { + return file_services_eagle_api_proto_src_indicator_proto_rawDescGZIP(), []int{12} +} + +func (x *Indicators) GetElements() []*Indicator { + if x != nil { + return x.Elements + } + return nil +} + +var File_services_eagle_api_proto_src_indicator_proto protoreflect.FileDescriptor + +var file_services_eagle_api_proto_src_indicator_proto_rawDesc = []byte{ + 0x0a, 0x2c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x65, 0x61, 0x67, 0x6c, 0x65, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x72, 0x63, 0x2f, 0x69, + 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, + 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x22, 0xd1, 0x02, 0x0a, 0x09, 0x49, 0x6e, 0x64, + 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, + 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x03, 0x72, 0x73, 0x69, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x14, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x52, 0x73, 0x69, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x48, 0x00, 0x52, 0x03, 0x72, 0x73, 0x69, 0x12, 0x3d, 0x0a, + 0x0a, 0x73, 0x74, 0x6f, 0x63, 0x68, 0x61, 0x73, 0x74, 0x69, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x6f, + 0x63, 0x68, 0x61, 0x73, 0x74, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x48, 0x00, + 0x52, 0x0a, 0x73, 0x74, 0x6f, 0x63, 0x68, 0x61, 0x73, 0x74, 0x69, 0x63, 0x12, 0x47, 0x0a, 0x0e, + 0x6d, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, + 0x4d, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x41, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x73, 0x48, 0x00, 0x52, 0x0d, 0x6d, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x41, 0x76, + 0x65, 0x72, 0x61, 0x67, 0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x62, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, + 0x65, 0x72, 0x5f, 0x62, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, + 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x42, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, + 0x67, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x48, + 0x00, 0x52, 0x0e, 0x62, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, + 0x73, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x22, 0x24, 0x0a, 0x0a, + 0x52, 0x73, 0x69, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x22, 0x61, 0x0a, 0x11, 0x53, 0x74, 0x6f, 0x63, 0x68, 0x61, 0x73, 0x74, 0x69, 0x63, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, + 0x19, 0x0a, 0x08, 0x73, 0x6d, 0x6f, 0x6f, 0x74, 0x68, 0x5f, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x07, 0x73, 0x6d, 0x6f, 0x6f, 0x74, 0x68, 0x4b, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x6d, + 0x6f, 0x6f, 0x74, 0x68, 0x5f, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x6d, + 0x6f, 0x6f, 0x74, 0x68, 0x44, 0x22, 0x58, 0x0a, 0x14, 0x4d, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x41, + 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x16, 0x0a, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x28, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, + 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, + 0x77, 0x0a, 0x15, 0x42, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, + 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x09, 0x64, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, + 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, + 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0xbc, 0x02, 0x0a, 0x0e, 0x69, 0x6e, 0x64, + 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2b, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x65, 0x61, 0x67, 0x6c, + 0x65, 0x41, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x54, 0x79, + 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x48, 0x0a, 0x0f, 0x62, 0x6f, 0x6c, 0x6c, + 0x69, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x62, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1d, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x42, 0x6f, 0x6c, + 0x6c, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x48, 0x00, 0x52, 0x0e, 0x62, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x42, 0x61, 0x6e, + 0x64, 0x73, 0x12, 0x45, 0x0a, 0x0e, 0x6d, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x76, 0x65, + 0x72, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x65, 0x61, 0x67, + 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x4d, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x41, 0x76, 0x65, 0x72, + 0x61, 0x67, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x6d, 0x6f, 0x76, 0x69, + 0x6e, 0x67, 0x41, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x73, 0x74, 0x6f, + 0x63, 0x68, 0x61, 0x73, 0x74, 0x69, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x68, 0x61, 0x73, + 0x74, 0x69, 0x63, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x0a, 0x73, 0x74, 0x6f, 0x63, + 0x68, 0x61, 0x73, 0x74, 0x69, 0x63, 0x12, 0x26, 0x0a, 0x03, 0x72, 0x73, 0x69, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x52, + 0x53, 0x49, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x03, 0x72, 0x73, 0x69, 0x42, 0x07, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x63, 0x0a, 0x13, 0x42, 0x6f, 0x6c, 0x6c, 0x69, + 0x6e, 0x67, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1d, + 0x0a, 0x0a, 0x75, 0x70, 0x70, 0x65, 0x72, 0x5f, 0x62, 0x61, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x01, 0x52, 0x09, 0x75, 0x70, 0x70, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, 0x12, 0x1d, 0x0a, + 0x0a, 0x6c, 0x6f, 0x77, 0x65, 0x72, 0x5f, 0x62, 0x61, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x01, 0x52, 0x09, 0x6c, 0x6f, 0x77, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, 0x12, 0x0e, 0x0a, 0x02, + 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x02, 0x6d, 0x61, 0x22, 0x4e, 0x0a, 0x12, + 0x4d, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x41, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x01, 0x52, 0x06, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x78, + 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, + 0x0b, 0x65, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0x43, 0x0a, 0x0f, + 0x53, 0x74, 0x6f, 0x63, 0x68, 0x61, 0x73, 0x74, 0x69, 0x63, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, + 0x17, 0x0a, 0x07, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, + 0x52, 0x06, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x6e, 0x64, 0x65, + 0x78, 0x5f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x69, 0x6e, 0x64, 0x65, 0x78, + 0x44, 0x22, 0x1c, 0x0a, 0x08, 0x52, 0x53, 0x49, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x10, 0x0a, + 0x03, 0x72, 0x73, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x72, 0x73, 0x69, 0x22, + 0x24, 0x0a, 0x12, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x74, 0x75, + 0x72, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x3f, 0x0a, 0x10, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, + 0x6f, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x2b, 0x0a, 0x04, 0x54, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, + 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x54, 0x79, 0x70, 0x65, + 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3d, 0x0a, 0x0a, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, + 0x74, 0x6f, 0x72, 0x73, 0x12, 0x2f, 0x0a, 0x08, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, + 0x69, 0x2e, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x08, 0x45, 0x6c, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2a, 0x5a, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, + 0x0a, 0x0a, 0x06, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x4f, + 0x48, 0x4c, 0x43, 0x34, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x10, + 0x02, 0x12, 0x08, 0x0a, 0x04, 0x4f, 0x70, 0x65, 0x6e, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x48, + 0x69, 0x67, 0x68, 0x10, 0x04, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x4c, 0x43, 0x33, 0x10, 0x05, 0x12, + 0x07, 0x0a, 0x03, 0x4c, 0x6f, 0x77, 0x10, 0x06, 0x12, 0x07, 0x0a, 0x03, 0x48, 0x4c, 0x32, 0x10, + 0x07, 0x2a, 0x5c, 0x0a, 0x0d, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, + 0x07, 0x0a, 0x03, 0x52, 0x53, 0x49, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x74, 0x6f, 0x63, + 0x68, 0x61, 0x73, 0x74, 0x69, 0x63, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x4d, 0x6f, 0x76, 0x69, + 0x6e, 0x67, 0x41, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x42, + 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, 0x73, 0x10, 0x04, 0x32, + 0x89, 0x01, 0x0a, 0x10, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x12, 0x1c, + 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, + 0x74, 0x6f, 0x72, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x65, + 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, + 0x72, 0x12, 0x38, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1a, 0x2e, 0x65, 0x61, 0x67, 0x6c, + 0x65, 0x41, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, + 0x2e, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x42, 0x36, 0x5a, 0x34, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x2d, 0x76, 0x61, 0x72, 0x6d, + 0x61, 0x7a, 0x79, 0x61, 0x72, 0x2f, 0x47, 0x61, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x2f, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_services_eagle_api_proto_src_indicator_proto_rawDescOnce sync.Once + file_services_eagle_api_proto_src_indicator_proto_rawDescData = file_services_eagle_api_proto_src_indicator_proto_rawDesc +) + +func file_services_eagle_api_proto_src_indicator_proto_rawDescGZIP() []byte { + file_services_eagle_api_proto_src_indicator_proto_rawDescOnce.Do(func() { + file_services_eagle_api_proto_src_indicator_proto_rawDescData = protoimpl.X.CompressGZIP(file_services_eagle_api_proto_src_indicator_proto_rawDescData) + }) + return file_services_eagle_api_proto_src_indicator_proto_rawDescData +} + +var file_services_eagle_api_proto_src_indicator_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_services_eagle_api_proto_src_indicator_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_services_eagle_api_proto_src_indicator_proto_goTypes = []interface{}{ + (Source)(0), // 0: eagleApi.Source + (IndicatorType)(0), // 1: eagleApi.IndicatorType + (*Indicator)(nil), // 2: eagleApi.Indicator + (*RsiConfigs)(nil), // 3: eagleApi.RsiConfigs + (*StochasticConfigs)(nil), // 4: eagleApi.StochasticConfigs + (*MovingAverageConfigs)(nil), // 5: eagleApi.MovingAverageConfigs + (*BollingerBandsConfigs)(nil), // 6: eagleApi.BollingerBandsConfigs + (*IndicatorValue)(nil), // 7: eagleApi.indicatorValue + (*BollingerBandsValue)(nil), // 8: eagleApi.BollingerBandsValue + (*MovingAverageValue)(nil), // 9: eagleApi.MovingAverageValue + (*StochasticValue)(nil), // 10: eagleApi.StochasticValue + (*RSIValue)(nil), // 11: eagleApi.RSIValue + (*IndicatorReturnReq)(nil), // 12: eagleApi.IndicatorReturnReq + (*IndicatorListReq)(nil), // 13: eagleApi.IndicatorListReq + (*Indicators)(nil), // 14: eagleApi.Indicators +} +var file_services_eagle_api_proto_src_indicator_proto_depIdxs = []int32{ + 1, // 0: eagleApi.Indicator.type:type_name -> eagleApi.IndicatorType + 3, // 1: eagleApi.Indicator.rsi:type_name -> eagleApi.RsiConfigs + 4, // 2: eagleApi.Indicator.stochastic:type_name -> eagleApi.StochasticConfigs + 5, // 3: eagleApi.Indicator.moving_average:type_name -> eagleApi.MovingAverageConfigs + 6, // 4: eagleApi.Indicator.bollinger_bands:type_name -> eagleApi.BollingerBandsConfigs + 0, // 5: eagleApi.MovingAverageConfigs.source:type_name -> eagleApi.Source + 0, // 6: eagleApi.BollingerBandsConfigs.source:type_name -> eagleApi.Source + 1, // 7: eagleApi.indicatorValue.type:type_name -> eagleApi.IndicatorType + 8, // 8: eagleApi.indicatorValue.bollinger_bands:type_name -> eagleApi.BollingerBandsValue + 9, // 9: eagleApi.indicatorValue.moving_average:type_name -> eagleApi.MovingAverageValue + 10, // 10: eagleApi.indicatorValue.stochastic:type_name -> eagleApi.StochasticValue + 11, // 11: eagleApi.indicatorValue.rsi:type_name -> eagleApi.RSIValue + 1, // 12: eagleApi.IndicatorListReq.Type:type_name -> eagleApi.IndicatorType + 2, // 13: eagleApi.Indicators.Elements:type_name -> eagleApi.Indicator + 12, // 14: eagleApi.indicatorService.Return:input_type -> eagleApi.IndicatorReturnReq + 13, // 15: eagleApi.indicatorService.List:input_type -> eagleApi.IndicatorListReq + 2, // 16: eagleApi.indicatorService.Return:output_type -> eagleApi.Indicator + 14, // 17: eagleApi.indicatorService.List:output_type -> eagleApi.Indicators + 16, // [16:18] is the sub-list for method output_type + 14, // [14:16] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name +} + +func init() { file_services_eagle_api_proto_src_indicator_proto_init() } +func file_services_eagle_api_proto_src_indicator_proto_init() { + if File_services_eagle_api_proto_src_indicator_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_services_eagle_api_proto_src_indicator_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Indicator); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_eagle_api_proto_src_indicator_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RsiConfigs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_eagle_api_proto_src_indicator_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StochasticConfigs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_eagle_api_proto_src_indicator_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MovingAverageConfigs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_eagle_api_proto_src_indicator_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BollingerBandsConfigs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_eagle_api_proto_src_indicator_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IndicatorValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_eagle_api_proto_src_indicator_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BollingerBandsValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_eagle_api_proto_src_indicator_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MovingAverageValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_eagle_api_proto_src_indicator_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StochasticValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_eagle_api_proto_src_indicator_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RSIValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_eagle_api_proto_src_indicator_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IndicatorReturnReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_eagle_api_proto_src_indicator_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IndicatorListReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_eagle_api_proto_src_indicator_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Indicators); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_services_eagle_api_proto_src_indicator_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*Indicator_Rsi)(nil), + (*Indicator_Stochastic)(nil), + (*Indicator_MovingAverage)(nil), + (*Indicator_BollingerBands)(nil), + } + file_services_eagle_api_proto_src_indicator_proto_msgTypes[5].OneofWrappers = []interface{}{ + (*IndicatorValue_BollingerBands)(nil), + (*IndicatorValue_MovingAverage)(nil), + (*IndicatorValue_Stochastic)(nil), + (*IndicatorValue_Rsi)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_services_eagle_api_proto_src_indicator_proto_rawDesc, + NumEnums: 2, + NumMessages: 13, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_services_eagle_api_proto_src_indicator_proto_goTypes, + DependencyIndexes: file_services_eagle_api_proto_src_indicator_proto_depIdxs, + EnumInfos: file_services_eagle_api_proto_src_indicator_proto_enumTypes, + MessageInfos: file_services_eagle_api_proto_src_indicator_proto_msgTypes, + }.Build() + File_services_eagle_api_proto_src_indicator_proto = out.File + file_services_eagle_api_proto_src_indicator_proto_rawDesc = nil + file_services_eagle_api_proto_src_indicator_proto_goTypes = nil + file_services_eagle_api_proto_src_indicator_proto_depIdxs = nil +} diff --git a/services/eagle/api/proto/indicator_grpc.pb.go b/services/eagle/api/proto/indicator_grpc.pb.go new file mode 100644 index 0000000..0f90619 --- /dev/null +++ b/services/eagle/api/proto/indicator_grpc.pb.go @@ -0,0 +1,139 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.12.4 +// source: services/eagle/api/proto/src/indicator.proto + +package proto + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// IndicatorServiceClient is the client API for IndicatorService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type IndicatorServiceClient interface { + Return(ctx context.Context, in *IndicatorReturnReq, opts ...grpc.CallOption) (*Indicator, error) + List(ctx context.Context, in *IndicatorListReq, opts ...grpc.CallOption) (*Indicators, error) +} + +type indicatorServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewIndicatorServiceClient(cc grpc.ClientConnInterface) IndicatorServiceClient { + return &indicatorServiceClient{cc} +} + +func (c *indicatorServiceClient) Return(ctx context.Context, in *IndicatorReturnReq, opts ...grpc.CallOption) (*Indicator, error) { + out := new(Indicator) + err := c.cc.Invoke(ctx, "/eagleApi.indicatorService/Return", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *indicatorServiceClient) List(ctx context.Context, in *IndicatorListReq, opts ...grpc.CallOption) (*Indicators, error) { + out := new(Indicators) + err := c.cc.Invoke(ctx, "/eagleApi.indicatorService/List", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// IndicatorServiceServer is the server API for IndicatorService service. +// All implementations should embed UnimplementedIndicatorServiceServer +// for forward compatibility +type IndicatorServiceServer interface { + Return(context.Context, *IndicatorReturnReq) (*Indicator, error) + List(context.Context, *IndicatorListReq) (*Indicators, error) +} + +// UnimplementedIndicatorServiceServer should be embedded to have forward compatible implementations. +type UnimplementedIndicatorServiceServer struct { +} + +func (UnimplementedIndicatorServiceServer) Return(context.Context, *IndicatorReturnReq) (*Indicator, error) { + return nil, status.Errorf(codes.Unimplemented, "method Return not implemented") +} +func (UnimplementedIndicatorServiceServer) List(context.Context, *IndicatorListReq) (*Indicators, error) { + return nil, status.Errorf(codes.Unimplemented, "method List not implemented") +} + +// UnsafeIndicatorServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to IndicatorServiceServer will +// result in compilation errors. +type UnsafeIndicatorServiceServer interface { + mustEmbedUnimplementedIndicatorServiceServer() +} + +func RegisterIndicatorServiceServer(s grpc.ServiceRegistrar, srv IndicatorServiceServer) { + s.RegisterService(&IndicatorService_ServiceDesc, srv) +} + +func _IndicatorService_Return_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(IndicatorReturnReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IndicatorServiceServer).Return(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/eagleApi.indicatorService/Return", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IndicatorServiceServer).Return(ctx, req.(*IndicatorReturnReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _IndicatorService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(IndicatorListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IndicatorServiceServer).List(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/eagleApi.indicatorService/List", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IndicatorServiceServer).List(ctx, req.(*IndicatorListReq)) + } + return interceptor(ctx, in, info, handler) +} + +// IndicatorService_ServiceDesc is the grpc.ServiceDesc for IndicatorService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var IndicatorService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "eagleApi.indicatorService", + HandlerType: (*IndicatorServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Return", + Handler: _IndicatorService_Return_Handler, + }, + { + MethodName: "List", + Handler: _IndicatorService_List_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "services/eagle/api/proto/src/indicator.proto", +} diff --git a/services/eagle/api/proto/order.pb.go b/services/eagle/api/proto/order.pb.go index 2299453..c0a029c 100644 --- a/services/eagle/api/proto/order.pb.go +++ b/services/eagle/api/proto/order.pb.go @@ -243,57 +243,57 @@ type Order struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // @inject_tag: json:"id" + // @inject_tag: json:"id" ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"id"` - // @inject_tag: json:"server_order_id" + // @inject_tag: json:"server_order_id" ServerOrderId int64 `protobuf:"varint,2,opt,name=ServerOrderId,proto3" json:"server_order_id"` - // @inject_tag: json:"amount" + // @inject_tag: json:"amount" Amount float64 `protobuf:"fixed64,3,opt,name=Amount,proto3" json:"amount"` - // @inject_tag: json:"finished_at" + // @inject_tag: json:"finished_at" FinishedAt int64 `protobuf:"varint,4,opt,name=FinishedAt,proto3" json:"finished_at"` - // @inject_tag: json:"executed_amount" + // @inject_tag: json:"executed_amount" ExecutedAmount float64 `protobuf:"fixed64,5,opt,name=ExecutedAmount,proto3" json:"executed_amount"` - // @inject_tag: json:"un_executed_amount" + // @inject_tag: json:"un_executed_amount" UnExecutedAmount float64 `protobuf:"fixed64,6,opt,name=UnExecutedAmount,proto3" json:"un_executed_amount"` - // @inject_tag: json:"status" + // @inject_tag: json:"status" Status OrderStatus `protobuf:"varint,7,opt,name=Status,proto3,enum=eagleApi.OrderStatus" json:"status"` - // @inject_tag: json:"price" + // @inject_tag: json:"price" Price float64 `protobuf:"fixed64,8,opt,name=Price,proto3" json:"price"` - // @inject_tag: json:"market" + // @inject_tag: json:"market" Market *proto.Market `protobuf:"bytes,9,opt,name=Market,proto3" json:"market"` - // @inject_tag: json:"maker_fee_rate" + // @inject_tag: json:"maker_fee_rate" MakerFeeRate float64 `protobuf:"fixed64,10,opt,name=MakerFeeRate,proto3" json:"maker_fee_rate"` - // @inject_tag: json:"taker_fee_rate" + // @inject_tag: json:"taker_fee_rate" TakerFeeRate float64 `protobuf:"fixed64,11,opt,name=TakerFeeRate,proto3" json:"taker_fee_rate"` - // @inject_tag: json:"sell_or_buy" + // @inject_tag: json:"sell_or_buy" SellOrBuy OrderType `protobuf:"varint,12,opt,name=SellOrBuy,proto3,enum=eagleApi.OrderType" json:"sell_or_buy"` - // @inject_tag: json:"order_type" + // @inject_tag: json:"order_type" OrderType OrderModel `protobuf:"varint,13,opt,name=OrderType,proto3,enum=eagleApi.OrderModel" json:"order_type"` - // @inject_tag: json:"average_price" + // @inject_tag: json:"average_price" AveragePrice float64 `protobuf:"fixed64,14,opt,name=AveragePrice,proto3" json:"average_price"` - // @inject_tag: json:"transaction_fee" + // @inject_tag: json:"transaction_fee" TransactionFee float64 `protobuf:"fixed64,15,opt,name=TransactionFee,proto3" json:"transaction_fee"` - // @inject_tag: json:"source_asset" + // @inject_tag: json:"source_asset" SourceAsset *proto.Asset `protobuf:"bytes,16,opt,name=SourceAsset,proto3" json:"source_asset"` - // @inject_tag: json:"destination_asset" + // @inject_tag: json:"destination_asset" DestinationAsset *proto.Asset `protobuf:"bytes,17,opt,name=DestinationAsset,proto3" json:"destination_asset"` - // @inject_tag: json:"fee_asset" + // @inject_tag: json:"fee_asset" FeeAsset *proto.Asset `protobuf:"bytes,18,opt,name=FeeAsset,proto3" json:"fee_asset"` - // @inject_tag: json:"fee_discount" + // @inject_tag: json:"fee_discount" FeeDiscount float64 `protobuf:"fixed64,19,opt,name=FeeDiscount,proto3" json:"fee_discount"` - // @inject_tag: json:"asset_fee" + // @inject_tag: json:"asset_fee" AssetFee float64 `protobuf:"fixed64,20,opt,name=AssetFee,proto3" json:"asset_fee"` - // @inject_tag: json:"money_fee" + // @inject_tag: json:"money_fee" MoneyFee float64 `protobuf:"fixed64,21,opt,name=MoneyFee,proto3" json:"money_fee"` - // @inject_tag: json:"volume" + // @inject_tag: json:"volume" Volume float64 `protobuf:"fixed64,22,opt,name=Volume,proto3" json:"volume"` - // @inject_tag: json:"order_no" + // @inject_tag: json:"order_no" OrderNo int64 `protobuf:"varint,23,opt,name=OrderNo,proto3" json:"order_no"` - // @inject_tag: json:"stock_fee" + // @inject_tag: json:"stock_fee" StockFee float64 `protobuf:"fixed64,24,opt,name=StockFee,proto3" json:"stock_fee"` - // @inject_tag: json:"created_at" + // @inject_tag: json:"created_at" CreatedAt int64 `protobuf:"varint,25,opt,name=CreatedAt,proto3" json:"created_at"` - // @inject_tag: json:"updated_at" + // @inject_tag: json:"updated_at" UpdatedAt int64 `protobuf:"varint,26,opt,name=UpdatedAt,proto3" json:"updated_at"` } @@ -516,7 +516,7 @@ type Orders struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // @inject_tag: json:"elements" + // @inject_tag: json:"elements" Elements []*Order `protobuf:"bytes,1,rep,name=Elements,proto3" json:"elements"` } diff --git a/services/eagle/api/proto/src/indicator.proto b/services/eagle/api/proto/src/indicator.proto new file mode 100644 index 0000000..3b41884 --- /dev/null +++ b/services/eagle/api/proto/src/indicator.proto @@ -0,0 +1,134 @@ +syntax = "proto3"; +package eagleApi; +option go_package = "github.com/h-varmazyar/Gate/services/eagle/api/proto"; + +service indicatorService{ + rpc Return(IndicatorReturnReq) returns (Indicator); + rpc List(IndicatorListReq) returns (Indicators); +} + +enum Source { + Custom = 0; + OHLC4 = 1; + Close = 2; + Open = 3; + High = 4; + HLC3 = 5; + Low = 6; + HL2 = 7; +} + +enum IndicatorType{ + Unknown = 0; + RSI = 1; + Stochastic = 2; + MovingAverage = 3; + BollingerBands = 4; +} + +message Indicator { + // @inject_tag: json:"id" + string id = 1; + // @inject_tag: json:"type" + IndicatorType type = 2; + // @inject_tag: json:"configs" + oneof configs{ + // @inject_tag: json:"rsi" + RsiConfigs rsi = 3; + // @inject_tag: json:"stochastic" + StochasticConfigs stochastic = 4; + // @inject_tag: json:"moving_average" + MovingAverageConfigs moving_average = 5; + // @inject_tag: json:"bollinger_bands" + BollingerBandsConfigs bollinger_bands = 6; + } +} + +message RsiConfigs{ + // @inject_tag: json:"length" + int32 length = 1; +} + +message StochasticConfigs{ + // @inject_tag: json:"length" + int32 length = 1; + // @inject_tag: json:"smooth_k" + int32 smooth_k = 2; + // @inject_tag: json:"smooth_d" + int32 smooth_d = 3; +} + +message MovingAverageConfigs{ + // @inject_tag: json:"length" + int32 length = 1; + // @inject_tag: json:"source" + Source source = 2; +} + +message BollingerBandsConfigs{ + // @inject_tag: json:"length" + int32 length = 1; + // @inject_tag: json:"deviation" + int32 deviation = 2; + // @inject_tag: json:"source" + Source source = 3; +} + +message indicatorValue{ + // @inject_tag: json:"type" + IndicatorType type = 1; + // @inject_tag: json:"value" + oneof value{ + // @inject_tag: json:"bollinger_band" + BollingerBandsValue bollinger_bands = 2; + // @inject_tag: json:"moving_average" + MovingAverageValue moving_average = 3; + // @inject_tag: json:"stochastic" + StochasticValue stochastic = 4; + // @inject_tag: json:"rsi" + RSIValue rsi = 5; + } +} + +message BollingerBandsValue { + // @inject_tag: json:"upper_band" + double upper_band = 1; + // @inject_tag: json:"lower_band" + double lower_band = 2; + // @inject_tag: json:"ma" + double ma = 3; +} + +message MovingAverageValue { + // @inject_tag: json:"simple" + double simple = 1; + // @inject_tag: json:"exponential" + double exponential = 2; +} + +message StochasticValue { + // @inject_tag: json:"index_k" + double index_k = 1; + // @inject_tag: json:"index_d" + double index_d = 2; +} + +message RSIValue { + // @inject_tag: json:"rsi" + double rsi = 1; +} + +message IndicatorReturnReq{ + // @inject_tag: json:"id" + string id = 1; +} + +message IndicatorListReq{ + // @inject_tag: json:"type" + IndicatorType Type = 1; +} + +message Indicators{ + // @inject_tag: json:"elements" + repeated Indicator Elements = 1; +} diff --git a/services/eagle/api/proto/src/strategy.proto b/services/eagle/api/proto/src/strategy.proto index b5c754e..44a0d1f 100644 --- a/services/eagle/api/proto/src/strategy.proto +++ b/services/eagle/api/proto/src/strategy.proto @@ -4,7 +4,7 @@ option go_package = "github.com/h-varmazyar/Gate/services/eagle/api/proto"; import "api/proto/src/misc.proto"; import "services/chipmunk/api/proto/src/resolution.proto"; import "services/chipmunk/api/proto/src/market.proto"; -import "services/chipmunk/api/proto/src/indicator.proto"; +import "services/eagle/api/proto/src/indicator.proto"; service StrategyService { rpc Create(CreateStrategyReq) returns(Strategy); @@ -94,7 +94,7 @@ message StrategyIndicator { // @inject_tag: json:"indicator_id" string IndicatorID = 2; // @inject_tag: json:"type" - chipmunkApi.Indicator.type Type = 3; + IndicatorType Type = 3; } message StrategyIndicators { diff --git a/services/eagle/api/proto/strategy.pb.go b/services/eagle/api/proto/strategy.pb.go index d3a7431..49b4fb7 100644 --- a/services/eagle/api/proto/strategy.pb.go +++ b/services/eagle/api/proto/strategy.pb.go @@ -70,37 +70,37 @@ type Strategy struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // @inject_tag: json:"id" + // @inject_tag: json:"id" ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"id"` - // @inject_tag: json:"created_at,omitempty" + // @inject_tag: json:"created_at,omitempty" CreatedAt int64 `protobuf:"varint,2,opt,name=CreatedAt,proto3" json:"created_at,omitempty"` - // @inject_tag: json:"updated_at,omitempty" + // @inject_tag: json:"updated_at,omitempty" UpdatedAt int64 `protobuf:"varint,3,opt,name=UpdatedAt,proto3" json:"updated_at,omitempty"` - // @inject_tag: json:"name" + // @inject_tag: json:"name" Name string `protobuf:"bytes,4,opt,name=Name,proto3" json:"name"` - // @inject_tag: json:"description" + // @inject_tag: json:"description" Description string `protobuf:"bytes,5,opt,name=Description,proto3" json:"description"` - // @inject_tag: json:"min_daily_profit_rate" + // @inject_tag: json:"min_daily_profit_rate" MinDailyProfitRate float64 `protobuf:"fixed64,6,opt,name=MinDailyProfitRate,proto3" json:"min_daily_profit_rate"` - // @inject_tag: json:"min_profit_per_trade_rate" + // @inject_tag: json:"min_profit_per_trade_rate" MinProfitPerTradeRate float64 `protobuf:"fixed64,7,opt,name=MinProfitPerTradeRate,proto3" json:"min_profit_per_trade_rate"` - // @inject_tag: json:"max_fund_per_trade" + // @inject_tag: json:"max_fund_per_trade" MaxFundPerTrade float64 `protobuf:"fixed64,8,opt,name=MaxFundPerTrade,proto3" json:"max_fund_per_trade"` - // @inject_tag: json:"max_fund_per_trade_rate" + // @inject_tag: json:"max_fund_per_trade_rate" MaxFundPerTradeRate float64 `protobuf:"fixed64,9,opt,name=MaxFundPerTradeRate,proto3" json:"max_fund_per_trade_rate"` - // @inject_tag: json:"working_resolution" + // @inject_tag: json:"working_resolution" WorkingResolution *proto.Resolution `protobuf:"bytes,10,opt,name=WorkingResolution,proto3" json:"working_resolution"` - // @inject_tag: json:"market_ids" + // @inject_tag: json:"market_ids" MarketIDs []string `protobuf:"bytes,11,rep,name=MarketIDs,proto3" json:"market_ids"` - // @inject_tag: json:"indicators" + // @inject_tag: json:"indicators" Indicators []*StrategyIndicator `protobuf:"bytes,12,rep,name=Indicators,proto3" json:"indicators"` - // @inject_tag: json:"is_active" + // @inject_tag: json:"is_active" IsActive bool `protobuf:"varint,13,opt,name=IsActive,proto3" json:"is_active"` - // @inject_tag: json:"type" + // @inject_tag: json:"type" Type StrategyType `protobuf:"varint,14,opt,name=Type,proto3,enum=eagleApi.StrategyType" json:"type"` - // @inject_tag: json:"brokerage_id" + // @inject_tag: json:"brokerage_id" BrokerageID string `protobuf:"bytes,15,opt,name=BrokerageID,proto3" json:"brokerage_id"` - // @inject_tag: json:"with_trading" + // @inject_tag: json:"with_trading" WithTrading bool `protobuf:"varint,16,opt,name=WithTrading,proto3" json:"with_trading"` } @@ -253,7 +253,7 @@ type Strategies struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // @inject_tag: json:"elements" + // @inject_tag: json:"elements" Elements []*Strategy `protobuf:"bytes,1,rep,name=Elements,proto3" json:"elements"` } @@ -301,28 +301,28 @@ type CreateStrategyReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // @inject_tag: json:"name" + // @inject_tag: json:"name" Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"name"` - // @inject_tag: json:"description" + // @inject_tag: json:"description" Description string `protobuf:"bytes,2,opt,name=Description,proto3" json:"description"` - // @inject_tag: json:"min_daily_profit_rate" + // @inject_tag: json:"min_daily_profit_rate" MinDailyProfitRate string `protobuf:"bytes,3,opt,name=MinDailyProfitRate,proto3" json:"min_daily_profit_rate"` - // @inject_tag: json:"min_profit_per_trade_rate" + // @inject_tag: json:"min_profit_per_trade_rate" MinProfitPerTradeRate string `protobuf:"bytes,4,opt,name=MinProfitPerTradeRate,proto3" json:"min_profit_per_trade_rate"` - // @inject_tag: json:"max_fund_per_trade" + // @inject_tag: json:"max_fund_per_trade" MaxFundPerTrade string `protobuf:"bytes,5,opt,name=MaxFundPerTrade,proto3" json:"max_fund_per_trade"` - // @inject_tag: json:"indicators" + // @inject_tag: json:"indicators" Indicators []*StrategyIndicator `protobuf:"bytes,6,rep,name=Indicators,proto3" json:"indicators"` - // @inject_tag: json:"working_resolution" + // @inject_tag: json:"working_resolution" WorkingResolution *proto.Resolution `protobuf:"bytes,7,opt,name=WorkingResolution,proto3" json:"working_resolution"` - // @inject_tag: json:"markets" + // @inject_tag: json:"markets" Markets []*proto.Market `protobuf:"bytes,8,rep,name=Markets,proto3" json:"markets"` IsActive bool `protobuf:"varint,9,opt,name=IsActive,proto3" json:"IsActive,omitempty"` - // @inject_tag: json:"type" + // @inject_tag: json:"type" Type StrategyType `protobuf:"varint,10,opt,name=Type,proto3,enum=eagleApi.StrategyType" json:"type"` - // @inject_tag: json:"brokerage_id" + // @inject_tag: json:"brokerage_id" BrokerageID string `protobuf:"bytes,11,opt,name=BrokerageID,proto3" json:"brokerage_id"` - // @inject_tag: json:"with_trading" + // @inject_tag: json:"with_trading" WithTrading bool `protobuf:"varint,12,opt,name=WithTrading,proto3" json:"with_trading"` } @@ -447,7 +447,7 @@ type StrategyIndicatorReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // @inject_tag: json:"strategy_id" + // @inject_tag: json:"strategy_id" StrategyID string `protobuf:"bytes,1,opt,name=StrategyID,proto3" json:"strategy_id"` } @@ -495,12 +495,12 @@ type StrategyIndicator struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // @inject_tag: json:"strategy_id" + // @inject_tag: json:"strategy_id" StrategyID string `protobuf:"bytes,1,opt,name=StrategyID,proto3" json:"strategy_id"` - // @inject_tag: json:"indicator_id" + // @inject_tag: json:"indicator_id" IndicatorID string `protobuf:"bytes,2,opt,name=IndicatorID,proto3" json:"indicator_id"` - // @inject_tag: json:"type" - Type proto.IndicatorType `protobuf:"varint,3,opt,name=Type,proto3,enum=chipmunkApi.IndicatorType" json:"type"` + // @inject_tag: json:"type" + Type IndicatorType `protobuf:"varint,3,opt,name=Type,proto3,enum=eagleApi.IndicatorType" json:"type"` } func (x *StrategyIndicator) Reset() { @@ -549,11 +549,11 @@ func (x *StrategyIndicator) GetIndicatorID() string { return "" } -func (x *StrategyIndicator) GetType() proto.IndicatorType { +func (x *StrategyIndicator) GetType() IndicatorType { if x != nil { return x.Type } - return proto.IndicatorType(0) + return IndicatorType_Unknown } type StrategyIndicators struct { @@ -561,7 +561,7 @@ type StrategyIndicators struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // @inject_tag: json:"elements" + // @inject_tag: json:"elements" Elements []*StrategyIndicator `protobuf:"bytes,1,rep,name=Elements,proto3" json:"elements"` } @@ -609,7 +609,7 @@ type ReturnStrategyReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // @inject_tag: json:"id" + // @inject_tag: json:"id" ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"id"` } @@ -666,128 +666,128 @@ var file_services_eagle_api_proto_src_strategy_proto_rawDesc = []byte{ 0x6f, 0x74, 0x6f, 0x1a, 0x2c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x72, 0x63, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x63, 0x68, 0x69, 0x70, - 0x6d, 0x75, 0x6e, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, - 0x72, 0x63, 0x2f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xfc, 0x04, 0x0a, 0x08, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, - 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x12, - 0x1c, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, - 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x4e, - 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x20, 0x0a, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x2e, 0x0a, 0x12, 0x4d, 0x69, 0x6e, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x50, 0x72, 0x6f, - 0x66, 0x69, 0x74, 0x52, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x12, 0x4d, - 0x69, 0x6e, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x74, 0x52, 0x61, 0x74, - 0x65, 0x12, 0x34, 0x0a, 0x15, 0x4d, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x74, 0x50, 0x65, - 0x72, 0x54, 0x72, 0x61, 0x64, 0x65, 0x52, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x15, 0x4d, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x74, 0x50, 0x65, 0x72, 0x54, 0x72, - 0x61, 0x64, 0x65, 0x52, 0x61, 0x74, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x4d, 0x61, 0x78, 0x46, 0x75, - 0x6e, 0x64, 0x50, 0x65, 0x72, 0x54, 0x72, 0x61, 0x64, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x0f, 0x4d, 0x61, 0x78, 0x46, 0x75, 0x6e, 0x64, 0x50, 0x65, 0x72, 0x54, 0x72, 0x61, 0x64, - 0x65, 0x12, 0x30, 0x0a, 0x13, 0x4d, 0x61, 0x78, 0x46, 0x75, 0x6e, 0x64, 0x50, 0x65, 0x72, 0x54, - 0x72, 0x61, 0x64, 0x65, 0x52, 0x61, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x13, - 0x4d, 0x61, 0x78, 0x46, 0x75, 0x6e, 0x64, 0x50, 0x65, 0x72, 0x54, 0x72, 0x61, 0x64, 0x65, 0x52, - 0x61, 0x74, 0x65, 0x12, 0x45, 0x0a, 0x11, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, - 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x73, - 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, - 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x4d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x73, 0x12, 0x3b, 0x0a, 0x0a, 0x49, 0x6e, 0x64, 0x69, - 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x65, - 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, - 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x0a, 0x49, 0x6e, 0x64, 0x69, 0x63, - 0x61, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x49, 0x73, 0x41, 0x63, 0x74, 0x69, 0x76, - 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x49, 0x73, 0x41, 0x63, 0x74, 0x69, 0x76, - 0x65, 0x12, 0x2a, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x16, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, 0x61, 0x74, - 0x65, 0x67, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, - 0x0b, 0x42, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x0f, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x42, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, - 0x20, 0x0a, 0x0b, 0x57, 0x69, 0x74, 0x68, 0x54, 0x72, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x10, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x57, 0x69, 0x74, 0x68, 0x54, 0x72, 0x61, 0x64, 0x69, 0x6e, - 0x67, 0x22, 0x3c, 0x0a, 0x0a, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x69, 0x65, 0x73, 0x12, - 0x2e, 0x0a, 0x08, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, - 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, 0x08, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, - 0x98, 0x04, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, - 0x67, 0x79, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x44, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x12, 0x4d, - 0x69, 0x6e, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x74, 0x52, 0x61, 0x74, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x4d, 0x69, 0x6e, 0x44, 0x61, 0x69, 0x6c, - 0x79, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x74, 0x52, 0x61, 0x74, 0x65, 0x12, 0x34, 0x0a, 0x15, 0x4d, + 0x6f, 0x1a, 0x2c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x65, 0x61, 0x67, 0x6c, + 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x72, 0x63, 0x2f, + 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0xfc, 0x04, 0x0a, 0x08, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x0e, 0x0a, 0x02, + 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, + 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2e, + 0x0a, 0x12, 0x4d, 0x69, 0x6e, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x74, + 0x52, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x12, 0x4d, 0x69, 0x6e, 0x44, + 0x61, 0x69, 0x6c, 0x79, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x74, 0x52, 0x61, 0x74, 0x65, 0x12, 0x34, + 0x0a, 0x15, 0x4d, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x74, 0x50, 0x65, 0x72, 0x54, 0x72, + 0x61, 0x64, 0x65, 0x52, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x01, 0x52, 0x15, 0x4d, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x74, 0x50, 0x65, 0x72, 0x54, 0x72, 0x61, 0x64, 0x65, - 0x52, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x4d, 0x69, 0x6e, 0x50, + 0x52, 0x61, 0x74, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x4d, 0x61, 0x78, 0x46, 0x75, 0x6e, 0x64, 0x50, + 0x65, 0x72, 0x54, 0x72, 0x61, 0x64, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0f, 0x4d, + 0x61, 0x78, 0x46, 0x75, 0x6e, 0x64, 0x50, 0x65, 0x72, 0x54, 0x72, 0x61, 0x64, 0x65, 0x12, 0x30, + 0x0a, 0x13, 0x4d, 0x61, 0x78, 0x46, 0x75, 0x6e, 0x64, 0x50, 0x65, 0x72, 0x54, 0x72, 0x61, 0x64, + 0x65, 0x52, 0x61, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x13, 0x4d, 0x61, 0x78, + 0x46, 0x75, 0x6e, 0x64, 0x50, 0x65, 0x72, 0x54, 0x72, 0x61, 0x64, 0x65, 0x52, 0x61, 0x74, 0x65, + 0x12, 0x45, 0x0a, 0x11, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x6f, 0x6c, + 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x68, + 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, + 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x49, 0x44, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x4d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x49, 0x44, 0x73, 0x12, 0x3b, 0x0a, 0x0a, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, + 0x6f, 0x72, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x65, 0x61, 0x67, 0x6c, + 0x65, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x49, 0x6e, 0x64, + 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x0a, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, + 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x49, 0x73, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x0d, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x49, 0x73, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x2a, + 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x65, + 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, + 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x42, 0x72, + 0x6f, 0x6b, 0x65, 0x72, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x42, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, + 0x57, 0x69, 0x74, 0x68, 0x54, 0x72, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x10, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0b, 0x57, 0x69, 0x74, 0x68, 0x54, 0x72, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x22, 0x3c, + 0x0a, 0x0a, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x69, 0x65, 0x73, 0x12, 0x2e, 0x0a, 0x08, + 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, + 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, + 0x67, 0x79, 0x52, 0x08, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x98, 0x04, 0x0a, + 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, + 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x44, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x12, 0x4d, 0x69, 0x6e, 0x44, + 0x61, 0x69, 0x6c, 0x79, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x74, 0x52, 0x61, 0x74, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x4d, 0x69, 0x6e, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x50, 0x72, + 0x6f, 0x66, 0x69, 0x74, 0x52, 0x61, 0x74, 0x65, 0x12, 0x34, 0x0a, 0x15, 0x4d, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x74, 0x50, 0x65, 0x72, 0x54, 0x72, 0x61, 0x64, 0x65, 0x52, 0x61, 0x74, - 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x4d, 0x61, 0x78, 0x46, 0x75, 0x6e, 0x64, 0x50, 0x65, 0x72, 0x54, - 0x72, 0x61, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x4d, 0x61, 0x78, 0x46, - 0x75, 0x6e, 0x64, 0x50, 0x65, 0x72, 0x54, 0x72, 0x61, 0x64, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x49, - 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1b, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, 0x61, 0x74, - 0x65, 0x67, 0x79, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x0a, 0x49, 0x6e, - 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x45, 0x0a, 0x11, 0x57, 0x6f, 0x72, 0x6b, - 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, - 0x69, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x57, 0x6f, - 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x2d, 0x0a, 0x07, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x13, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x4d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x52, 0x07, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x1a, - 0x0a, 0x08, 0x49, 0x73, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x08, 0x49, 0x73, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x2a, 0x0a, 0x04, 0x54, 0x79, - 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, - 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x54, 0x79, 0x70, 0x65, - 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x42, 0x72, 0x6f, 0x6b, 0x65, 0x72, - 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x42, 0x72, 0x6f, - 0x6b, 0x65, 0x72, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x57, 0x69, 0x74, 0x68, - 0x54, 0x72, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x57, - 0x69, 0x74, 0x68, 0x54, 0x72, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x22, 0x36, 0x0a, 0x14, 0x53, 0x74, - 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x52, - 0x65, 0x71, 0x12, 0x1e, 0x0a, 0x0a, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x49, 0x44, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, - 0x49, 0x44, 0x22, 0x86, 0x01, 0x0a, 0x11, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x49, - 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x53, 0x74, 0x72, 0x61, - 0x74, 0x65, 0x67, 0x79, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x53, 0x74, - 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x49, 0x6e, 0x64, 0x69, - 0x63, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x49, - 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x44, 0x12, 0x2f, 0x0a, 0x04, 0x54, 0x79, - 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, - 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x22, 0x4d, 0x0a, 0x12, 0x53, - 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, - 0x73, 0x12, 0x37, 0x0a, 0x08, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x53, - 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, - 0x52, 0x08, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x23, 0x0a, 0x11, 0x52, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, 0x65, 0x71, 0x12, - 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x2a, - 0x1d, 0x0a, 0x0c, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x0d, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x10, 0x00, 0x32, 0xfc, - 0x01, 0x0a, 0x0f, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x39, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x1b, 0x2e, 0x65, - 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, - 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x65, 0x61, 0x67, 0x6c, - 0x65, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x39, 0x0a, - 0x06, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x12, 0x1b, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, - 0x70, 0x69, 0x2e, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, - 0x79, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, - 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x27, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, - 0x12, 0x09, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x56, 0x6f, 0x69, 0x64, 0x1a, 0x14, 0x2e, 0x65, 0x61, - 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x69, 0x65, - 0x73, 0x12, 0x4a, 0x0a, 0x0a, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x12, - 0x1e, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, 0x61, 0x74, - 0x65, 0x67, 0x79, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x1a, - 0x1c, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, 0x61, 0x74, - 0x65, 0x67, 0x79, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x42, 0x36, 0x5a, - 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x2d, 0x76, 0x61, - 0x72, 0x6d, 0x61, 0x7a, 0x79, 0x61, 0x72, 0x2f, 0x47, 0x61, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x4d, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x66, + 0x69, 0x74, 0x50, 0x65, 0x72, 0x54, 0x72, 0x61, 0x64, 0x65, 0x52, 0x61, 0x74, 0x65, 0x12, 0x28, + 0x0a, 0x0f, 0x4d, 0x61, 0x78, 0x46, 0x75, 0x6e, 0x64, 0x50, 0x65, 0x72, 0x54, 0x72, 0x61, 0x64, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x4d, 0x61, 0x78, 0x46, 0x75, 0x6e, 0x64, + 0x50, 0x65, 0x72, 0x54, 0x72, 0x61, 0x64, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x49, 0x6e, 0x64, 0x69, + 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x65, + 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, + 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x0a, 0x49, 0x6e, 0x64, 0x69, 0x63, + 0x61, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x45, 0x0a, 0x11, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, + 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x17, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x52, + 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x57, 0x6f, 0x72, 0x6b, 0x69, + 0x6e, 0x67, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x07, + 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, + 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x4d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x52, 0x07, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x49, + 0x73, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x49, + 0x73, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x2a, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, + 0x2e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x42, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x61, 0x67, 0x65, + 0x49, 0x44, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x42, 0x72, 0x6f, 0x6b, 0x65, 0x72, + 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x57, 0x69, 0x74, 0x68, 0x54, 0x72, 0x61, + 0x64, 0x69, 0x6e, 0x67, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x57, 0x69, 0x74, 0x68, + 0x54, 0x72, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x22, 0x36, 0x0a, 0x14, 0x53, 0x74, 0x72, 0x61, 0x74, + 0x65, 0x67, 0x79, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x12, + 0x1e, 0x0a, 0x0a, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x49, 0x44, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x49, 0x44, 0x22, + 0x82, 0x01, 0x0a, 0x11, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x49, 0x6e, 0x64, 0x69, + 0x63, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, + 0x79, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x53, 0x74, 0x72, 0x61, 0x74, + 0x65, 0x67, 0x79, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, + 0x6f, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x49, 0x6e, 0x64, 0x69, + 0x63, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x44, 0x12, 0x2b, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, + 0x2e, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, + 0x54, 0x79, 0x70, 0x65, 0x22, 0x4d, 0x0a, 0x12, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, + 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x45, 0x6c, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x65, + 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, + 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x08, 0x45, 0x6c, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x73, 0x22, 0x23, 0x0a, 0x11, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x53, 0x74, 0x72, + 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x2a, 0x1d, 0x0a, 0x0c, 0x53, 0x74, 0x72, 0x61, + 0x74, 0x65, 0x67, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x6f, + 0x6d, 0x61, 0x74, 0x65, 0x64, 0x10, 0x00, 0x32, 0xfc, 0x01, 0x0a, 0x0f, 0x53, 0x74, 0x72, 0x61, + 0x74, 0x65, 0x67, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x39, 0x0a, 0x06, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x1b, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, + 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, + 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, + 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x39, 0x0a, 0x06, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, + 0x12, 0x1b, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x74, 0x75, + 0x72, 0x6e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, + 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, + 0x79, 0x12, 0x27, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x09, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x56, 0x6f, 0x69, 0x64, 0x1a, 0x14, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, 0x41, 0x70, 0x69, 0x2e, + 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x69, 0x65, 0x73, 0x12, 0x4a, 0x0a, 0x0a, 0x49, 0x6e, + 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x1e, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, + 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x49, 0x6e, 0x64, 0x69, + 0x63, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x1c, 0x2e, 0x65, 0x61, 0x67, 0x6c, 0x65, + 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x49, 0x6e, 0x64, 0x69, + 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x2d, 0x76, 0x61, 0x72, 0x6d, 0x61, 0x7a, 0x79, 0x61, 0x72, + 0x2f, 0x47, 0x61, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x65, + 0x61, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -815,7 +815,7 @@ var file_services_eagle_api_proto_src_strategy_proto_goTypes = []interface{}{ (*ReturnStrategyReq)(nil), // 7: eagleApi.ReturnStrategyReq (*proto.Resolution)(nil), // 8: chipmunkApi.Resolution (*proto.Market)(nil), // 9: chipmunkApi.Market - (proto.IndicatorType)(0), // 10: chipmunkApi.Indicator.type + (IndicatorType)(0), // 10: eagleApi.IndicatorType (*proto1.Void)(nil), // 11: api.Void } var file_services_eagle_api_proto_src_strategy_proto_depIdxs = []int32{ @@ -827,7 +827,7 @@ var file_services_eagle_api_proto_src_strategy_proto_depIdxs = []int32{ 8, // 5: eagleApi.CreateStrategyReq.WorkingResolution:type_name -> chipmunkApi.Resolution 9, // 6: eagleApi.CreateStrategyReq.Markets:type_name -> chipmunkApi.Market 0, // 7: eagleApi.CreateStrategyReq.Type:type_name -> eagleApi.StrategyType - 10, // 8: eagleApi.StrategyIndicator.Type:type_name -> chipmunkApi.Indicator.type + 10, // 8: eagleApi.StrategyIndicator.Type:type_name -> eagleApi.IndicatorType 5, // 9: eagleApi.StrategyIndicators.Elements:type_name -> eagleApi.StrategyIndicator 3, // 10: eagleApi.StrategyService.Create:input_type -> eagleApi.CreateStrategyReq 7, // 11: eagleApi.StrategyService.Return:input_type -> eagleApi.ReturnStrategyReq @@ -849,6 +849,7 @@ func file_services_eagle_api_proto_src_strategy_proto_init() { if File_services_eagle_api_proto_src_strategy_proto != nil { return } + file_services_eagle_api_proto_src_indicator_proto_init() if !protoimpl.UnsafeEnabled { file_services_eagle_api_proto_src_strategy_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Strategy); i { diff --git a/services/eagle/internal/app/strategies/app.go b/services/eagle/internal/app/strategies/app.go index a12dc39..53bf806 100644 --- a/services/eagle/internal/app/strategies/app.go +++ b/services/eagle/internal/app/strategies/app.go @@ -2,6 +2,7 @@ package strategies import ( "context" + api "github.com/h-varmazyar/Gate/api/proto" "github.com/h-varmazyar/Gate/pkg/grpcext" chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" eagleApi "github.com/h-varmazyar/Gate/services/eagle/api/proto" @@ -31,7 +32,7 @@ func NewApp(ctx context.Context, logger *log.Logger, db *db.DB, configs *Configs configs: configs, } var signalCheckerWorker *workers.SignalCheckWorker - if signalCheckerWorker, err = app.initiateSignalCheckerWorker(ctx, repositoryInstance); err != nil { + if signalCheckerWorker, err = app.initiateSignalCheckerWorker(ctx, repositoryInstance, logger); err != nil { logger.WithError(err).Error("failed to initiate signal checker worker") return nil, err } @@ -43,8 +44,9 @@ func NewApp(ctx context.Context, logger *log.Logger, db *db.DB, configs *Configs return app, nil } -func (app *App) initiateSignalCheckerWorker(ctx context.Context, db repository.StrategyRepository) (*workers.SignalCheckWorker, error) { - worker := workers.SignalCheckWorkerInstance() +func (app *App) initiateSignalCheckerWorker(ctx context.Context, db repository.StrategyRepository, logger *log.Logger) (*workers.SignalCheckWorker, error) { + logger.Infof("initializing signal check worker") + worker := workers.SignalCheckWorkerInstance(logger) marketService := chipmunkApi.NewMarketServiceClient(grpcext.NewConnection(app.configs.ChipmunkAddress)) @@ -57,23 +59,16 @@ func (app *App) initiateSignalCheckerWorker(ctx context.Context, db repository.S for _, strategy := range strategies { switch strategy.Type { case eagleApi.StrategyType_Automated: - automated, err := automatedStrategy.NewAutomatedStrategy(strategy, app.configs.AutomatedWorker) + automated, err := automatedStrategy.NewAutomatedStrategy(strategy, app.configs.AutomatedWorker, logger) if err != nil { app.logger.WithError(err).Errorf("failed to create new instance of automated strategy") return nil, err } - markets := make([]*chipmunkApi.Market, 0) - for _, id := range strategy.MarketIDs { - market, err := marketService.Return(ctx, &chipmunkApi.MarketReturnReq{ID: id}) - if err != nil { - app.logger.WithError(err).Error("failed to return market") - return nil, err - } - markets = append(markets, market) - } + marketListReq := &chipmunkApi.MarketListReq{Platform: api.Platform_Coinex} + markets, err := marketService.List(ctx, marketListReq) - worker.Start(automated, markets, strategy.BrokerageID) + worker.Start(automated, markets.Elements, strategy.BrokerageID) default: } } diff --git a/services/eagle/internal/app/strategies/workers/signalCheckWorker.go b/services/eagle/internal/app/strategies/workers/signalCheckWorker.go index b8dc633..6c110b6 100644 --- a/services/eagle/internal/app/strategies/workers/signalCheckWorker.go +++ b/services/eagle/internal/app/strategies/workers/signalCheckWorker.go @@ -3,22 +3,26 @@ package workers import ( "context" "github.com/google/uuid" + api "github.com/h-varmazyar/Gate/api/proto" chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" "github.com/h-varmazyar/Gate/services/eagle/internal/pkg/strategies" + log "github.com/sirupsen/logrus" ) type SignalCheckWorker struct { cancelFunctions map[uuid.UUID]context.CancelFunc + log *log.Logger } var ( signalCheckWorker *SignalCheckWorker ) -func SignalCheckWorkerInstance() *SignalCheckWorker { +func SignalCheckWorkerInstance(log *log.Logger) *SignalCheckWorker { if signalCheckWorker == nil { signalCheckWorker = &SignalCheckWorker{ cancelFunctions: make(map[uuid.UUID]context.CancelFunc), + log: log, } } return signalCheckWorker @@ -27,8 +31,13 @@ func SignalCheckWorkerInstance() *SignalCheckWorker { func (w *SignalCheckWorker) Start(strategy strategies.Strategy, markets []*chipmunkApi.Market, brokerageID uuid.UUID) { ctx, fn := context.WithCancel(context.Background()) w.cancelFunctions[brokerageID] = fn + + w.log.Infof("starting signal check for markets: %v", len(markets)) + for _, market := range markets { - go strategy.CheckForSignals(ctx, market) + if market.Status == api.Status_Enable { + go strategy.CheckForSignals(ctx, market) + } } } diff --git a/services/eagle/internal/pkg/strategies/automatedStrategy/automated.go b/services/eagle/internal/pkg/strategies/automatedStrategy/automated.go index 68bcb11..bb3ecd0 100644 --- a/services/eagle/internal/pkg/strategies/automatedStrategy/automated.go +++ b/services/eagle/internal/pkg/strategies/automatedStrategy/automated.go @@ -27,15 +27,17 @@ type Automated struct { botService telegramBotApi.BotServiceClient signalPool *redis.Client configs *Configs + log *log.Logger } -func NewAutomatedStrategy(strategy *entity.Strategy, configs *Configs) (strategies.Strategy, error) { +func NewAutomatedStrategy(strategy *entity.Strategy, configs *Configs, log *log.Logger) (strategies.Strategy, error) { if strategy == nil { return nil, errors.NewWithSlug(context.Background(), codes.FailedPrecondition, "empty_strategy") } automated := new(Automated) automated.Strategy = strategy automated.configs = configs + automated.log = log automated.signalPool = redis.NewClient(&redis.Options{ Addr: configs.RedisAddress, @@ -79,11 +81,11 @@ func (s *Automated) CheckForSignals(ctx context.Context, market *chipmunkApi.Mar case <-ctx.Done(): checkTicker.Stop() case <-checkTicker.C: - reference, err = s.walletsService.ReturnReference(context.Background(), &chipmunkApi.ReturnReferenceReq{ReferenceName: market.Destination.Name}) - if err != nil { - log.WithError(err).Errorf("failed to fetch wallet info for market %v and reference %v", marketID, market.Destination.Name) - continue - } + //reference, err = s.walletsService.ReturnReference(context.Background(), &chipmunkApi.ReturnReferenceReq{ReferenceName: market.Destination.Name}) + //if err != nil { + // log.WithError(err).Errorf("failed to fetch wallet info for market %v and reference %v", marketID, market.Destination.Name) + // continue + //} //if reference.ActiveBalance <= 0 || reference.ActiveBalance < reference.TotalBalance/10 { // continue //} diff --git a/services/indicators/api/proto/configs.pb.go b/services/indicators/api/proto/configs.pb.go new file mode 100644 index 0000000..77a03ca --- /dev/null +++ b/services/indicators/api/proto/configs.pb.go @@ -0,0 +1,553 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.12.4 +// source: services/indicators/api/proto/src/configs.proto + +package proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type RsiConfigs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // @inject_tag: json:"length" + Length int32 `protobuf:"varint,1,opt,name=Length,proto3" json:"length"` +} + +func (x *RsiConfigs) Reset() { + *x = RsiConfigs{} + if protoimpl.UnsafeEnabled { + mi := &file_services_indicators_api_proto_src_configs_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RsiConfigs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RsiConfigs) ProtoMessage() {} + +func (x *RsiConfigs) ProtoReflect() protoreflect.Message { + mi := &file_services_indicators_api_proto_src_configs_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RsiConfigs.ProtoReflect.Descriptor instead. +func (*RsiConfigs) Descriptor() ([]byte, []int) { + return file_services_indicators_api_proto_src_configs_proto_rawDescGZIP(), []int{0} +} + +func (x *RsiConfigs) GetLength() int32 { + if x != nil { + return x.Length + } + return 0 +} + +type IndicatorConfigs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Configs: + // *IndicatorConfigs_Rsi + // *IndicatorConfigs_Stochastic + // *IndicatorConfigs_MovingAverage + // *IndicatorConfigs_BollingerBands + Configs isIndicatorConfigs_Configs `protobuf_oneof:"configs"` +} + +func (x *IndicatorConfigs) Reset() { + *x = IndicatorConfigs{} + if protoimpl.UnsafeEnabled { + mi := &file_services_indicators_api_proto_src_configs_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IndicatorConfigs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IndicatorConfigs) ProtoMessage() {} + +func (x *IndicatorConfigs) ProtoReflect() protoreflect.Message { + mi := &file_services_indicators_api_proto_src_configs_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IndicatorConfigs.ProtoReflect.Descriptor instead. +func (*IndicatorConfigs) Descriptor() ([]byte, []int) { + return file_services_indicators_api_proto_src_configs_proto_rawDescGZIP(), []int{1} +} + +func (m *IndicatorConfigs) GetConfigs() isIndicatorConfigs_Configs { + if m != nil { + return m.Configs + } + return nil +} + +func (x *IndicatorConfigs) GetRsi() *RsiConfigs { + if x, ok := x.GetConfigs().(*IndicatorConfigs_Rsi); ok { + return x.Rsi + } + return nil +} + +func (x *IndicatorConfigs) GetStochastic() *StochasticConfigs { + if x, ok := x.GetConfigs().(*IndicatorConfigs_Stochastic); ok { + return x.Stochastic + } + return nil +} + +func (x *IndicatorConfigs) GetMovingAverage() *MovingAverageConfigs { + if x, ok := x.GetConfigs().(*IndicatorConfigs_MovingAverage); ok { + return x.MovingAverage + } + return nil +} + +func (x *IndicatorConfigs) GetBollingerBands() *BollingerBandsConfigs { + if x, ok := x.GetConfigs().(*IndicatorConfigs_BollingerBands); ok { + return x.BollingerBands + } + return nil +} + +type isIndicatorConfigs_Configs interface { + isIndicatorConfigs_Configs() +} + +type IndicatorConfigs_Rsi struct { + Rsi *RsiConfigs `protobuf:"bytes,1,opt,name=rsi,proto3,oneof"` +} + +type IndicatorConfigs_Stochastic struct { + Stochastic *StochasticConfigs `protobuf:"bytes,2,opt,name=stochastic,proto3,oneof"` +} + +type IndicatorConfigs_MovingAverage struct { + MovingAverage *MovingAverageConfigs `protobuf:"bytes,3,opt,name=moving_average,json=movingAverage,proto3,oneof"` +} + +type IndicatorConfigs_BollingerBands struct { + BollingerBands *BollingerBandsConfigs `protobuf:"bytes,4,opt,name=bollinger_bands,json=bollingerBands,proto3,oneof"` +} + +func (*IndicatorConfigs_Rsi) isIndicatorConfigs_Configs() {} + +func (*IndicatorConfigs_Stochastic) isIndicatorConfigs_Configs() {} + +func (*IndicatorConfigs_MovingAverage) isIndicatorConfigs_Configs() {} + +func (*IndicatorConfigs_BollingerBands) isIndicatorConfigs_Configs() {} + +type StochasticConfigs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // @inject_tag: json:"length" + Length int32 `protobuf:"varint,1,opt,name=Length,proto3" json:"length"` + // @inject_tag: json:"smooth_k" + SmoothK int32 `protobuf:"varint,2,opt,name=SmoothK,proto3" json:"smooth_k"` + // @inject_tag: json:"smooth_d" + SmoothD int32 `protobuf:"varint,3,opt,name=SmoothD,proto3" json:"smooth_d"` +} + +func (x *StochasticConfigs) Reset() { + *x = StochasticConfigs{} + if protoimpl.UnsafeEnabled { + mi := &file_services_indicators_api_proto_src_configs_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StochasticConfigs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StochasticConfigs) ProtoMessage() {} + +func (x *StochasticConfigs) ProtoReflect() protoreflect.Message { + mi := &file_services_indicators_api_proto_src_configs_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StochasticConfigs.ProtoReflect.Descriptor instead. +func (*StochasticConfigs) Descriptor() ([]byte, []int) { + return file_services_indicators_api_proto_src_configs_proto_rawDescGZIP(), []int{2} +} + +func (x *StochasticConfigs) GetLength() int32 { + if x != nil { + return x.Length + } + return 0 +} + +func (x *StochasticConfigs) GetSmoothK() int32 { + if x != nil { + return x.SmoothK + } + return 0 +} + +func (x *StochasticConfigs) GetSmoothD() int32 { + if x != nil { + return x.SmoothD + } + return 0 +} + +type MovingAverageConfigs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // @inject_tag: json:"length" + Length int32 `protobuf:"varint,1,opt,name=Length,proto3" json:"length"` + // @inject_tag: json:"source" + Source Source `protobuf:"varint,2,opt,name=Source,proto3,enum=indicatorApi.Source" json:"source"` +} + +func (x *MovingAverageConfigs) Reset() { + *x = MovingAverageConfigs{} + if protoimpl.UnsafeEnabled { + mi := &file_services_indicators_api_proto_src_configs_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MovingAverageConfigs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MovingAverageConfigs) ProtoMessage() {} + +func (x *MovingAverageConfigs) ProtoReflect() protoreflect.Message { + mi := &file_services_indicators_api_proto_src_configs_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MovingAverageConfigs.ProtoReflect.Descriptor instead. +func (*MovingAverageConfigs) Descriptor() ([]byte, []int) { + return file_services_indicators_api_proto_src_configs_proto_rawDescGZIP(), []int{3} +} + +func (x *MovingAverageConfigs) GetLength() int32 { + if x != nil { + return x.Length + } + return 0 +} + +func (x *MovingAverageConfigs) GetSource() Source { + if x != nil { + return x.Source + } + return Source_CUSTOM +} + +type BollingerBandsConfigs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // @inject_tag: json:"length" + Length int32 `protobuf:"varint,1,opt,name=Length,proto3" json:"length"` + // @inject_tag: json:"deviation" + Deviation int32 `protobuf:"varint,2,opt,name=Deviation,proto3" json:"deviation"` + // @inject_tag: json:"source" + Source Source `protobuf:"varint,3,opt,name=Source,proto3,enum=indicatorApi.Source" json:"source"` +} + +func (x *BollingerBandsConfigs) Reset() { + *x = BollingerBandsConfigs{} + if protoimpl.UnsafeEnabled { + mi := &file_services_indicators_api_proto_src_configs_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BollingerBandsConfigs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BollingerBandsConfigs) ProtoMessage() {} + +func (x *BollingerBandsConfigs) ProtoReflect() protoreflect.Message { + mi := &file_services_indicators_api_proto_src_configs_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BollingerBandsConfigs.ProtoReflect.Descriptor instead. +func (*BollingerBandsConfigs) Descriptor() ([]byte, []int) { + return file_services_indicators_api_proto_src_configs_proto_rawDescGZIP(), []int{4} +} + +func (x *BollingerBandsConfigs) GetLength() int32 { + if x != nil { + return x.Length + } + return 0 +} + +func (x *BollingerBandsConfigs) GetDeviation() int32 { + if x != nil { + return x.Deviation + } + return 0 +} + +func (x *BollingerBandsConfigs) GetSource() Source { + if x != nil { + return x.Source + } + return Source_CUSTOM +} + +var File_services_indicators_api_proto_src_configs_proto protoreflect.FileDescriptor + +var file_services_indicators_api_proto_src_configs_proto_rawDesc = []byte{ + 0x0a, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x64, 0x69, 0x63, + 0x61, 0x74, 0x6f, 0x72, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x73, 0x72, 0x63, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x0c, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x70, 0x69, 0x1a, + 0x2c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, + 0x74, 0x6f, 0x72, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, + 0x72, 0x63, 0x2f, 0x6d, 0x69, 0x73, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x24, 0x0a, + 0x0a, 0x52, 0x73, 0x69, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x4c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x22, 0xab, 0x02, 0x0a, 0x10, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, + 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x2c, 0x0a, 0x03, 0x72, 0x73, 0x69, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, + 0x72, 0x41, 0x70, 0x69, 0x2e, 0x52, 0x73, 0x69, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x48, + 0x00, 0x52, 0x03, 0x72, 0x73, 0x69, 0x12, 0x41, 0x0a, 0x0a, 0x73, 0x74, 0x6f, 0x63, 0x68, 0x61, + 0x73, 0x74, 0x69, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x69, 0x6e, 0x64, + 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x68, 0x61, + 0x73, 0x74, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x48, 0x00, 0x52, 0x0a, 0x73, + 0x74, 0x6f, 0x63, 0x68, 0x61, 0x73, 0x74, 0x69, 0x63, 0x12, 0x4b, 0x0a, 0x0e, 0x6d, 0x6f, 0x76, + 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x22, 0x2e, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x70, 0x69, + 0x2e, 0x4d, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x41, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x73, 0x48, 0x00, 0x52, 0x0d, 0x6d, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x41, + 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x12, 0x4e, 0x0a, 0x0f, 0x62, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, + 0x67, 0x65, 0x72, 0x5f, 0x62, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x23, 0x2e, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x70, 0x69, 0x2e, 0x42, + 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, 0x73, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x73, 0x48, 0x00, 0x52, 0x0e, 0x62, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x65, + 0x72, 0x42, 0x61, 0x6e, 0x64, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x73, 0x22, 0x5f, 0x0a, 0x11, 0x53, 0x74, 0x6f, 0x63, 0x68, 0x61, 0x73, 0x74, 0x69, 0x63, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, + 0x0a, 0x07, 0x53, 0x6d, 0x6f, 0x6f, 0x74, 0x68, 0x4b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x07, 0x53, 0x6d, 0x6f, 0x6f, 0x74, 0x68, 0x4b, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x6d, 0x6f, 0x6f, + 0x74, 0x68, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x53, 0x6d, 0x6f, 0x6f, 0x74, + 0x68, 0x44, 0x22, 0x5c, 0x0a, 0x14, 0x4d, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x41, 0x76, 0x65, 0x72, + 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x4c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x12, 0x2c, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x70, + 0x69, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x22, 0x7b, 0x0a, 0x15, 0x42, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x42, 0x61, 0x6e, + 0x64, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x4c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x44, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x44, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x2c, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x14, 0x2e, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x70, 0x69, 0x2e, 0x53, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x3a, 0x5a, + 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x2d, 0x76, 0x61, + 0x72, 0x6d, 0x61, 0x7a, 0x79, 0x61, 0x72, 0x2f, 0x47, 0x61, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_services_indicators_api_proto_src_configs_proto_rawDescOnce sync.Once + file_services_indicators_api_proto_src_configs_proto_rawDescData = file_services_indicators_api_proto_src_configs_proto_rawDesc +) + +func file_services_indicators_api_proto_src_configs_proto_rawDescGZIP() []byte { + file_services_indicators_api_proto_src_configs_proto_rawDescOnce.Do(func() { + file_services_indicators_api_proto_src_configs_proto_rawDescData = protoimpl.X.CompressGZIP(file_services_indicators_api_proto_src_configs_proto_rawDescData) + }) + return file_services_indicators_api_proto_src_configs_proto_rawDescData +} + +var file_services_indicators_api_proto_src_configs_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_services_indicators_api_proto_src_configs_proto_goTypes = []interface{}{ + (*RsiConfigs)(nil), // 0: indicatorApi.RsiConfigs + (*IndicatorConfigs)(nil), // 1: indicatorApi.IndicatorConfigs + (*StochasticConfigs)(nil), // 2: indicatorApi.StochasticConfigs + (*MovingAverageConfigs)(nil), // 3: indicatorApi.MovingAverageConfigs + (*BollingerBandsConfigs)(nil), // 4: indicatorApi.BollingerBandsConfigs + (Source)(0), // 5: indicatorApi.Source +} +var file_services_indicators_api_proto_src_configs_proto_depIdxs = []int32{ + 0, // 0: indicatorApi.IndicatorConfigs.rsi:type_name -> indicatorApi.RsiConfigs + 2, // 1: indicatorApi.IndicatorConfigs.stochastic:type_name -> indicatorApi.StochasticConfigs + 3, // 2: indicatorApi.IndicatorConfigs.moving_average:type_name -> indicatorApi.MovingAverageConfigs + 4, // 3: indicatorApi.IndicatorConfigs.bollinger_bands:type_name -> indicatorApi.BollingerBandsConfigs + 5, // 4: indicatorApi.MovingAverageConfigs.Source:type_name -> indicatorApi.Source + 5, // 5: indicatorApi.BollingerBandsConfigs.Source:type_name -> indicatorApi.Source + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_services_indicators_api_proto_src_configs_proto_init() } +func file_services_indicators_api_proto_src_configs_proto_init() { + if File_services_indicators_api_proto_src_configs_proto != nil { + return + } + file_services_indicators_api_proto_src_misc_proto_init() + if !protoimpl.UnsafeEnabled { + file_services_indicators_api_proto_src_configs_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RsiConfigs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_indicators_api_proto_src_configs_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IndicatorConfigs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_indicators_api_proto_src_configs_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StochasticConfigs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_indicators_api_proto_src_configs_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MovingAverageConfigs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_indicators_api_proto_src_configs_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BollingerBandsConfigs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_services_indicators_api_proto_src_configs_proto_msgTypes[1].OneofWrappers = []interface{}{ + (*IndicatorConfigs_Rsi)(nil), + (*IndicatorConfigs_Stochastic)(nil), + (*IndicatorConfigs_MovingAverage)(nil), + (*IndicatorConfigs_BollingerBands)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_services_indicators_api_proto_src_configs_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_services_indicators_api_proto_src_configs_proto_goTypes, + DependencyIndexes: file_services_indicators_api_proto_src_configs_proto_depIdxs, + MessageInfos: file_services_indicators_api_proto_src_configs_proto_msgTypes, + }.Build() + File_services_indicators_api_proto_src_configs_proto = out.File + file_services_indicators_api_proto_src_configs_proto_rawDesc = nil + file_services_indicators_api_proto_src_configs_proto_goTypes = nil + file_services_indicators_api_proto_src_configs_proto_depIdxs = nil +} diff --git a/services/indicators/api/proto/indicators.pb.go b/services/indicators/api/proto/indicators.pb.go new file mode 100644 index 0000000..8f5598f --- /dev/null +++ b/services/indicators/api/proto/indicators.pb.go @@ -0,0 +1,359 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.12.4 +// source: services/indicators/api/proto/src/indicators.proto + +package proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type IndicatorRegisterReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type Type `protobuf:"varint,1,opt,name=type,proto3,enum=indicatorApi.Type" json:"type,omitempty"` + Configs *IndicatorConfigs `protobuf:"bytes,2,opt,name=Configs,proto3" json:"Configs,omitempty"` +} + +func (x *IndicatorRegisterReq) Reset() { + *x = IndicatorRegisterReq{} + if protoimpl.UnsafeEnabled { + mi := &file_services_indicators_api_proto_src_indicators_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IndicatorRegisterReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IndicatorRegisterReq) ProtoMessage() {} + +func (x *IndicatorRegisterReq) ProtoReflect() protoreflect.Message { + mi := &file_services_indicators_api_proto_src_indicators_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IndicatorRegisterReq.ProtoReflect.Descriptor instead. +func (*IndicatorRegisterReq) Descriptor() ([]byte, []int) { + return file_services_indicators_api_proto_src_indicators_proto_rawDescGZIP(), []int{0} +} + +func (x *IndicatorRegisterReq) GetType() Type { + if x != nil { + return x.Type + } + return Type_NOTHING +} + +func (x *IndicatorRegisterReq) GetConfigs() *IndicatorConfigs { + if x != nil { + return x.Configs + } + return nil +} + +type IndicatorValuesReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=Id,proto3" json:"Id,omitempty"` + Page uint32 `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"` + PageSize uint32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` +} + +func (x *IndicatorValuesReq) Reset() { + *x = IndicatorValuesReq{} + if protoimpl.UnsafeEnabled { + mi := &file_services_indicators_api_proto_src_indicators_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IndicatorValuesReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IndicatorValuesReq) ProtoMessage() {} + +func (x *IndicatorValuesReq) ProtoReflect() protoreflect.Message { + mi := &file_services_indicators_api_proto_src_indicators_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IndicatorValuesReq.ProtoReflect.Descriptor instead. +func (*IndicatorValuesReq) Descriptor() ([]byte, []int) { + return file_services_indicators_api_proto_src_indicators_proto_rawDescGZIP(), []int{1} +} + +func (x *IndicatorValuesReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *IndicatorValuesReq) GetPage() uint32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *IndicatorValuesReq) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +type Indicator struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=Id,proto3" json:"Id,omitempty"` + Type Type `protobuf:"varint,2,opt,name=type,proto3,enum=indicatorApi.Type" json:"type,omitempty"` + Configs *IndicatorConfigs `protobuf:"bytes,3,opt,name=Configs,proto3" json:"Configs,omitempty"` +} + +func (x *Indicator) Reset() { + *x = Indicator{} + if protoimpl.UnsafeEnabled { + mi := &file_services_indicators_api_proto_src_indicators_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Indicator) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Indicator) ProtoMessage() {} + +func (x *Indicator) ProtoReflect() protoreflect.Message { + mi := &file_services_indicators_api_proto_src_indicators_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Indicator.ProtoReflect.Descriptor instead. +func (*Indicator) Descriptor() ([]byte, []int) { + return file_services_indicators_api_proto_src_indicators_proto_rawDescGZIP(), []int{2} +} + +func (x *Indicator) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Indicator) GetType() Type { + if x != nil { + return x.Type + } + return Type_NOTHING +} + +func (x *Indicator) GetConfigs() *IndicatorConfigs { + if x != nil { + return x.Configs + } + return nil +} + +var File_services_indicators_api_proto_src_indicators_proto protoreflect.FileDescriptor + +var file_services_indicators_api_proto_src_indicators_proto_rawDesc = []byte{ + 0x0a, 0x32, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x64, 0x69, 0x63, + 0x61, 0x74, 0x6f, 0x72, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x73, 0x72, 0x63, 0x2f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x41, + 0x70, 0x69, 0x1a, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x64, + 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x73, 0x72, 0x63, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x69, 0x6e, + 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x73, 0x72, 0x63, 0x2f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x2c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x69, 0x6e, + 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x73, 0x72, 0x63, 0x2f, 0x6d, 0x69, 0x73, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x78, 0x0a, 0x14, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, + 0x74, 0x6f, 0x72, 0x41, 0x70, 0x69, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x38, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x70, + 0x69, 0x2e, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x73, 0x52, 0x07, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x22, 0x55, 0x0a, 0x12, 0x49, + 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x52, 0x65, + 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, + 0x64, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, + 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, + 0x7a, 0x65, 0x22, 0x7d, 0x0a, 0x09, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x12, + 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12, + 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, + 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x70, 0x69, 0x2e, 0x54, 0x79, 0x70, + 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x69, 0x6e, 0x64, 0x69, 0x63, + 0x61, 0x74, 0x6f, 0x72, 0x41, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, + 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x07, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x73, 0x32, 0xa6, 0x01, 0x0a, 0x10, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x47, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x65, 0x72, 0x12, 0x22, 0x2e, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x70, + 0x69, 0x2e, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, + 0x6f, 0x72, 0x41, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x12, + 0x49, 0x0a, 0x06, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x20, 0x2e, 0x69, 0x6e, 0x64, 0x69, + 0x63, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, + 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x1d, 0x2e, 0x69, 0x6e, + 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x64, 0x69, 0x63, + 0x61, 0x74, 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x2d, 0x76, 0x61, 0x72, 0x6d, 0x61, + 0x7a, 0x79, 0x61, 0x72, 0x2f, 0x47, 0x61, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_services_indicators_api_proto_src_indicators_proto_rawDescOnce sync.Once + file_services_indicators_api_proto_src_indicators_proto_rawDescData = file_services_indicators_api_proto_src_indicators_proto_rawDesc +) + +func file_services_indicators_api_proto_src_indicators_proto_rawDescGZIP() []byte { + file_services_indicators_api_proto_src_indicators_proto_rawDescOnce.Do(func() { + file_services_indicators_api_proto_src_indicators_proto_rawDescData = protoimpl.X.CompressGZIP(file_services_indicators_api_proto_src_indicators_proto_rawDescData) + }) + return file_services_indicators_api_proto_src_indicators_proto_rawDescData +} + +var file_services_indicators_api_proto_src_indicators_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_services_indicators_api_proto_src_indicators_proto_goTypes = []interface{}{ + (*IndicatorRegisterReq)(nil), // 0: indicatorApi.IndicatorRegisterReq + (*IndicatorValuesReq)(nil), // 1: indicatorApi.IndicatorValuesReq + (*Indicator)(nil), // 2: indicatorApi.Indicator + (Type)(0), // 3: indicatorApi.Type + (*IndicatorConfigs)(nil), // 4: indicatorApi.IndicatorConfigs + (*IndicatorValues)(nil), // 5: indicatorApi.IndicatorValues +} +var file_services_indicators_api_proto_src_indicators_proto_depIdxs = []int32{ + 3, // 0: indicatorApi.IndicatorRegisterReq.type:type_name -> indicatorApi.Type + 4, // 1: indicatorApi.IndicatorRegisterReq.Configs:type_name -> indicatorApi.IndicatorConfigs + 3, // 2: indicatorApi.Indicator.type:type_name -> indicatorApi.Type + 4, // 3: indicatorApi.Indicator.Configs:type_name -> indicatorApi.IndicatorConfigs + 0, // 4: indicatorApi.indicatorService.Register:input_type -> indicatorApi.IndicatorRegisterReq + 1, // 5: indicatorApi.indicatorService.Values:input_type -> indicatorApi.IndicatorValuesReq + 2, // 6: indicatorApi.indicatorService.Register:output_type -> indicatorApi.Indicator + 5, // 7: indicatorApi.indicatorService.Values:output_type -> indicatorApi.IndicatorValues + 6, // [6:8] is the sub-list for method output_type + 4, // [4:6] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_services_indicators_api_proto_src_indicators_proto_init() } +func file_services_indicators_api_proto_src_indicators_proto_init() { + if File_services_indicators_api_proto_src_indicators_proto != nil { + return + } + file_services_indicators_api_proto_src_configs_proto_init() + file_services_indicators_api_proto_src_values_proto_init() + file_services_indicators_api_proto_src_misc_proto_init() + if !protoimpl.UnsafeEnabled { + file_services_indicators_api_proto_src_indicators_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IndicatorRegisterReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_indicators_api_proto_src_indicators_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IndicatorValuesReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_indicators_api_proto_src_indicators_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Indicator); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_services_indicators_api_proto_src_indicators_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_services_indicators_api_proto_src_indicators_proto_goTypes, + DependencyIndexes: file_services_indicators_api_proto_src_indicators_proto_depIdxs, + MessageInfos: file_services_indicators_api_proto_src_indicators_proto_msgTypes, + }.Build() + File_services_indicators_api_proto_src_indicators_proto = out.File + file_services_indicators_api_proto_src_indicators_proto_rawDesc = nil + file_services_indicators_api_proto_src_indicators_proto_goTypes = nil + file_services_indicators_api_proto_src_indicators_proto_depIdxs = nil +} diff --git a/services/indicators/api/proto/indicators_grpc.pb.go b/services/indicators/api/proto/indicators_grpc.pb.go new file mode 100644 index 0000000..f6080ee --- /dev/null +++ b/services/indicators/api/proto/indicators_grpc.pb.go @@ -0,0 +1,139 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.12.4 +// source: services/indicators/api/proto/src/indicators.proto + +package proto + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// IndicatorServiceClient is the client API for IndicatorService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type IndicatorServiceClient interface { + Register(ctx context.Context, in *IndicatorRegisterReq, opts ...grpc.CallOption) (*Indicator, error) + Values(ctx context.Context, in *IndicatorValuesReq, opts ...grpc.CallOption) (*IndicatorValues, error) +} + +type indicatorServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewIndicatorServiceClient(cc grpc.ClientConnInterface) IndicatorServiceClient { + return &indicatorServiceClient{cc} +} + +func (c *indicatorServiceClient) Register(ctx context.Context, in *IndicatorRegisterReq, opts ...grpc.CallOption) (*Indicator, error) { + out := new(Indicator) + err := c.cc.Invoke(ctx, "/indicatorApi.indicatorService/Register", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *indicatorServiceClient) Values(ctx context.Context, in *IndicatorValuesReq, opts ...grpc.CallOption) (*IndicatorValues, error) { + out := new(IndicatorValues) + err := c.cc.Invoke(ctx, "/indicatorApi.indicatorService/Values", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// IndicatorServiceServer is the server API for IndicatorService service. +// All implementations should embed UnimplementedIndicatorServiceServer +// for forward compatibility +type IndicatorServiceServer interface { + Register(context.Context, *IndicatorRegisterReq) (*Indicator, error) + Values(context.Context, *IndicatorValuesReq) (*IndicatorValues, error) +} + +// UnimplementedIndicatorServiceServer should be embedded to have forward compatible implementations. +type UnimplementedIndicatorServiceServer struct { +} + +func (UnimplementedIndicatorServiceServer) Register(context.Context, *IndicatorRegisterReq) (*Indicator, error) { + return nil, status.Errorf(codes.Unimplemented, "method Register not implemented") +} +func (UnimplementedIndicatorServiceServer) Values(context.Context, *IndicatorValuesReq) (*IndicatorValues, error) { + return nil, status.Errorf(codes.Unimplemented, "method Values not implemented") +} + +// UnsafeIndicatorServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to IndicatorServiceServer will +// result in compilation errors. +type UnsafeIndicatorServiceServer interface { + mustEmbedUnimplementedIndicatorServiceServer() +} + +func RegisterIndicatorServiceServer(s grpc.ServiceRegistrar, srv IndicatorServiceServer) { + s.RegisterService(&IndicatorService_ServiceDesc, srv) +} + +func _IndicatorService_Register_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(IndicatorRegisterReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IndicatorServiceServer).Register(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/indicatorApi.indicatorService/Register", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IndicatorServiceServer).Register(ctx, req.(*IndicatorRegisterReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _IndicatorService_Values_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(IndicatorValuesReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IndicatorServiceServer).Values(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/indicatorApi.indicatorService/Values", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IndicatorServiceServer).Values(ctx, req.(*IndicatorValuesReq)) + } + return interceptor(ctx, in, info, handler) +} + +// IndicatorService_ServiceDesc is the grpc.ServiceDesc for IndicatorService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var IndicatorService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "indicatorApi.indicatorService", + HandlerType: (*IndicatorServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Register", + Handler: _IndicatorService_Register_Handler, + }, + { + MethodName: "Values", + Handler: _IndicatorService_Values_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "services/indicators/api/proto/src/indicators.proto", +} diff --git a/services/indicators/api/proto/misc.pb.go b/services/indicators/api/proto/misc.pb.go new file mode 100644 index 0000000..7080cd7 --- /dev/null +++ b/services/indicators/api/proto/misc.pb.go @@ -0,0 +1,218 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.12.4 +// source: services/indicators/api/proto/src/misc.proto + +package proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Source int32 + +const ( + Source_CUSTOM Source = 0 + Source_OHLC4 Source = 1 + Source_CLOSE Source = 2 + Source_OPEN Source = 3 + Source_HIGH Source = 4 + Source_HLC3 Source = 5 + Source_LOW Source = 6 + Source_HL2 Source = 7 +) + +// Enum value maps for Source. +var ( + Source_name = map[int32]string{ + 0: "CUSTOM", + 1: "OHLC4", + 2: "CLOSE", + 3: "OPEN", + 4: "HIGH", + 5: "HLC3", + 6: "LOW", + 7: "HL2", + } + Source_value = map[string]int32{ + "CUSTOM": 0, + "OHLC4": 1, + "CLOSE": 2, + "OPEN": 3, + "HIGH": 4, + "HLC3": 5, + "LOW": 6, + "HL2": 7, + } +) + +func (x Source) Enum() *Source { + p := new(Source) + *p = x + return p +} + +func (x Source) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Source) Descriptor() protoreflect.EnumDescriptor { + return file_services_indicators_api_proto_src_misc_proto_enumTypes[0].Descriptor() +} + +func (Source) Type() protoreflect.EnumType { + return &file_services_indicators_api_proto_src_misc_proto_enumTypes[0] +} + +func (x Source) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Source.Descriptor instead. +func (Source) EnumDescriptor() ([]byte, []int) { + return file_services_indicators_api_proto_src_misc_proto_rawDescGZIP(), []int{0} +} + +type Type int32 + +const ( + Type_NOTHING Type = 0 + Type_RSI Type = 1 + Type_STOCHASTIC Type = 2 + Type_SMA Type = 3 + Type_EMA Type = 4 + Type_BOLLINGER_BANDS Type = 5 +) + +// Enum value maps for Type. +var ( + Type_name = map[int32]string{ + 0: "NOTHING", + 1: "RSI", + 2: "STOCHASTIC", + 3: "SMA", + 4: "EMA", + 5: "BOLLINGER_BANDS", + } + Type_value = map[string]int32{ + "NOTHING": 0, + "RSI": 1, + "STOCHASTIC": 2, + "SMA": 3, + "EMA": 4, + "BOLLINGER_BANDS": 5, + } +) + +func (x Type) Enum() *Type { + p := new(Type) + *p = x + return p +} + +func (x Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Type) Descriptor() protoreflect.EnumDescriptor { + return file_services_indicators_api_proto_src_misc_proto_enumTypes[1].Descriptor() +} + +func (Type) Type() protoreflect.EnumType { + return &file_services_indicators_api_proto_src_misc_proto_enumTypes[1] +} + +func (x Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Type.Descriptor instead. +func (Type) EnumDescriptor() ([]byte, []int) { + return file_services_indicators_api_proto_src_misc_proto_rawDescGZIP(), []int{1} +} + +var File_services_indicators_api_proto_src_misc_proto protoreflect.FileDescriptor + +var file_services_indicators_api_proto_src_misc_proto_rawDesc = []byte{ + 0x0a, 0x2c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x64, 0x69, 0x63, + 0x61, 0x74, 0x6f, 0x72, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x73, 0x72, 0x63, 0x2f, 0x6d, 0x69, 0x73, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, + 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x70, 0x69, 0x2a, 0x5a, 0x0a, 0x06, + 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x55, 0x53, 0x54, 0x4f, 0x4d, + 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x4f, 0x48, 0x4c, 0x43, 0x34, 0x10, 0x01, 0x12, 0x09, 0x0a, + 0x05, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x4f, 0x50, 0x45, 0x4e, + 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x49, 0x47, 0x48, 0x10, 0x04, 0x12, 0x08, 0x0a, 0x04, + 0x48, 0x4c, 0x43, 0x33, 0x10, 0x05, 0x12, 0x07, 0x0a, 0x03, 0x4c, 0x4f, 0x57, 0x10, 0x06, 0x12, + 0x07, 0x0a, 0x03, 0x48, 0x4c, 0x32, 0x10, 0x07, 0x2a, 0x53, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x0b, 0x0a, 0x07, 0x4e, 0x4f, 0x54, 0x48, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x07, 0x0a, + 0x03, 0x52, 0x53, 0x49, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x54, 0x4f, 0x43, 0x48, 0x41, + 0x53, 0x54, 0x49, 0x43, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x4d, 0x41, 0x10, 0x03, 0x12, + 0x07, 0x0a, 0x03, 0x45, 0x4d, 0x41, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x42, 0x4f, 0x4c, 0x4c, + 0x49, 0x4e, 0x47, 0x45, 0x52, 0x5f, 0x42, 0x41, 0x4e, 0x44, 0x53, 0x10, 0x05, 0x42, 0x3a, 0x5a, + 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x2d, 0x76, 0x61, + 0x72, 0x6d, 0x61, 0x7a, 0x79, 0x61, 0x72, 0x2f, 0x47, 0x61, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_services_indicators_api_proto_src_misc_proto_rawDescOnce sync.Once + file_services_indicators_api_proto_src_misc_proto_rawDescData = file_services_indicators_api_proto_src_misc_proto_rawDesc +) + +func file_services_indicators_api_proto_src_misc_proto_rawDescGZIP() []byte { + file_services_indicators_api_proto_src_misc_proto_rawDescOnce.Do(func() { + file_services_indicators_api_proto_src_misc_proto_rawDescData = protoimpl.X.CompressGZIP(file_services_indicators_api_proto_src_misc_proto_rawDescData) + }) + return file_services_indicators_api_proto_src_misc_proto_rawDescData +} + +var file_services_indicators_api_proto_src_misc_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_services_indicators_api_proto_src_misc_proto_goTypes = []interface{}{ + (Source)(0), // 0: indicatorApi.Source + (Type)(0), // 1: indicatorApi.Type +} +var file_services_indicators_api_proto_src_misc_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_services_indicators_api_proto_src_misc_proto_init() } +func file_services_indicators_api_proto_src_misc_proto_init() { + if File_services_indicators_api_proto_src_misc_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_services_indicators_api_proto_src_misc_proto_rawDesc, + NumEnums: 2, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_services_indicators_api_proto_src_misc_proto_goTypes, + DependencyIndexes: file_services_indicators_api_proto_src_misc_proto_depIdxs, + EnumInfos: file_services_indicators_api_proto_src_misc_proto_enumTypes, + }.Build() + File_services_indicators_api_proto_src_misc_proto = out.File + file_services_indicators_api_proto_src_misc_proto_rawDesc = nil + file_services_indicators_api_proto_src_misc_proto_goTypes = nil + file_services_indicators_api_proto_src_misc_proto_depIdxs = nil +} diff --git a/services/indicators/api/proto/src/configs.proto b/services/indicators/api/proto/src/configs.proto new file mode 100644 index 0000000..560fbb5 --- /dev/null +++ b/services/indicators/api/proto/src/configs.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; +package indicatorApi; +option go_package = "github.com/h-varmazyar/Gate/services/indicator/api/proto"; +import "services/indicators/api/proto/src/misc.proto"; + +message RsiConfigs{ + // @inject_tag: json:"length" + int32 Length = 1; +} + +message IndicatorConfigs { + oneof configs{ + RsiConfigs rsi = 1; + StochasticConfigs stochastic = 2; + MovingAverageConfigs moving_average = 3; + BollingerBandsConfigs bollinger_bands = 4; + } +} + +message StochasticConfigs{ + // @inject_tag: json:"length" + int32 Length = 1; + // @inject_tag: json:"smooth_k" + int32 SmoothK = 2; + // @inject_tag: json:"smooth_d" + int32 SmoothD = 3; +} + +message MovingAverageConfigs{ + // @inject_tag: json:"length" + int32 Length = 1; + // @inject_tag: json:"source" + Source Source = 2; +} + +message BollingerBandsConfigs{ + // @inject_tag: json:"length" + int32 Length = 1; + // @inject_tag: json:"deviation" + int32 Deviation = 2; + // @inject_tag: json:"source" + Source Source = 3; +} + diff --git a/services/indicators/api/proto/src/indicators.proto b/services/indicators/api/proto/src/indicators.proto new file mode 100644 index 0000000..a387ee2 --- /dev/null +++ b/services/indicators/api/proto/src/indicators.proto @@ -0,0 +1,117 @@ +syntax = "proto3"; +package indicatorApi; +option go_package = "github.com/h-varmazyar/Gate/services/indicator/api/proto"; +import "services/indicators/api/proto/src/configs.proto"; +import "services/indicators/api/proto/src/values.proto"; +import "services/indicators/api/proto/src/misc.proto"; + +service indicatorService{ + rpc Register(IndicatorRegisterReq) returns (Indicator); + rpc Values(IndicatorValuesReq) returns (IndicatorValues); +} + +message IndicatorRegisterReq{ + Type type = 1; + IndicatorConfigs Configs = 2; +} + +message IndicatorValuesReq { + string Id = 1; + uint32 page = 2; + uint32 page_size = 3; +} + +message Indicator { + string Id = 1; + Type type = 2; + IndicatorConfigs Configs = 3; +} + + + +//message indicatorValue{ +// // @inject_tag: json:"value" +// oneof Value{ +// // @inject_tag: json:"bollinger_band,omitempty" +// BollingerBands BollingerBands = 2; +// // @inject_tag: json:"moving_average,omitempty" +// MovingAverage MovingAverage = 3; +// // @inject_tag: json:"stochastic,omitempty" +// Stochastic Stochastic = 4; +// // @inject_tag: json:"rsi,omitempty" +// RSI RSI = 5; +// } +//} +// +//message BollingerBands { +// // @inject_tag: json:"upper_band" +// double UpperBand = 1; +// // @inject_tag: json:"lower_band" +// double LowerBand = 2; +// // @inject_tag: json:"ma" +// double MA = 3; +//} +// +//message MovingAverage { +// // @inject_tag: json:"simple" +// double Simple = 1; +// // @inject_tag: json:"exponential" +// double Exponential = 2; +//} +// +//message Stochastic { +// // @inject_tag: json:"index_k" +// double IndexK = 1; +// // @inject_tag: json:"index_d" +// double IndexD = 2; +//} +// +//message RSI { +// // @inject_tag: json:"rsi" +// double RSI = 1; +//} +// +//message IndicatorReturnReq{ +// // @inject_tag: json:"id" +// string ID = 1; +//} +// +//message RsiConfigs{ +// // @inject_tag: json:"length" +// int32 Length = 1; +//} +// +//message StochasticConfigs{ +// // @inject_tag: json:"length" +// int32 Length = 1; +// // @inject_tag: json:"smooth_k" +// int32 SmoothK = 2; +// // @inject_tag: json:"smooth_d" +// int32 SmoothD = 3; +//} +// +//message MovingAverageConfigs{ +// // @inject_tag: json:"length" +// int32 Length = 1; +// // @inject_tag: json:"source" +// Source Source = 2; +//} +// +//message BollingerBandsConfigs{ +// // @inject_tag: json:"length" +// int32 Length = 1; +// // @inject_tag: json:"deviation" +// int32 Deviation = 2; +// // @inject_tag: json:"source" +// Source Source = 3; +//} +// +//message IndicatorListReq{ +// // @inject_tag: json:"type" +// Indicator.type Type = 1; +//} +// +//message Indicators{ +// // @inject_tag: json:"elements" +// repeated Indicator Elements = 1; +//} diff --git a/services/indicators/api/proto/src/misc.proto b/services/indicators/api/proto/src/misc.proto new file mode 100644 index 0000000..a509b21 --- /dev/null +++ b/services/indicators/api/proto/src/misc.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; +package indicatorApi; +option go_package = "github.com/h-varmazyar/Gate/services/indicator/api/proto"; + +enum Source { + CUSTOM = 0; + OHLC4 = 1; + CLOSE = 2; + OPEN = 3; + HIGH = 4; + HLC3 = 5; + LOW = 6; + HL2 = 7; +} + +enum Type{ + NOTHING = 0; + RSI = 1; + STOCHASTIC = 2; + SMA = 3; + EMA = 4; + BOLLINGER_BANDS = 5; +} \ No newline at end of file diff --git a/services/indicators/api/proto/src/values.proto b/services/indicators/api/proto/src/values.proto new file mode 100644 index 0000000..bbef08f --- /dev/null +++ b/services/indicators/api/proto/src/values.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; +package indicatorApi; +option go_package = "github.com/h-varmazyar/Gate/services/indicator/api/proto"; + +message IndicatorValues{ + repeated IndicatorValue values = 1; +} + +message IndicatorValue{ + int64 time = 1; + oneof Value{ + BollingerBandsValue BollingerBands = 2; + ExponentialMovingAverageValue MovingAverage = 3; + StochasticValue Stochastic = 4; + RSIValue RSI = 5; + } +} + +message BollingerBandsValue { + double UpperBand = 1; + double LowerBand = 2; + double MA = 3; +} + +message ExponentialMovingAverageValue { + double simple = 1; + double exponential = 2; +} + +message StochasticValue { + double index_k = 1; + double index_d = 2; +} + +message RSIValue { + double rsi = 1; +} \ No newline at end of file diff --git a/services/indicators/api/proto/values.pb.go b/services/indicators/api/proto/values.pb.go new file mode 100644 index 0000000..09184aa --- /dev/null +++ b/services/indicators/api/proto/values.pb.go @@ -0,0 +1,599 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.12.4 +// source: services/indicators/api/proto/src/values.proto + +package proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type IndicatorValues struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Values []*IndicatorValue `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` +} + +func (x *IndicatorValues) Reset() { + *x = IndicatorValues{} + if protoimpl.UnsafeEnabled { + mi := &file_services_indicators_api_proto_src_values_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IndicatorValues) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IndicatorValues) ProtoMessage() {} + +func (x *IndicatorValues) ProtoReflect() protoreflect.Message { + mi := &file_services_indicators_api_proto_src_values_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IndicatorValues.ProtoReflect.Descriptor instead. +func (*IndicatorValues) Descriptor() ([]byte, []int) { + return file_services_indicators_api_proto_src_values_proto_rawDescGZIP(), []int{0} +} + +func (x *IndicatorValues) GetValues() []*IndicatorValue { + if x != nil { + return x.Values + } + return nil +} + +type IndicatorValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Time int64 `protobuf:"varint,1,opt,name=time,proto3" json:"time,omitempty"` + // Types that are assignable to Value: + // *IndicatorValue_BollingerBands + // *IndicatorValue_MovingAverage + // *IndicatorValue_Stochastic + // *IndicatorValue_RSI + Value isIndicatorValue_Value `protobuf_oneof:"Value"` +} + +func (x *IndicatorValue) Reset() { + *x = IndicatorValue{} + if protoimpl.UnsafeEnabled { + mi := &file_services_indicators_api_proto_src_values_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IndicatorValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IndicatorValue) ProtoMessage() {} + +func (x *IndicatorValue) ProtoReflect() protoreflect.Message { + mi := &file_services_indicators_api_proto_src_values_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IndicatorValue.ProtoReflect.Descriptor instead. +func (*IndicatorValue) Descriptor() ([]byte, []int) { + return file_services_indicators_api_proto_src_values_proto_rawDescGZIP(), []int{1} +} + +func (x *IndicatorValue) GetTime() int64 { + if x != nil { + return x.Time + } + return 0 +} + +func (m *IndicatorValue) GetValue() isIndicatorValue_Value { + if m != nil { + return m.Value + } + return nil +} + +func (x *IndicatorValue) GetBollingerBands() *BollingerBandsValue { + if x, ok := x.GetValue().(*IndicatorValue_BollingerBands); ok { + return x.BollingerBands + } + return nil +} + +func (x *IndicatorValue) GetMovingAverage() *ExponentialMovingAverageValue { + if x, ok := x.GetValue().(*IndicatorValue_MovingAverage); ok { + return x.MovingAverage + } + return nil +} + +func (x *IndicatorValue) GetStochastic() *StochasticValue { + if x, ok := x.GetValue().(*IndicatorValue_Stochastic); ok { + return x.Stochastic + } + return nil +} + +func (x *IndicatorValue) GetRSI() *RSIValue { + if x, ok := x.GetValue().(*IndicatorValue_RSI); ok { + return x.RSI + } + return nil +} + +type isIndicatorValue_Value interface { + isIndicatorValue_Value() +} + +type IndicatorValue_BollingerBands struct { + BollingerBands *BollingerBandsValue `protobuf:"bytes,2,opt,name=BollingerBands,proto3,oneof"` +} + +type IndicatorValue_MovingAverage struct { + MovingAverage *ExponentialMovingAverageValue `protobuf:"bytes,3,opt,name=MovingAverage,proto3,oneof"` +} + +type IndicatorValue_Stochastic struct { + Stochastic *StochasticValue `protobuf:"bytes,4,opt,name=Stochastic,proto3,oneof"` +} + +type IndicatorValue_RSI struct { + RSI *RSIValue `protobuf:"bytes,5,opt,name=RSI,proto3,oneof"` +} + +func (*IndicatorValue_BollingerBands) isIndicatorValue_Value() {} + +func (*IndicatorValue_MovingAverage) isIndicatorValue_Value() {} + +func (*IndicatorValue_Stochastic) isIndicatorValue_Value() {} + +func (*IndicatorValue_RSI) isIndicatorValue_Value() {} + +type BollingerBandsValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UpperBand float64 `protobuf:"fixed64,1,opt,name=UpperBand,proto3" json:"UpperBand,omitempty"` + LowerBand float64 `protobuf:"fixed64,2,opt,name=LowerBand,proto3" json:"LowerBand,omitempty"` + MA float64 `protobuf:"fixed64,3,opt,name=MA,proto3" json:"MA,omitempty"` +} + +func (x *BollingerBandsValue) Reset() { + *x = BollingerBandsValue{} + if protoimpl.UnsafeEnabled { + mi := &file_services_indicators_api_proto_src_values_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BollingerBandsValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BollingerBandsValue) ProtoMessage() {} + +func (x *BollingerBandsValue) ProtoReflect() protoreflect.Message { + mi := &file_services_indicators_api_proto_src_values_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BollingerBandsValue.ProtoReflect.Descriptor instead. +func (*BollingerBandsValue) Descriptor() ([]byte, []int) { + return file_services_indicators_api_proto_src_values_proto_rawDescGZIP(), []int{2} +} + +func (x *BollingerBandsValue) GetUpperBand() float64 { + if x != nil { + return x.UpperBand + } + return 0 +} + +func (x *BollingerBandsValue) GetLowerBand() float64 { + if x != nil { + return x.LowerBand + } + return 0 +} + +func (x *BollingerBandsValue) GetMA() float64 { + if x != nil { + return x.MA + } + return 0 +} + +type ExponentialMovingAverageValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Simple float64 `protobuf:"fixed64,1,opt,name=simple,proto3" json:"simple,omitempty"` + Exponential float64 `protobuf:"fixed64,2,opt,name=exponential,proto3" json:"exponential,omitempty"` +} + +func (x *ExponentialMovingAverageValue) Reset() { + *x = ExponentialMovingAverageValue{} + if protoimpl.UnsafeEnabled { + mi := &file_services_indicators_api_proto_src_values_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExponentialMovingAverageValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExponentialMovingAverageValue) ProtoMessage() {} + +func (x *ExponentialMovingAverageValue) ProtoReflect() protoreflect.Message { + mi := &file_services_indicators_api_proto_src_values_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExponentialMovingAverageValue.ProtoReflect.Descriptor instead. +func (*ExponentialMovingAverageValue) Descriptor() ([]byte, []int) { + return file_services_indicators_api_proto_src_values_proto_rawDescGZIP(), []int{3} +} + +func (x *ExponentialMovingAverageValue) GetSimple() float64 { + if x != nil { + return x.Simple + } + return 0 +} + +func (x *ExponentialMovingAverageValue) GetExponential() float64 { + if x != nil { + return x.Exponential + } + return 0 +} + +type StochasticValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IndexK float64 `protobuf:"fixed64,1,opt,name=index_k,json=indexK,proto3" json:"index_k,omitempty"` + IndexD float64 `protobuf:"fixed64,2,opt,name=index_d,json=indexD,proto3" json:"index_d,omitempty"` +} + +func (x *StochasticValue) Reset() { + *x = StochasticValue{} + if protoimpl.UnsafeEnabled { + mi := &file_services_indicators_api_proto_src_values_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StochasticValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StochasticValue) ProtoMessage() {} + +func (x *StochasticValue) ProtoReflect() protoreflect.Message { + mi := &file_services_indicators_api_proto_src_values_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StochasticValue.ProtoReflect.Descriptor instead. +func (*StochasticValue) Descriptor() ([]byte, []int) { + return file_services_indicators_api_proto_src_values_proto_rawDescGZIP(), []int{4} +} + +func (x *StochasticValue) GetIndexK() float64 { + if x != nil { + return x.IndexK + } + return 0 +} + +func (x *StochasticValue) GetIndexD() float64 { + if x != nil { + return x.IndexD + } + return 0 +} + +type RSIValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Rsi float64 `protobuf:"fixed64,1,opt,name=rsi,proto3" json:"rsi,omitempty"` +} + +func (x *RSIValue) Reset() { + *x = RSIValue{} + if protoimpl.UnsafeEnabled { + mi := &file_services_indicators_api_proto_src_values_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RSIValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RSIValue) ProtoMessage() {} + +func (x *RSIValue) ProtoReflect() protoreflect.Message { + mi := &file_services_indicators_api_proto_src_values_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RSIValue.ProtoReflect.Descriptor instead. +func (*RSIValue) Descriptor() ([]byte, []int) { + return file_services_indicators_api_proto_src_values_proto_rawDescGZIP(), []int{5} +} + +func (x *RSIValue) GetRsi() float64 { + if x != nil { + return x.Rsi + } + return 0 +} + +var File_services_indicators_api_proto_src_values_proto protoreflect.FileDescriptor + +var file_services_indicators_api_proto_src_values_proto_rawDesc = []byte{ + 0x0a, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x64, 0x69, 0x63, + 0x61, 0x74, 0x6f, 0x72, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x73, 0x72, 0x63, 0x2f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x0c, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x70, 0x69, 0x22, 0x47, + 0x0a, 0x0f, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x12, 0x34, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1c, 0x2e, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x70, 0x69, + 0x2e, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0xbc, 0x02, 0x0a, 0x0e, 0x49, 0x6e, 0x64, 0x69, + 0x63, 0x61, 0x74, 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x4b, + 0x0a, 0x0e, 0x42, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, + 0x6f, 0x72, 0x41, 0x70, 0x69, 0x2e, 0x42, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x42, + 0x61, 0x6e, 0x64, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x0e, 0x42, 0x6f, 0x6c, + 0x6c, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, 0x73, 0x12, 0x53, 0x0a, 0x0d, 0x4d, + 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x41, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x70, + 0x69, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4d, 0x6f, 0x76, + 0x69, 0x6e, 0x67, 0x41, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, + 0x00, 0x52, 0x0d, 0x4d, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x41, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, + 0x12, 0x3f, 0x0a, 0x0a, 0x53, 0x74, 0x6f, 0x63, 0x68, 0x61, 0x73, 0x74, 0x69, 0x63, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, + 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x68, 0x61, 0x73, 0x74, 0x69, 0x63, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x0a, 0x53, 0x74, 0x6f, 0x63, 0x68, 0x61, 0x73, 0x74, 0x69, + 0x63, 0x12, 0x2a, 0x0a, 0x03, 0x52, 0x53, 0x49, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, + 0x2e, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x70, 0x69, 0x2e, 0x52, 0x53, + 0x49, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x03, 0x52, 0x53, 0x49, 0x42, 0x07, 0x0a, + 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x61, 0x0a, 0x13, 0x42, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, + 0x67, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, + 0x09, 0x55, 0x70, 0x70, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, + 0x52, 0x09, 0x55, 0x70, 0x70, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x4c, + 0x6f, 0x77, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, + 0x4c, 0x6f, 0x77, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x4d, 0x41, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x02, 0x4d, 0x41, 0x22, 0x59, 0x0a, 0x1d, 0x45, 0x78, 0x70, + 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4d, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x41, 0x76, + 0x65, 0x72, 0x61, 0x67, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x69, + 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x73, 0x69, 0x6d, 0x70, + 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x65, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, + 0x74, 0x69, 0x61, 0x6c, 0x22, 0x43, 0x0a, 0x0f, 0x53, 0x74, 0x6f, 0x63, 0x68, 0x61, 0x73, 0x74, + 0x69, 0x63, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x6e, 0x64, 0x65, 0x78, + 0x5f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x4b, + 0x12, 0x17, 0x0a, 0x07, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x01, 0x52, 0x06, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x44, 0x22, 0x1c, 0x0a, 0x08, 0x52, 0x53, 0x49, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x73, 0x69, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x01, 0x52, 0x03, 0x72, 0x73, 0x69, 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x2d, 0x76, 0x61, 0x72, 0x6d, 0x61, 0x7a, 0x79, 0x61, + 0x72, 0x2f, 0x47, 0x61, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, + 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_services_indicators_api_proto_src_values_proto_rawDescOnce sync.Once + file_services_indicators_api_proto_src_values_proto_rawDescData = file_services_indicators_api_proto_src_values_proto_rawDesc +) + +func file_services_indicators_api_proto_src_values_proto_rawDescGZIP() []byte { + file_services_indicators_api_proto_src_values_proto_rawDescOnce.Do(func() { + file_services_indicators_api_proto_src_values_proto_rawDescData = protoimpl.X.CompressGZIP(file_services_indicators_api_proto_src_values_proto_rawDescData) + }) + return file_services_indicators_api_proto_src_values_proto_rawDescData +} + +var file_services_indicators_api_proto_src_values_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_services_indicators_api_proto_src_values_proto_goTypes = []interface{}{ + (*IndicatorValues)(nil), // 0: indicatorApi.IndicatorValues + (*IndicatorValue)(nil), // 1: indicatorApi.IndicatorValue + (*BollingerBandsValue)(nil), // 2: indicatorApi.BollingerBandsValue + (*ExponentialMovingAverageValue)(nil), // 3: indicatorApi.ExponentialMovingAverageValue + (*StochasticValue)(nil), // 4: indicatorApi.StochasticValue + (*RSIValue)(nil), // 5: indicatorApi.RSIValue +} +var file_services_indicators_api_proto_src_values_proto_depIdxs = []int32{ + 1, // 0: indicatorApi.IndicatorValues.values:type_name -> indicatorApi.IndicatorValue + 2, // 1: indicatorApi.IndicatorValue.BollingerBands:type_name -> indicatorApi.BollingerBandsValue + 3, // 2: indicatorApi.IndicatorValue.MovingAverage:type_name -> indicatorApi.ExponentialMovingAverageValue + 4, // 3: indicatorApi.IndicatorValue.Stochastic:type_name -> indicatorApi.StochasticValue + 5, // 4: indicatorApi.IndicatorValue.RSI:type_name -> indicatorApi.RSIValue + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_services_indicators_api_proto_src_values_proto_init() } +func file_services_indicators_api_proto_src_values_proto_init() { + if File_services_indicators_api_proto_src_values_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_services_indicators_api_proto_src_values_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IndicatorValues); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_indicators_api_proto_src_values_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IndicatorValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_indicators_api_proto_src_values_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BollingerBandsValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_indicators_api_proto_src_values_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExponentialMovingAverageValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_indicators_api_proto_src_values_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StochasticValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_indicators_api_proto_src_values_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RSIValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_services_indicators_api_proto_src_values_proto_msgTypes[1].OneofWrappers = []interface{}{ + (*IndicatorValue_BollingerBands)(nil), + (*IndicatorValue_MovingAverage)(nil), + (*IndicatorValue_Stochastic)(nil), + (*IndicatorValue_RSI)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_services_indicators_api_proto_src_values_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_services_indicators_api_proto_src_values_proto_goTypes, + DependencyIndexes: file_services_indicators_api_proto_src_values_proto_depIdxs, + MessageInfos: file_services_indicators_api_proto_src_values_proto_msgTypes, + }.Build() + File_services_indicators_api_proto_src_values_proto = out.File + file_services_indicators_api_proto_src_values_proto_rawDesc = nil + file_services_indicators_api_proto_src_values_proto_goTypes = nil + file_services_indicators_api_proto_src_values_proto_depIdxs = nil +} diff --git a/services/indicators/cmd/configs.go b/services/indicators/cmd/configs.go new file mode 100644 index 0000000..694e4e2 --- /dev/null +++ b/services/indicators/cmd/configs.go @@ -0,0 +1,14 @@ +package main + +import ( + "github.com/h-varmazyar/Gate/pkg/gormext" + "github.com/h-varmazyar/Gate/services/indicators/internal" +) + +type Configs struct { + ServiceName string `mapstructure:"service_name"` + Version string `mapstructure:"version"` + GRPCPort uint16 `mapstructure:"grpc_port"` + AppConfigs internal.Configs `mapstructure:"app_configs"` + DB gormext.Configs `mapstructure:"db"` +} diff --git a/services/indicators/cmd/main.go b/services/indicators/cmd/main.go new file mode 100644 index 0000000..fd716bb --- /dev/null +++ b/services/indicators/cmd/main.go @@ -0,0 +1,98 @@ +package main + +import ( + "bytes" + "context" + "flag" + "github.com/h-varmazyar/Gate/pkg/gormext" + "github.com/h-varmazyar/Gate/pkg/service" + "github.com/h-varmazyar/Gate/services/indicators/configs" + "github.com/h-varmazyar/Gate/services/indicators/internal" + "github.com/h-varmazyar/Gate/services/indicators/pkg/db" + log "github.com/sirupsen/logrus" + "github.com/spf13/viper" + "google.golang.org/grpc" + "net" +) + +func main() { + ctx := context.Background() + logger := log.New() + + defaultConf := flag.Bool("default-configs", false, "run program with default config") + flag.Parse() + + conf, err := loadConfigs(*defaultConf) + if err != nil { + log.Panic("failed to read configs") + } + + logger.Infof("starting %v(%v)", conf.ServiceName, conf.Version) + + dbInstance, err := loadDB(ctx, conf.DB) + if err != nil { + logger.Panicf("failed to initiate databases with error %v", err) + } + initializeAndRegisterApps(ctx, logger, dbInstance, conf) +} + +func loadConfigs(defaultConfig bool) (*Configs, error) { + log.Infof("reding configs...") + + if defaultConfig { + viper.SetConfigType("yaml") + log.Infof("reading deafult configs") + err := viper.ReadConfig(bytes.NewBuffer(configs.DefaultConfig)) + if err != nil { + log.WithError(err).Error("read from default configs failed") + return nil, err + } + } else { + viper.AutomaticEnv() + + if err := viper.ReadInConfig(); err != nil { + log.Warnf("failed to read from env: %v", err) + viper.AddConfigPath("./configs") //path for docker compose configs + viper.AddConfigPath("../configs") //path for local configs + viper.SetConfigName("config") + viper.SetConfigType("yaml") + if err = viper.ReadInConfig(); err != nil { + log.Warnf("failed to read from yaml: %v", err) + localErr := viper.ReadConfig(bytes.NewBuffer(configs.DefaultConfig)) + if localErr != nil { + log.WithError(localErr).Error("read from default configs failed") + return nil, localErr + } + } + } + } + + conf := new(Configs) + if err := viper.Unmarshal(conf); err != nil { + log.Errorf("failed unmarshal") + return nil, err + } + + return conf, nil +} + +func loadDB(ctx context.Context, configs gormext.Configs) (*db.DB, error) { + return db.NewDatabase(ctx, configs) +} + +func initializeAndRegisterApps(ctx context.Context, logger *log.Logger, dbInstance *db.DB, configs *Configs) { + walletDependencies := &internal.AppDependencies{} + + app, err := internal.NewApp(ctx, logger, configs.AppConfigs, walletDependencies) + if err != nil { + logger.WithError(err).Panicf("failed to initiate wallets app") + } + + service.Serve(configs.GRPCPort, func(lst net.Listener) error { + server := grpc.NewServer() + app.Service.RegisterServer(server) + return server.Serve(lst) + }) + + service.Start(configs.ServiceName, configs.Version) +} diff --git a/services/indicators/configs/deafult.go b/services/indicators/configs/deafult.go new file mode 100644 index 0000000..1bf06bf --- /dev/null +++ b/services/indicators/configs/deafult.go @@ -0,0 +1,5 @@ +package configs + +var ( + DefaultConfig = []byte(``) +) diff --git a/services/indicators/internal/app.go b/services/indicators/internal/app.go new file mode 100644 index 0000000..35f36b7 --- /dev/null +++ b/services/indicators/internal/app.go @@ -0,0 +1,20 @@ +package internal + +import ( + "context" + "github.com/h-varmazyar/Gate/services/indicators/internal/service" + log "github.com/sirupsen/logrus" +) + +type App struct { + Service *service.Service +} + +type AppDependencies struct { +} + +func NewApp(ctx context.Context, logger *log.Logger, configs Configs, dependencies *AppDependencies) (*App, error) { + return &App{ + Service: service.NewService(ctx, logger, configs.ServiceConfigs), + }, nil +} diff --git a/services/indicators/internal/configs.go b/services/indicators/internal/configs.go new file mode 100644 index 0000000..9902b2e --- /dev/null +++ b/services/indicators/internal/configs.go @@ -0,0 +1,7 @@ +package internal + +import "github.com/h-varmazyar/Gate/services/indicators/internal/service" + +type Configs struct { + ServiceConfigs service.Configs `mapstructure:"service_configs"` +} diff --git a/services/indicators/internal/repository/repository.go b/services/indicators/internal/repository/repository.go new file mode 100644 index 0000000..b48021c --- /dev/null +++ b/services/indicators/internal/repository/repository.go @@ -0,0 +1,10 @@ +package repository + +import ( + "context" + "github.com/h-varmazyar/Gate/services/indicators/pkg/entity" +) + +type Repository interface { + Create(ctx context.Context) (*entity.Indicator, error) +} diff --git a/services/indicators/internal/service/configs.go b/services/indicators/internal/service/configs.go new file mode 100644 index 0000000..7a2cfd2 --- /dev/null +++ b/services/indicators/internal/service/configs.go @@ -0,0 +1,4 @@ +package service + +type Configs struct { +} diff --git a/services/indicators/internal/service/service.go b/services/indicators/internal/service/service.go new file mode 100644 index 0000000..a85f1ed --- /dev/null +++ b/services/indicators/internal/service/service.go @@ -0,0 +1,38 @@ +package service + +import ( + "context" + indicatorsAPI "github.com/h-varmazyar/Gate/services/indicators/api/proto" + log "github.com/sirupsen/logrus" + "google.golang.org/grpc" +) + +type Service struct { + log *log.Logger + configs Configs +} + +var ( + grpcService *Service +) + +func NewService(_ context.Context, logger *log.Logger, configs Configs) *Service { + if grpcService == nil { + grpcService = new(Service) + grpcService.log = logger + grpcService.configs = configs + } + return grpcService +} + +func (s Service) RegisterServer(server *grpc.Server) { + indicatorsAPI.RegisterIndicatorServiceServer(server, s) +} + +func (s Service) Register(ctx context.Context, req *indicatorsAPI.IndicatorRegisterReq) (*indicatorsAPI.Indicator, error) { + +} + +func (s Service) Values(ctx context.Context, req *indicatorsAPI.IndicatorValuesReq) (*indicatorsAPI.IndicatorValues, error) { + +} diff --git a/services/indicators/internal/workers/calculator.go b/services/indicators/internal/workers/calculator.go new file mode 100644 index 0000000..df38d31 --- /dev/null +++ b/services/indicators/internal/workers/calculator.go @@ -0,0 +1,96 @@ +package workers + +import ( + "context" + "fmt" + "github.com/h-varmazyar/Gate/pkg/grpcext" + chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" + log "github.com/sirupsen/logrus" + "strings" + "time" +) + +var ( + indicatorMapKeyPattern = "%v*%v" +) + +type Indicator interface { + Calculate(ctx context.Context, candles []*chipmunkApi.Candle) + CandleCountNeedsForCalculation(ctx context.Context) int32 + GetMarket(ctx context.Context) *chipmunkApi.Market + GetResolution(ctx context.Context) *chipmunkApi.Resolution +} + +type IndicatorCalculator struct { + candleService chipmunkApi.CandleServiceClient + indicatorsMap map[string][]Indicator //key is the combination of market and resolution id + configs Configs + log *log.Logger +} + +func NewIndicatorCalculatorWorker(_ context.Context, log *log.Logger, configs Configs) *IndicatorCalculator { + chipmunkConn := grpcext.NewConnection(configs.ChipmunkAddress) + return &IndicatorCalculator{ + candleService: chipmunkApi.NewCandleServiceClient(chipmunkConn), + indicatorsMap: make(map[string][]Indicator), + configs: configs, + log: log, + } +} + +func (w IndicatorCalculator) Start(ctx context.Context, indicators []Indicator) { + for _, indicator := range indicators { + w.addIndicator(ctx, indicator) + } + + for key, indicators := range w.indicatorsMap { + ids := strings.Split(key, "*") + w.calculateMarketIndicators(indicators, ids[0], ids[1]) + } +} + +func (w IndicatorCalculator) addIndicator(ctx context.Context, indicator Indicator) { + key := fmt.Sprintf(indicatorMapKeyPattern, indicator.GetMarket(ctx).ID, indicator.GetResolution(ctx).ID) + if indicators, ok := w.indicatorsMap[key]; ok { + indicators = append(indicators, indicator) + } else { + w.indicatorsMap[key] = make([]Indicator, 0) + } +} + +func (w IndicatorCalculator) calculateMarketIndicators(indicators []Indicator, marketId, resolutionId string) { + candleFetchCount := int32(2) + candleCountCtx := context.Background() + for _, indicator := range indicators { + if count := indicator.CandleCountNeedsForCalculation(candleCountCtx); count > candleFetchCount { + candleFetchCount = count + } + } + candleFetchReq := &chipmunkApi.CandleListReq{ + ResolutionID: resolutionId, + MarketID: marketId, + Count: candleFetchCount, + } + ticker := time.NewTicker(w.configs.CalculatorInterval) + for { + select { + case <-ticker.C: + start := time.Now() + ctx, fn := context.WithTimeout(context.Background(), w.configs.CalculatorInterval) + + candles, err := w.candleService.List(ctx, candleFetchReq) + if err != nil { + continue + } + + for _, indicator := range indicators { + indicator.Calculate(ctx, candles.Elements) + } + + if diff := time.Now().Sub(start); diff < w.configs.CalculatorInterval { + time.Sleep(w.configs.CalculatorInterval - diff) + } + fn() + } + } +} diff --git a/services/indicators/internal/workers/configs.go b/services/indicators/internal/workers/configs.go new file mode 100644 index 0000000..c5fa77b --- /dev/null +++ b/services/indicators/internal/workers/configs.go @@ -0,0 +1,8 @@ +package workers + +import "time" + +type Configs struct { + ChipmunkAddress string + CalculatorInterval time.Duration +} diff --git a/services/indicators/pkg/calculator/rsi.go b/services/indicators/pkg/calculator/rsi.go new file mode 100644 index 0000000..f89c75f --- /dev/null +++ b/services/indicators/pkg/calculator/rsi.go @@ -0,0 +1 @@ +package calculator diff --git a/services/indicators/pkg/calculator/sma.go b/services/indicators/pkg/calculator/sma.go new file mode 100644 index 0000000..6473fcb --- /dev/null +++ b/services/indicators/pkg/calculator/sma.go @@ -0,0 +1,228 @@ +package calculator + +import ( + "github.com/google/uuid" + chipmunkAPI "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" + indicatorsAPI "github.com/h-varmazyar/Gate/services/indicators/api/proto" + "time" +) + +type SMAValue struct { + Value float64 + TimeFrame time.Time +} + +type SMA struct { + id uuid.UUID + values []SMAValue + Period int + Source indicatorsAPI.Source +} + +func NewMovingAverage(id uuid.UUID, period int, source indicatorsAPI.Source) (*SMA, error) { + return &SMA{ + id: id, + values: make([]SMAValue, 0), + Period: period, + Source: source, + }, nil +} + +func (conf SMA) GetType() indicatorsAPI.Type { + return indicatorsAPI.Type_SMA +} + +func (conf SMA) GetLength() int { + return len(conf.values) +} + +func (conf SMA) Values(from, to int) []SMAValue { + if len(conf.values) < from { + return nil + } + if to > len(conf.values) { + return nil + } + + return conf.values[from:to] +} + +func (conf SMA) Calculate(candles []*chipmunkAPI.Candle) { + calculatorPeriod := float64(conf.Period) + for _, candle := range candles { + value := SMAValue{ + Value: 0, + TimeFrame: time.Unix(candle.Time, 0), + } + last := len(conf.values) - 1 + if last >= 0 { + value.Value = conf.values[last].Value + } + if len(conf.values) > conf.Period { + value.Value -= conf.values[last+1-conf.Period].Value + } + + switch conf.Source { + case indicatorsAPI.Source_CLOSE: + value.Value += candle.Close / calculatorPeriod + case indicatorsAPI.Source_OPEN: + value.Value += candle.Open / calculatorPeriod + case indicatorsAPI.Source_HIGH: + value.Value += candle.High / calculatorPeriod + case indicatorsAPI.Source_LOW: + value.Value += candle.Low / calculatorPeriod + case indicatorsAPI.Source_HL2: + value.Value += (candle.High + candle.Low) / (2 * calculatorPeriod) + case indicatorsAPI.Source_HLC3: + value.Value += (candle.High + candle.Low + candle.Close) / (3 * calculatorPeriod) + case indicatorsAPI.Source_OHLC4: + value.Value += (candle.Open + candle.Close + candle.High + candle.Low) / (4 * calculatorPeriod) + } + conf.values = append(conf.values, value) + } +} + +// +//func (conf SMA) sma(candles []*chipmunkAPI.Candle) ([]float64, error) { +// //todo: return value must be delete +// response := make([]float64, len(candles)) +// if err := conf.validateMA(len(candles)); err != nil { +// return nil, err +// } +// for i := conf.Length - 1; i < len(candles); i++ { +// sum := float64(0) +// for _, innerCandle := range candles[i-conf.Length+1 : i+1] { +// switch conf.Source { +// case chipmunkApi.Source_Close: +// sum += innerCandle.Close +// case chipmunkApi.Source_Open: +// sum += innerCandle.Open +// case chipmunkApi.Source_High: +// sum += innerCandle.High +// case chipmunkApi.Source_Low: +// sum += innerCandle.Low +// case chipmunkApi.Source_HL2: +// sum += (innerCandle.High + innerCandle.Low) / 2 +// case chipmunkApi.Source_HLC3: +// sum += (innerCandle.High + innerCandle.Low + innerCandle.Close) / 3 +// case chipmunkApi.Source_OHLC4: +// sum += (innerCandle.Open + innerCandle.Close + innerCandle.High + innerCandle.Low) / 4 +// } +// } +// if candles[i].MovingAverages[conf.id] == nil { +// candles[i].MovingAverages[conf.id] = new(entity.MovingAverageValue) +// } +// candles[i].MovingAverages[conf.id].Simple = sum / float64(conf.Length) +// response[i] = sum / float64(conf.Length) +// } +// return response, nil +//} +// +////func (conf *movingAverage) updateSMA(rateLimiters []*entity.Candle) float64 { +//// smaConf := movingAverage{ +//// id: uuid.New(), +//// MovingAverageConfigs: conf.MovingAverageConfigs, +//// } +//// if sma, err := smaConf.sma(rateLimiters); err != nil { +//// return float64(0) +//// } else { +//// return sma[len(rateLimiters)-1] +//// } +////} +// +//func (conf SMA) Calculate(candles []*chipmunkApi.Candle) error { +// //values := make([]*entity.MovingAverageValue, 0) +// //var sma []float64 +// var err error +// for i := 0; i < len(candles); i++ { +// if candles[i].MovingAverages[conf.id] == nil { +// candles[i].MovingAverages[conf.id] = new(entity.MovingAverageValue) +// } +// } +// //if sma, err = conf.sma(rateLimiters, conf.id); err != nil { +// if _, err = conf.sma(candles); err != nil { +// log.WithError(err).Errorf("failed to calculate sma for moving average %v", conf.id) +// return err +// } +// //for _, value := range sma { +// // values = append(values, &entity.MovingAverageValue{ +// // Simple: value, +// // }) +// //} +// candles[conf.Length-1].MovingAverages[conf.id].Exponential = candles[conf.Length-1].MovingAverages[conf.id].Simple +// +// for i := conf.Length; i < len(candles); i++ { +// conf.calculateEMA(candles[i], candles[i-1]) +// } +// +// //for i := 0; i < len(rateLimiters); i++ { +// // rateLimiters[i].MovingAverages[conf.id] = &entity.MovingAverageValue{ +// // Simple: values[i].Simple, +// // Exponential: values[i].Exponential, +// // } +// //} +// return nil +//} +// +//func (conf *movingAverage) Update(candles []*entity.Candle) { +// if len(candles) == 0 { +// return +// } +// first := candles[0] +// start := buffer.CandleBuffer.Before(first.MarketID.String(), first.ResolutionID.String(), first.Time, conf.Length-1) +// if len(start) == 0 { +// return +// } +// +// internalCandles := append(start, candles...) +// +// _, err := conf.sma(internalCandles) +// if err != nil { +// log.WithError(err).Errorf("failed to calculate sma") +// return +// } +// +// for i := conf.Length - 1; i < len(internalCandles); i++ { +// conf.calculateEMA(candles[i-1], candles[i]) +// } +//} +// +//func (conf *movingAverage) calculateEMA(candle1, candle2 *entity.Candle) { +// price := float64(0) +// switch conf.Source { +// case chipmunkApi.Source_Close: +// price = candle2.Close +// case chipmunkApi.Source_Open: +// price = candle2.Open +// case chipmunkApi.Source_High: +// price = candle2.High +// case chipmunkApi.Source_Low: +// price = candle2.Low +// case chipmunkApi.Source_HL2: +// price = (candle2.High + candle2.Low) / 2 +// case chipmunkApi.Source_HLC3: +// price = (candle2.High + candle2.Low + candle2.Close) / 3 +// case chipmunkApi.Source_OHLC4: +// price = (candle2.Open + candle2.High + candle2.Low + candle2.Close) / 4 +// } +// candle2.MovingAverages[conf.id].Exponential = price*conf.factor + candle1.MovingAverages[conf.id].Exponential*(1-conf.factor) +//} +// +//func (conf *movingAverage) validateMA(length int) error { +// if length < conf.Length { +// return errors.New(fmt.Sprintf("rateLimiters length must be grater or equal than %d", conf.Length)) +// } +// switch conf.Source { +// case chipmunkApi.Source_Close, +// chipmunkApi.Source_Open, +// chipmunkApi.Source_High, +// chipmunkApi.Source_Low, +// chipmunkApi.Source_HL2, +// chipmunkApi.Source_HLC3, +// chipmunkApi.Source_OHLC4, +// chipmunkApi.Source_Custom: +// return nil +// default: +// return errors.New(fmt.Sprintf("moving average source not valid: %s", conf.Source)) +// } +//} diff --git a/services/indicators/pkg/calculator/sma_test.go b/services/indicators/pkg/calculator/sma_test.go new file mode 100644 index 0000000..4c06492 --- /dev/null +++ b/services/indicators/pkg/calculator/sma_test.go @@ -0,0 +1,76 @@ +package calculator + +import ( + chipmunkAPI "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" + indicatorsAPI "github.com/h-varmazyar/Gate/services/indicators/api/proto" + "testing" +) + +func TestCalculate(t *testing.T) { + calculate := func(t testing.TB, conf SMA, candles []*chipmunkAPI.Candle, want []float64) { + t.Helper() + conf.Calculate(candles) + + if len(candles) != len(want) { + t.Errorf("value and want length mismatch (values(%v) != want(%v))", len(candles), len(want)) + } + + values := conf.Values(0, len(candles)) + + for i, value := range values { + if value.Value != want[i] { + t.Errorf("want and value mismatch(%v) - want %v but got %v", i, want[i], value.Value) + } + } + } + + t.Run("calculating", func(t *testing.T) { + candles := []*chipmunkAPI.Candle{ + {Close: 7191, Time: 1704902000}, + {Close: 6993, Time: 1704903000}, + {Close: 6623, Time: 1704904000}, + {Close: 6356, Time: 1704905000}, + {Close: 5555, Time: 1704906000}, + {Close: 5473, Time: 1704907000}, + {Close: 5425, Time: 1704908000}, + {Close: 5568, Time: 1704909000}, + {Close: 5077, Time: 1704910000}, + {Close: 5130, Time: 1704911000}, + {Close: 5509, Time: 1704912000}, + {Close: 5426, Time: 1704913000}, + {Close: 5897, Time: 1704914000}, + {Close: 6224, Time: 1704915000}, + {Close: 7169, Time: 1704916000}, + {Close: 6795, Time: 1704917000}, + {Close: 7295, Time: 1704918000}, + {Close: 7462, Time: 1704919000}, + } + + results := []float64{ + 719, + 1418, + 2080, + 2716, + 3271, + 3819, + 4361, + 4918, + 5426, + 5939, + 5896, + 5849, + 5854, + 5891, + 6019, + 6096, + 6216, + 6341, + } + + conf := SMA{ + Period: 10, + Source: indicatorsAPI.Source_CLOSE, + } + calculate(t, conf, candles, results) + }) +} diff --git a/services/indicators/pkg/db/db.go b/services/indicators/pkg/db/db.go new file mode 100644 index 0000000..eb9e48c --- /dev/null +++ b/services/indicators/pkg/db/db.go @@ -0,0 +1,53 @@ +package db + +import ( + "context" + "github.com/h-varmazyar/Gate/pkg/gormext" + log "github.com/sirupsen/logrus" + "gorm.io/gorm" +) + +type DB struct { + PostgresDB *gorm.DB +} + +func NewDatabase(ctx context.Context, configs gormext.Configs) (*DB, error) { + db := new(DB) + if configs.DbType == gormext.PostgreSQL { + postgres, err := newPostgres(ctx, configs) + if err != nil { + log.WithError(err).Error("failed to create new postgres") + return nil, err + } + db.PostgresDB = postgres + + err = createMigrateTable(ctx, db) + if err != nil { + return nil, err + } + } + + return db, nil +} + +func newPostgres(_ context.Context, configs gormext.Configs) (*gorm.DB, error) { + db, err := gormext.Open(configs) + if err != nil { + log.WithError(err).Error("failed to open database") + return nil, err + } + + if err = db.Transaction(func(tx *gorm.DB) error { + if err = gormext.EnableExtensions(tx, + gormext.UUIDExtension, + ); err != nil { + return err + } + return nil + }); err != nil { + log.WithError(err).Error("failed to add extensions to database") + return nil, err + } + + return db, nil +} diff --git a/services/indicators/pkg/db/indicator.go b/services/indicators/pkg/db/indicator.go new file mode 100644 index 0000000..5700ba2 --- /dev/null +++ b/services/indicators/pkg/db/indicator.go @@ -0,0 +1,15 @@ +package db + +import ( + "context" + "github.com/h-varmazyar/Gate/services/indicators/pkg/entity" + "gorm.io/gorm" +) + +type Indicators struct { + db *gorm.DB +} + +func (r Indicators) Create(ctx context.Context) (*entity.Indicator, error) { + return nil, nil +} diff --git a/services/indicators/pkg/db/migrations.go b/services/indicators/pkg/db/migrations.go new file mode 100644 index 0000000..05dd358 --- /dev/null +++ b/services/indicators/pkg/db/migrations.go @@ -0,0 +1,23 @@ +package db + +import ( + "context" + "gorm.io/gorm" +) + +type Migration struct { + gorm.Model + TableName string + Tag string + Description string +} + +const MigrationTable = "migrations" + +func createMigrateTable(_ context.Context, db *DB) error { + err := db.PostgresDB.AutoMigrate(new(Migration)) + if err != nil { + return err + } + return nil +} diff --git a/services/indicators/pkg/entity/indicator.go b/services/indicators/pkg/entity/indicator.go new file mode 100644 index 0000000..6a5c4f6 --- /dev/null +++ b/services/indicators/pkg/entity/indicator.go @@ -0,0 +1,7 @@ +package entity + +import "gorm.io/gorm" + +type Indicator struct { + gorm.Model +} diff --git a/services/telegramBot/cmd/main.go b/services/telegramBot/cmd/main.go index 29a0d81..c83981d 100644 --- a/services/telegramBot/cmd/main.go +++ b/services/telegramBot/cmd/main.go @@ -5,7 +5,9 @@ import ( "github.com/h-varmazyar/Gate/pkg/service" "github.com/h-varmazyar/Gate/services/telegramBot/configs" "github.com/h-varmazyar/Gate/services/telegramBot/internal/app" + "github.com/h-varmazyar/Gate/services/telegramBot/internal/app/handlers" "github.com/h-varmazyar/Gate/services/telegramBot/internal/pkg/repository" + "github.com/h-varmazyar/Gate/services/telegramBot/internal/pkg/tgBotApi" log "github.com/sirupsen/logrus" "github.com/spf13/viper" "google.golang.org/grpc" @@ -24,6 +26,13 @@ func main() { repository.InitializingDB(conf.DB) + logger.Infof("conf:%v", conf.ServiceConfigs.BotConfigs.Token) + + handler := handlers.NewInstance(conf.ServiceConfigs.HandlerConfigs) + if err := tgBotApi.Run(handler, conf.ServiceConfigs.BotConfigs); err != nil { + panic(err) + } + service.Serve(conf.GrpcPort, func(lst net.Listener) error { server := grpc.NewServer() app.NewService(conf.ServiceConfigs).RegisterServer(server) @@ -34,7 +43,7 @@ func main() { } func loadConfigs() (*Configs, error) { - log.Infof("reding configs...") + log.Infof("reading configs...") viper.AutomaticEnv() if err := viper.ReadInConfig(); err != nil { diff --git a/services/telegramBot/internal/pkg/tgBotApi/bot.go b/services/telegramBot/internal/pkg/tgBotApi/bot.go index da4da0c..58c6a9e 100644 --- a/services/telegramBot/internal/pkg/tgBotApi/bot.go +++ b/services/telegramBot/internal/pkg/tgBotApi/bot.go @@ -33,7 +33,7 @@ func Run(customHandlers Handlers, configs *Configs) error { botConfigs = configs - bot, err = tgbotapi.NewBotAPI(botConfigs.BotToken) + bot, err = tgbotapi.NewBotAPI(botConfigs.Token) if err != nil { log.WithError(err).Error("failed to create new bot") return err @@ -82,6 +82,7 @@ func IsRunning() bool { func handleUpdate(update tgbotapi.Update) { ctx, fn := context.WithTimeout(context.Background(), time.Minute) defer func() { + fn() if r := recover(); r != nil { log.WithError(errors.New("an error thrown on handle update")).Error(r) } @@ -117,7 +118,6 @@ func handleUpdate(update tgbotapi.Update) { log.WithError(err).Error("message handling error") } } - fn() } //func SendMessage(ctx context.Context, chatId int64, message *Chattable, replyId int, keyboard *Keyboard) (tgbotapi.Message, error) { diff --git a/services/telegramBot/internal/pkg/tgBotApi/configs.go b/services/telegramBot/internal/pkg/tgBotApi/configs.go index 484b0af..75460e4 100644 --- a/services/telegramBot/internal/pkg/tgBotApi/configs.go +++ b/services/telegramBot/internal/pkg/tgBotApi/configs.go @@ -1,6 +1,6 @@ package tgBotApi type Configs struct { - BotToken string `yaml:"bot_token"` - DebugMode bool `yaml:"debug_mode"` + Token string `mapstructure:"token"` + DebugMode bool `mapstructure:"debug_mode"` }