Esempio n. 1
0
        public async Task ListFills_ShouldAllowNextAndPreviousPage()
        {
            var client = new GdaxClient(TestAuthenticators.FullAccess)
            {
                UseSandbox = true
            };

            var fills = await client.GetFillsAsync(paging : new PaginationOptions
            {
                Limit = 1
            });

            var fillsPage2 = await client.GetFillsAsync(paging : fills.NextPage());

            var fillsPage1 = await client.GetFillsAsync(paging : fillsPage2.PreviousPage());

            fills.Should().NotBeNull();
            fills.Results.Should().HaveCount(1);

            fillsPage2.Should().NotBeNull();
            fillsPage2.Results.Should().HaveCount(1);
            fillsPage2.Results.Should().NotContain(x => x.OrderId == fills.Results.First().OrderId);

            fillsPage1.Should().NotBeNull();
            fillsPage1.Results.Should().HaveCount(1);
            fillsPage1.Results.Should().Contain(x => x.OrderId == fills.Results.First().OrderId);
        }
Esempio n. 2
0
        public GDAXIntegration(IMarketPriceObserver[] priceObservers, Exchange[] exchanges) : base(priceObservers, exchanges)
        {
            this.Exchange = exchanges[0];
            GdaxAuthenticator auth = new GdaxAuthenticator(this.Exchange.GetSetting("ApiKey"), this.Exchange.GetSetting("ApiPassPhrase"), this.Exchange.GetSetting("ApiSecret"));

            gdaxClient = new GdaxClient(auth);
        }
Esempio n. 3
0
        public async Task GetOrders_ShouldAllowOlderAndNewerPage()
        {
            var client = new GdaxClient(TestAuthenticators.FullAccess)
            {
                UseSandbox = true
            };

            var orders = await client.GetOrders(states : OrderStates.All, paging : new PagingOptions <DateTime?>
            {
                Limit = 1
            });

            var ordersPage2 = await client.GetOrders(paging : orders.NextPage());

            var ordersPage1 = await client.GetOrders(paging : ordersPage2.PreviousPage());

            orders.ShouldNotBeNull();
            orders.Results.ShouldHaveSingleItem();

            ordersPage2.ShouldNotBeNull();
            ordersPage2.Results.ShouldHaveSingleItem();
            ordersPage2.Results.ShouldNotContain(x => x.OrderId == orders.Results.First().OrderId);

            ordersPage1.ShouldNotBeNull();
            ordersPage1.Results.ShouldHaveSingleItem();
            ordersPage1.Results.ShouldContain(x => x.OrderId == orders.Results.First().OrderId);
        }
Esempio n. 4
0
        public async Task Should_return_last_trade()
        {
            var gdaxClient = new GdaxClient();

            var lastTrade = await gdaxClient.MarketData.GetLastTrade(CurrencyPair.BtcEur);

            Assert.NotNull(lastTrade);
        }
Esempio n. 5
0
        public GDAXIntegration(Exchange[] exchanges) : base(exchanges)
        {
            this.Exchange = exchanges[0];

            GdaxAuthenticator auth = new GdaxAuthenticator(this.Exchange.GetSetting("ApiKey"), this.Exchange.GetSetting("ApiPassPhrase"), this.Exchange.GetSetting("ApiSecret"));

            gdaxClient = new GdaxClient(auth);
        }
Esempio n. 6
0
        private GDAX(string apikey, string apisecret, string passphrase)
        {
            ApiKey    = apikey;
            ApiSecret = apisecret;
            var auth = new Authenticator(ApiKey, ApiSecret, passphrase);

            m_api      = new GdaxClient(auth, sandBox: false);
            m_instance = this;
        }
        public async Task GetServerTimeAsync_ReturnsTheCurrentTime()
        {
            var client = new GdaxClient(TestAuthenticators.Unauthorized)
            {
                UseSandbox = true
            };

            var time = await client.GetServerTimeAsync();

            time.Iso.Should().BeCloseTo(DateTime.UtcNow, 30 * 1000);
        }
        public async Task GetOrderBookAsync_ShouldReturnTheCurrentOrderBook()
        {
            var client = new GdaxClient(TestAuthenticators.Unauthorized)
            {
                UseSandbox = true
            };

            var book = await client.GetOrderBookAsync("BTC-USD");

            book.Should().NotBeNull();
        }
Esempio n. 9
0
 public DataClient()
 {
     Binance  = new BinanceClient();
     Bitfinex = new BitfinexClient();
     Poloniex = new PoloniexClient();
     Bitstamp = new BitstampClient();
     Gdax     = new GdaxClient();
     Gemini   = new GeminiClient();
     Kraken   = new KrakenClient();
     Okex     = new OkexClient();
 }
Esempio n. 10
0
        public async Task GetProductsAsync_ShouldReturnTheCurrentCurrencies()
        {
            var client = new GdaxClient(TestAuthenticators.Unauthorized)
            {
                UseSandbox = true
            };

            var products = await client.GetProductsAsync();

            products.Should().NotBeEmpty();
        }
