Exemplo n.º 1
0
        public static async Task <PaginatedResult <Ledger> > GetAccountHistoryAsync(this GdaxClient client, Guid accountId, PaginationOptions paging = null)
        {
            Check.NotNull(client, nameof(client));
            Check.NotEmpty(accountId, nameof(accountId));

            var request = new GdaxRequestBuilder($"/accounts/{accountId}/ledger")
                          .SetPageOptions(paging)
                          .Build();

            var response = await client.GetResponseAsync <IList <Ledger> >(request).ConfigureAwait(false);

            return(new PaginatedResult <Ledger>(response, paging));
        }
Exemplo n.º 2
0
        /// <summary>
        ///		<para>
        ///			Get a list of recent fills.
        ///		</para>
        ///		<para>
        ///			Fees are recorded in two stages. Immediately after the matching engine completes a match, the fill is inserted
        ///			into the datastore. Once the fill is recorded, a settlement process will settle the fill and credit both trading
        ///			counterparties.
        ///		</para>
        /// </summary>
        /// <remarks>
        /// Fills are returned sorted by descending trade_id from the largest trade_id to the smallest trade_id.
        /// </remarks>
        /// <param name="orderId">Limit list of fills to this order.</param>
        /// <param name="productId">Limit list of fills to this product.</param>
        /// <param name="paging">The paging options.</param>
        /// <returns></returns>
        public static async Task <PaginatedResult <Fill> > GetFillsAsync(this GdaxClient client, String orderId = null, String productId = null, PaginationOptions paging = null)
        {
            Check.NotNull(client, nameof(client));

            var request = new GdaxRequestBuilder("/fills")
                          .AddParameterIfNotNull("order_id", orderId)
                          .AddParameterIfNotNull("product_id", productId)
                          .SetPageOptions(paging)
                          .Build();

            var response = await client.GetResponseAsync <IList <Fill> >(request).ConfigureAwait(false);

            return(new PaginatedResult <Fill>(response, paging));
        }
Exemplo n.º 3
0
        public async Task <WalletWithdrawal> WithdrawToWallet(Decimal amount, String currency, String cryptoAddress)
        {
            var model = new WalletWithdrawalRequest
            {
                Amount        = amount,
                Currency      = currency,
                CryptoAddress = cryptoAddress
            };

            var request = new GdaxRequestBuilder("/withdrawals/crypto", HttpMethod.Post)
                          .AddBody(model, this.serialzer)
                          .Build();

            return((await this.GetResponse <WalletWithdrawal>(request).ConfigureAwait(false)).Value);
        }
Exemplo n.º 4
0
        public async Task <CoinbaseWithdrawal> WithdrawToCoinbase(Decimal amount, String currency, Guid coinbaseID)
        {
            var model = new CoinbaseWithdrawalRequest
            {
                Amount            = amount,
                Currency          = currency,
                CoinbaseAccountId = coinbaseID
            };

            var request = new GdaxRequestBuilder("/withdrawals/coinbase", HttpMethod.Post)
                          .AddBody(model, this.serialzer)
                          .Build();

            return((await this.GetResponse <CoinbaseWithdrawal>(request).ConfigureAwait(false)).Value);
        }
Exemplo n.º 5
0
        public async Task <BankTransfer> WithdrawToBank(Decimal amount, String currency, Guid paymentID)
        {
            var model = new BankTransferRequest
            {
                Amount          = amount,
                Currency        = currency,
                PaymentMethodId = paymentID
            };

            var request = new GdaxRequestBuilder("/withdrawals/payment-method", HttpMethod.Post)
                          .AddBody(model, this.serialzer)
                          .Build();

            return((await this.GetResponse <BankTransfer>(request).ConfigureAwait(false)).Value);
        }
Exemplo n.º 6
0
        public async Task <ProductTicker> GetProductTicker(String productId)
        {
            Check.NotNullOrWhiteSpace(productId, nameof(productId));

            var request = new GdaxRequestBuilder($"/products/{productId}/ticker")
                          .Build();

            var response = await this.GetResponse <ProductTicker>(request).ConfigureAwait(false);

            if (response.Value != null)
            {
                response.Value.ProductId = productId;
            }

            return(response.Value);
        }
Exemplo n.º 7
0
        public async Task <IList <PaymentMethod> > GetPaymentMethods()
        {
            var request = new GdaxRequestBuilder("/payment-methods").Build();

            return((await this.GetResponse <IList <PaymentMethod> >(request).ConfigureAwait(false)).Value);
        }