edition = "2023";

package trade;

import "google/protobuf/timestamp.proto"; 
import "model/model.proto";

enum TradeAction {
  UnknownAction = 0;
	Long = 1;
	Short = 2;
}

message ExecuteTradeRequest {
  // Task returning detail of deployed models.
  model.Task Task = 1 [json_name="task"];
  // Action is the action done for the trade.
  TradeAction Action = 2 [json_name="action"];
  // Quantity is coin quantity traded.
	double Quantity = 3 [json_name="quantity"];
}

message Trade { 
  // TradeId is the identifier of a trade.
  string TradeId = 1 [json_name="trade_id"];
  // Task returning detail of deployed models.
  model.Task Task = 2 [json_name="task"];
  // Status is the status of the trade.
  string Status = 3 [json_name="status"];
  // Action is the action done for the trade.
  TradeAction Action = 4 [json_name="action"];
  // Timestamp is a time recorded for the trade.
	google.protobuf.Timestamp Timestamp = 5 [json_name="timestamp"];
  // Quantity is coin quantity traded.
	double Quantity = 6 [json_name="quantity"];
  // Price is closed price when trade happened.
	double Price = 7 [json_name="price"];
  // Details is of the trade state.
	string Details = 8 [json_name="details"];
}

service TradeService {
    rpc ExecuteTrade(ExecuteTradeRequest) returns(Trade) {}
}
