GDAX API C# Client Library - https://docs.gdax.com/
PM> Install-Package GDAX.Api.ClientLibrary
Generate your key at https://www.gdax.com/settings/api
//create an authenticator with your apiKey, secret and passphrase
var authenticator = new Authenticator("<apiKey>", "<secret>", "<passphrase>");
//create the GDAX client
var gdaxClient = new GDAXClient.GDAXClient(authenticator);
//use one of the services
var allAccounts = await gdaxClient.AccountsService.GetAllAccountsAsync();
- GetAllAccountsAsync() - get all accounts
- GetAccountByIdAsync(id) - get account by id
- GetAccountHistoryAsync(id, limit) - get account history (paged response)
- GetAccountHoldsAsync(id, limit) - get all holds placed on an account (paged response)
- GetAllAccountsAsync() - get all coinbase accounts
- PlaceMarketOrderAsync(orderSide, productPair, size) - place market order
- PlaceLimitOrderAsync(orderSide, productPair, size, price, timeInForce, postOnly) - place limit order with time in force
- PlaceLimitOrderAsync(orderSide, productPair, size, price, cancelAfter, postOnly) - place limit order with cancel after date
- CancelAllOrdersAsync() - cancel all orders
- CancelOrderByIdAsync(id) - cancel order by id
- GetAllOrdersAsync(limit) - get all open or un-settled orders (paged response)
- GetOrderByIdAsync(id) - get order by id
- GetAllPaymentMethodsAsync() - get all payment methods
- WithdrawFundsAsync(paymentMethodId, amount, currency) - withdraw funds to a payment method
- WithdrawToCoinbaseAsync(coinbaseAccountId, amount, currency) - withdraw funds to a coinbase account
- WithdrawToCryptoAsync(cryptoAddress, amount, currency) - withdraw funds to a crypto address
- DepositFundsAsync(paymentMethodId, amount, currency) - deposits funds from a payment method
- DepositCoinbaseFundsAsync(coinbaseAccountId, amount, currency) - deposits funds from a coinbase account
- GetAllProductsAsync() - get a list of available currency pairs for trading
- GetProductOrderBookAsync(productType, productLevel) - get a list of open orders for a product (specify level 1, 2, or 3)
- GetProductTickerAsync(productType) - get information about the last trade (tick), best bid/ask and 24h volume
- GetProductStatsAsync(productType) - get 24 hour stats for a product
- GetHistoricRatesAsync(productPair, start, end, granularity) - get historic rates for a product
- GetAllCurrenciesAsync() - gets a list of known currencies
- GetAllFillsAsync(limit) - gets a list of all recent fills (paged response)
- GetFillsByOrderIdAsync(orderId, limit) - gets a list of all recent fills by order id (paged response)
- GetFillsByProductIdAsync(productType, limit) - gets a list of all recent fills by product type (paged response)
- GetAllFundingsAsync(limit, fundingStatus) - gets a list of all orders placed with a margin profile that draws funding (paged response)
Generate your key at https://public.sandbox.gdax.com/settings/api
//create an authenticator with your apiKey, signature and passphrase
var authenticator = new Authenticator("<apiKey>", "<signature>", "<passphrase>");
//create the GDAX client and set the sandbox flag to true
var gdaxClient = new GDAXClient.GDAXClient(authenticator, true);
//use one of the services
var response = await gdaxClient.OrdersService.PlaceMarketOrderAsync(OrderSide.Buy, ProductType.BtcUsd, 1));
var response = await gdaxClient.OrdersService.PlaceMarketOrderAsync(OrderSide.Buy, ProductType.BtcUsd, 1));
var response = await gdaxClient.OrdersService.PlaceLimitOrderAsync(OrderSide.Sell, ProductType.EthUsd, 1, 400.0M));
var response = await gdaxClient.OrdersService.CancelAllOrdersAsync();
//the limit is the amount of items per page - in this case it would be 2 items (default is 100)
var accountHistoryResponse = await gdaxClient.AccountsService.GetAccountHistoryAsync("ef56a389", 2);
//retrieve by page number - this would return the first page of the response (latest first)
var firstPage = accountHistoryResponse.ToList()[0];
//get the first item on the page
var firstAccountHistoryOnFirstPage = firstPage.ToList()[0];
//get the second item on the page
var secondAccountHistoryOnFirstPage = firstPage.ToList()[1];
Thanks for contributing!
- @dgelineau
- @quin810
- @DontFretBrett
Please open an issue for any bugs or questions