Esempio n. 11
0
        public async Task GetOrders_ShouldListTheOrders()
        {
            var client = new GdaxClient(TestAuthenticators.FullAccess)
            {
                UseSandbox = true
            };

            var Orders = await client.GetOrders(states : OrderStates.All);

            Orders.ShouldNotBeNull();
        }
        public async Task GetServerTime_ReturnsTheCurrentTime()
        {
            var client = new GdaxClient(TestAuthenticators.Unauthorized)
            {
                UseSandbox = true
            };

            var time = await client.GetServerTime();

            time.Iso.ShouldBe(DateTime.UtcNow, TimeSpan.FromSeconds(30));
        }
Esempio n. 13
0
        public async Task GetAccounts_ShouldReturnTheAccounts()
        {
            var client = new GdaxClient(TestAuthenticators.FullAccess)
            {
                UseSandbox = true
            };

            var accounts = await client.GetAccounts();

            accounts.ShouldNotBeNull();
        }
        public async Task GetHistoricRatesAsync_ShouldReturnTheHistoricRates()
        {
            var client = new GdaxClient(TestAuthenticators.Unauthorized)
            {
                UseSandbox = true
            };

            var history = await client.GetHistoricRatesAsync("BTC-USD", DateTime.UtcNow.AddMinutes(-10), DateTime.UtcNow, 30);

            history.Should().NotBeNull();
        }
Esempio n. 15
0
        public async Task GetFills_ShouldListTheFills()
        {
            var client = new GdaxClient(TestAuthenticators.FullAccess)
            {
                UseSandbox = true
            };

            var fills = await client.GetFills();

            fills.ShouldNotBeNull();
        }
        public async Task GetProductTickerAsync_ShouldReturnTheCurrentCurrencyPrices()
        {
            var client = new GdaxClient(TestAuthenticators.Unauthorized)
            {
                UseSandbox = true
            };

            var ticker = await client.GetProductTickerAsync("BTC-USD");

            ticker.Should().NotBeNull();
            ticker.Price.Should().BeGreaterThan(0);
        }
Esempio n. 17
0
        public async Task GetAccountHistoryAsync_ShouldReturnTheAccounts()
        {
            var client = new GdaxClient(TestAuthenticators.FullAccess)
            {
                UseSandbox = true
            };

            var accounts = await client.GetAccountsAsync();

            var ledger = await client.GetAccountHistoryAsync(accounts.First().Id);

            ledger.Results.Should().NotBeNull();
        }
Esempio n. 18
0
        public async Task GetFills_ShouldAllowOlderAndNewerPage()
        {
            var client = new GdaxClient(TestAuthenticators.FullAccess)
            {
                UseSandbox = true
            };

            var accounts = await client.GetCoinbaseAccounts();

            var btcAccount = accounts.First(x => x.Currency == "BTC");

            if (btcAccount.Balance > 0)
            {
                await client.DepositFromCoinbase(10, btcAccount.Currency, btcAccount.Id);
            }

            await client.PlaceMarketOrder(Side.Sell, "BTC-USD", 0.01m);

            await client.PlaceMarketOrder(Side.Sell, "BTC-USD", 0.02m);

            await client.PlaceMarketOrder(Side.Sell, "BTC-USD", 0.03m);

            await client.PlaceMarketOrder(Side.Sell, "BTC-USD", 0.04m);

            var fills = await client.GetFills(paging : new PagingOptions <Int32?>
            {
                Limit = 1
            });

            var fillsPage2 = await client.GetFills(paging : fills.NextPage());

            var fillsPage1 = await client.GetFills(paging : fillsPage2.PreviousPage());

            fills.ShouldNotBeNull();
            fills.Results.ShouldHaveSingleItem();

            fillsPage2.ShouldNotBeNull();
            fillsPage2.Results.ShouldHaveSingleItem();
            fillsPage2.Results.ShouldNotContain(x => x.OrderId == fills.Results.First().OrderId);

            fillsPage1.ShouldNotBeNull();
            fillsPage1.Results.ShouldHaveSingleItem();
            fillsPage1.Results.ShouldContain(x => x.OrderId == fills.Results.First().OrderId);
        }
Esempio n. 19
0
        /// <summary>
        ///     Adds coin sources to the <paramref name="services" />.
        /// </summary>
        /// <param name="services">The <see cref="IServiceCollection" />.</param>
        /// <param name="configurationRoot">Configuration</param>
        /// <returns></returns>
        public static IServiceCollection AddClients(this IServiceCollection services, IConfigurationRoot configurationRoot)
        {
#if NOT_DEPRECATED
            // currently returning errors
            CoinMarketCapClient.Register(services);
#endif
            BinanceClient.Register(services);
            BittrexClient.Register(services);
            GdaxClient.Register(services);
            GateIoClient.Register(services);
            KrakenClient.Register(services);
            PoloniexClient.Register(services);

            FunFairClientBase.Register(services: services,
                                       configurationRoot.GetSection(key: "Sources:FunFair")
                                       .Get <FunFairClientConfiguration>());

            return(services);
        }