diff options
author | 2024-08-11 13:13:10 -0700 | |
---|---|---|
committer | 2024-08-11 13:13:10 -0700 | |
commit | 29c6040a51616e9e4cf6c70ee16391b2a3b238c9 (patch) | |
tree | 049140ef28899831b633b8323a3f43d6240d6c33 /api/proto | |
parent | 7d1d986d3a0a1ad19d3ed969b31064627e79d653 (diff) | |
parent | 0a5cc39b5223e4301bc67e1e1b4bcd1f23574b46 (diff) | |
download | ibd-trader-29c6040a51616e9e4cf6c70ee16391b2a3b238c9.tar.gz ibd-trader-29c6040a51616e9e4cf6c70ee16391b2a3b238c9.tar.zst ibd-trader-29c6040a51616e9e4cf6c70ee16391b2a3b238c9.zip |
Merge remote-tracking branch 'api/main'
Diffstat (limited to 'api/proto')
-rw-r--r-- | api/proto/idb/stock/v1/stock.proto | 136 | ||||
-rw-r--r-- | api/proto/idb/user/v1/user.proto | 67 |
2 files changed, 203 insertions, 0 deletions
diff --git a/api/proto/idb/stock/v1/stock.proto b/api/proto/idb/stock/v1/stock.proto new file mode 100644 index 0000000..e4e32ba --- /dev/null +++ b/api/proto/idb/stock/v1/stock.proto @@ -0,0 +1,136 @@ +syntax = "proto3"; + +package idb.stock.v1; + +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/money.proto"; + +// Stock represents a stock. +message Stock { + // The ticker symbol of the stock (e.g. "AAPL"). + string symbol = 1; + // The name of the stock (e.g. "Apple Inc."). + string name = 2; + // The URL to the IBD page for the stock. + optional string ibd_url = 3; + // The most recent ratings for the stock. + StockRatings ratings = 4; +} + +// StockListType represents the name of a stock list. +enum StockListType { + // Unspecified stock list type. + STOCK_LIST_TYPE_UNSPECIFIED = 0; + // The IBD50 stock list. + STOCK_LIST_TYPE_IBD50 = 1; + // The Cap20 stock list. + STOCK_LIST_TYPE_CAP20 = 2; +} + +// LetterGrade represents a letter grade from E to A+. +enum LetterGrade { + LETTER_GRADE_UNSPECIFIED = 0; + LETTER_GRADE_A_PLUS = 1; + LETTER_GRADE_A = 2; + LETTER_GRADE_A_MINUS = 3; + LETTER_GRADE_B_PLUS = 4; + LETTER_GRADE_B = 5; + LETTER_GRADE_B_MINUS = 6; + LETTER_GRADE_C_PLUS = 7; + LETTER_GRADE_C = 8; + LETTER_GRADE_C_MINUS = 9; + LETTER_GRADE_D_PLUS = 10; + LETTER_GRADE_D = 11; + LETTER_GRADE_D_MINUS = 12; + LETTER_GRADE_E_PLUS = 13; + LETTER_GRADE_E = 14; +} + +// StockRatings represents the ratings for a stock scraped from IBD. +message StockRatings { + // Unique identifier for this stock rating instance. + string id = 1; + + // Ratings for the stock. + message Ratings { + // The composite rating. (1-99) + uint32 composite = 1; + // The EPS rating. (1-99) + uint32 eps = 2; + // The relative strength rating. (1-99) + uint32 relative_strength = 3; + // The group relative strength rating. (E-A+) + LetterGrade group_rel_strength = 4; + // The SMR rating. (E-A+) + LetterGrade smr = 5; + // The accumulation/distribution rating. (E-A+) + LetterGrade acc_dis = 6; + } + // The ratings for the stock. + Ratings ratings = 3; + + // The price of the stock at the time of the ratings being scraped. + google.type.Money price = 4; + // The time the ratings were scraped. + google.protobuf.Timestamp last_update = 5; + + // The chart analysis for the stock. + ChartAnalysis chart_analysis = 6; +} + +// ChartAnalysis represents the chart analysis for a stock. +message ChartAnalysis { + // Unique identifier for this chart analysis instance. + string id = 1; + // The raw analysis. + string raw_analysis = 2; +} + +message StockScrapeOperationMetadata { + string symbol = 1; + google.protobuf.Timestamp start_time = 2; +} + +// StockService provides methods for interacting with stock data. +service StockService { + rpc CreateStock(CreateStockRequest) returns (CreateStockResponse) { + option (google.longrunning.operation_info) = { + response_type: "Stock" + metadata_type: "StockScrapeOperationMetadata" + }; + } + // GetStock returns a stock by symbol. + rpc GetStock(GetStockRequest) returns (GetStockResponse); + // ListStocks returns a list of stocks. + rpc ListStocks(ListStocksRequest) returns (ListStocksResponse); +} + +message CreateStockRequest { + string symbol = 1; +} + +message CreateStockResponse { + google.longrunning.Operation operation = 1; +} + +message GetStockRequest { + string symbol = 1; +} + +message GetStockResponse { + Stock stock = 1; +} + +message ListStocksRequest { + StockListType type = 1; + + int32 page_size = 2; + string page_token = 3; +} + +message ListStocksResponse { + repeated Stock stocks = 1; + google.protobuf.Timestamp last_update = 2; + string next_page_token = 3; +} diff --git a/api/proto/idb/user/v1/user.proto b/api/proto/idb/user/v1/user.proto new file mode 100644 index 0000000..8a2f0bc --- /dev/null +++ b/api/proto/idb/user/v1/user.proto @@ -0,0 +1,67 @@ +syntax = "proto3"; + +package idb.user.v1; + +import "google/protobuf/field_mask.proto"; + +message User { + // The subject of the user returned from Auth0. + string subject = 1; + // The username of the user's IBD account. + optional string ibd_username = 2; + // The password of the user's IBD account. + // The password is optional because it is never returned from the server. + // It is only used when updating a user. + optional string ibd_password = 3; +} + +// The user service provides methods for interacting with user data. +service UserService { + rpc CreateUser(CreateUserRequest) returns (CreateUserResponse); + rpc GetUser(GetUserRequest) returns (GetUserResponse); + rpc UpdateUser(UpdateUserRequest) returns (UpdateUserResponse); + + rpc CheckIBDUsername(CheckIBDUsernameRequest) returns (CheckIBDUsernameResponse); + rpc AuthenticateUser(AuthenticateUserRequest) returns (AuthenticateUserResponse); +} + +message CreateUserRequest { + string subject = 1; +} + +message CreateUserResponse { + User user = 1; +} + +message GetUserRequest { + string subject = 1; +} + +message GetUserResponse { + User user = 1; +} + +message UpdateUserRequest { + User user = 1; + google.protobuf.FieldMask update_mask = 2; +} + +message UpdateUserResponse { + User user = 1; +} + +message CheckIBDUsernameRequest { + string ibd_username = 1; +} + +message CheckIBDUsernameResponse { + bool exists = 1; +} + +message AuthenticateUserRequest { + string subject = 1; +} + +message AuthenticateUserResponse { + bool authenticated = 1; +} |