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); }
public HftApiClient(string serverGrpcUrl) : base(serverGrpcUrl) { Monitoring = new Monitoring.MonitoringClient(Channel); PrivateService = new PrivateService.PrivateServiceClient(Channel); PublicService = new PublicService.PublicServiceClient(Channel); }