Exemplo n.º 1
0
        public static void AddFTX(this IServiceCollection services, string apiKey, string apiSecret)
        {
            services.AddHttpClient("FTX", c =>
            {
                c.BaseAddress = new Uri(FTXParameters.BaseAddress);
                c.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            });
            services.AddScoped <IFTXClient>(ctx =>
            {
                var clientFactory = ctx.GetRequiredService <IHttpClientFactory>();
                var httpClient    = clientFactory.CreateClient("FTX");

                return(new FTXClient(httpClient, apiKey, apiSecret));
            });
            services.AddScoped <IFTX>(ctx =>
            {
                IFTXClient ftxClient = ctx.GetRequiredService <IFTXClient>();
                return(new FTX(ftxClient));
            });
        }
Exemplo n.º 2
0
 public FTX(IFTXClient ftxClient)
 {
     _ftxClient = ftxClient;
 }