public TradingApiClient(string grpcUrl, string apiKey)
        {
            var credentials = CallCredentials.FromInterceptor((context, metadata) =>
            {
                if (!string.IsNullOrEmpty(apiKey))
                {
                    metadata.Add("Authorization", $"Bearer {apiKey}");
                }
                return(Task.CompletedTask);
            });

            Channel = GrpcChannel.ForAddress(grpcUrl, new GrpcChannelOptions
            {
                Credentials = ChannelCredentials.Create(new SslCredentials(), credentials)
            });

            PublicApi = new PublicService.PublicServiceClient(Channel);

            PrivateApi = new PrivateService.PrivateServiceClient(Channel);
        }
Ejemplo n.º 2
0
 public HftApiClient(string serverGrpcUrl) : base(serverGrpcUrl)
 {
     Monitoring     = new Monitoring.MonitoringClient(Channel);
     PrivateService = new PrivateService.PrivateServiceClient(Channel);
     PublicService  = new PublicService.PublicServiceClient(Channel);
 }