syntax = "proto3";

package alt.v1;

option go_package = "git.toki-labs.com/toki/alt/packages/contracts/gen/go/alt/v1;altv1";

import "alt/v1/common.proto";

message Instrument {
  string id = 1;
  Market market = 2;
  Venue venue = 3;
  string symbol = 4;
  string name = 5;
  Currency currency = 6;
  map<string, string> provider_symbols = 7;
  AssetType asset_type = 8;
}

message Price {
  Currency currency = 1;
  Decimal amount = 2;
}

message Quantity {
  Decimal amount = 1;
}

message Bar {
  string instrument_id = 1;
  Timeframe timeframe = 2;
  int64 timestamp_unix_ms = 3;
  Price open = 4;
  Price high = 5;
  Price low = 6;
  Price close = 7;
  Quantity volume = 8;
}

message ListInstrumentsRequest {
  Market market = 1;
  string provider = 2;
}

message ListInstrumentsResponse {
  repeated Instrument instruments = 1;
  ErrorInfo error = 2;
}

message ListBarsRequest {
  string instrument_id = 1;
  Timeframe timeframe = 2;
  int64 from_unix_ms = 3;
  int64 to_unix_ms = 4;
}

message ListBarsResponse {
  repeated Bar bars = 1;
  ErrorInfo error = 2;
}

message ImportDailyBarsRequest {
  string provider = 1;
  string selector_kind = 2;
  Market market = 3;
  Venue venue = 4;
  string name = 5;
  repeated string symbols = 6;
  string from_yyyymmdd = 7;
  string to_yyyymmdd = 8;
}

message ImportDailyBarsResponse {
  string provider = 1;
  int32 instrument_count = 2;
  int32 bar_count = 3;
  ErrorInfo error = 4;
}
