// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); // Crypto Ioc services.AddScoped <ICryptoRepository, CryptoRepository>(); services.AddScoped <ICryptoManager, CryptoManager>(); services.AddScoped <ICryptoCurrencyPriceProvider, CryptoCurrencyPriceProvider>(); services.AddScoped <ICryptoProviderProxy, CryptoProviderProxy>(); services.AddScoped <ICoinbaseProxy, CoinbaseProxy>(); services.AddScoped <ICryptoPriceMapper, CryptoPriceMapper>(); services.AddScoped <IPerformanceResultMapper, PerformanceResultMapper>(); var authenticator = new CoinbasePro.Network.Authentication.Authenticator("credentials", "were", "here"); services.AddSingleton <ICoinbaseProClient>(new CoinbaseProClient(authenticator)); services.AddDbContext <CurrencyContext>(p => p.UseNpgsql(Configuration.GetConnectionString("DefaultConnection"))); services.AddSwaggerGen(); }
private static async Task Main(string[] args) { PrepareNLog(); // File.Create(nomDuFichier).Close(); var authenticator = new CoinbasePro.Network.Authentication.Authenticator(apiKeySandbox, secretSandbox, passSandbox); var coinbaseProClient = new CoinbaseProClient(authenticator, sandBox: true); Pair pairBTCEUR = new Pair(coinbaseProClient, idBTCSandbox, idEURSandbox, ProductType.BtcEur); Pair pairETHEUR = new Pair(coinbaseProClient, idETHSandbox, idEURSandbox, ProductType.EthEur); Pair pairLTCEUR = new Pair(coinbaseProClient, idLTCSandbox, idEURSandbox, ProductType.LtcEur); IEnumerable <Account> accounts; accounts = await pairBTCEUR.ListerLesComptes(); //Task.Run(async () => //{ // await pair.ListerLesProduits(); //}).GetAwaiter().GetResult(); //Task.Run(async () => //{ // await pair.ListerLesMonnaies(); //}).GetAwaiter().GetResult(); //Task.Run(async () => //{ // await pair.DerniereCotation(); //}).GetAwaiter().GetResult(); Task.Run(async() => { await pairBTCEUR.AvoirDuCompteCrypto(); }).GetAwaiter().GetResult(); Task.Run(async() => { await pairBTCEUR.AvoirDuCompteFiat(); }).GetAwaiter().GetResult(); //Task.Run(async () => //{ // await pair.MinimumMonnaies(); //}).GetAwaiter().GetResult(); //Task.Run(async () => //{ // await pair.AnnulerTousOrdresOuverts(); //}).GetAwaiter().GetResult(); //AlgorithmeHaussierOrdreUnique alHETHEUR = new AlgorithmeHaussierOrdreUnique(pairETHEUR, 1000, 0.05m, 1.5m, ++nombreAlgos); //await alHETHEUR.Initialiser(); //alHETHEUR.Lancer(); //AlgorithmeHaussierOrdreUnique alHLTCEUR = new AlgorithmeHaussierOrdreUnique(pairLTCEUR, 1000, 0.05m, 1.5m, ++nombreAlgos); //await alHLTCEUR.Initialiser(); //alHLTCEUR.Lancer(); AlgorithmeHaussierOrdreUnique alHBTCEUR = new AlgorithmeHaussierOrdreUnique(pairBTCEUR, 3500, 0.05m, 1.5m, ++nombreAlgos); await alHBTCEUR.Initialiser(); alHBTCEUR.Lancer(); Console.ReadKey(); }