pip install grpcio grpcio-tools
syntax = "proto3";

service FutureData {
  rpc GetTick(ReqTick) returns (Ticks) {}
}

message ReqTick {
  string name  = 1;
  int32 date  = 2;
}
message Tick {
  string name  = 1;
  int32 date  = 2;
  int32 time  = 3;
  double p  = 3;
  int32 v  = 4;
  int32 oi  = 5;
  double bp  = 6;
  int32 bv  = 7;
  double ap  = 8;
  int32 av  = 9;
}
message Ticks {
    repeated Tick tick = 1;
}

  compile  the proto file:

python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. ./文件名.proto

  

遇到数据量超额:

服务端与客户端一并修改最多限额
MAX_MESSAGE_LENGTH = 512*1024*1024
               ('grpc.max_send_message_length', MAX_MESSAGE_LENGTH),
               ('grpc.max_receive_message_length', MAX_MESSAGE_LENGTH),