/// <summary> /// Send payment.GetApprovalUrl(); to user, to get aproval from him /// </summary> /// <returns></returns> public Payment CreatePayment() { RedirectUrls redirect_urls = new RedirectUrls(); Transaction transaction = new Transaction(); Amount amount = new Amount(); Payer payer = new Payer(); ApiProperties.PaymentIntent intent = ApiProperties.PaymentIntent.sale; ApiProperties.PaymentMethod payment_method = ApiProperties.PaymentMethod.paypal; ApiProperties.Currency curremcy = ApiProperties.Currency.USD; string description = "descriptiontest"; decimal total = 1.1M; redirect_urls.return_url = @"https://www.google.pl/search?q=return"; redirect_urls.cancel_url = @"https://www.google.pl/search?q=cancel"; amount.currency = curremcy.GetEnumName(); amount.total = string.Format("{0:0.00}", total); transaction.amount = amount; transaction.description = description; payer.payment_method = payment_method.GetEnumName(); Payment payment = new Payment(); payment.intent = intent.GetEnumName(); payment.redirect_urls = redirect_urls; payment.payer = payer; payment.transactions = new List <Transaction>() { transaction }; return(payment.Create(this.Context)); }
//TODO: NOT TESTED public ObjMovements[] GetMovements(ApiProperties.Currency currency, ApiProperties.Methods method, TickTime since, TickTime until, int limit) { return(GetMovements( currency.GetEnumName(), method.GetEnumName(), since.ToUnixTimeStamp(), until.ToUnixTimeStamp(), limit )); }
//TODO: NOT TESTED /// <summary> /// View all of your balance ledger entries. /// </summary> /// <param name="currency">The currency to look for.</param> /// <param name="since">Optional. Return only the history after this timestamp.</param> /// <param name="until">Optional. Return only the history before this timestamp.</param> /// <param name="limit">Optional. Limit the number of entries to return. Default is 500.</param> /// <param name="wallet">Optional. Return only entries that took place in this wallet. Accepted inputs are: "trading", "exchange", "deposit".</param> /// <returns></returns> public ObjBalanceHistory GetBalanceHistory(ApiProperties.Currency currency, TickTime since, TickTime until, int limit, ApiProperties.WalletName wallet) { return(GetBalanceHistory( currency.GetEnumName(), since.ToUnixTimeStamp(), until.ToUnixTimeStamp(), limit, wallet.GetEnumName() )); }
//TODO: NOT TESTED /// <summary> /// Submit a new offer. /// </summary> /// <param name="currency">The name of the currency.</param> /// <param name="amount">Offer size: how much to lend or borrow.</param> /// <param name="rate">Rate to lend or borrow at. In percentage per 365 days.</param> /// <param name="period">Number of days of the loan (in days)</param> /// <param name="direction">Either "lend" or "loan".</param> /// <returns></returns> public ObjNewOffer GetNewOffer(ApiProperties.Currency currency, decimal amount, decimal rate, int period, ApiProperties.Directions direction) { return(GetNewOffer( currency.GetEnumName(), amount, rate, period, direction.GetEnumName() )); }
/// <summary> /// Get a list of the most recent swaps data for the given currency: /// total amount lent and Flash Return Rate (in % by 365 days) over time. /// </summary> /// <param name="currency"></param> /// <param name="timestamp">Only show data at or after this timestamp.</param> /// <param name="limit_lends">Limit the number of swaps data returned. Must be >= 1</param> /// <returns></returns> public List <ObjLends> GetLends( ApiProperties.Currency currency, double timestamp, int?limit_lends = null) { ObjRequestLends variable = new ObjRequestLends(Nonce, currency, timestamp, limit_lends); string response = this.Request(variable, "GET"); List <ObjLends> result = JsonConvert.DeserializeObject <List <ObjLends> >(response); return(result); }
/// <summary> /// Get the full lend book: /// </summary> /// <param name="currency"></param> /// <param name="limit_bids"></param> /// <param name="limit_asks"></param> /// <returns></returns> public ObjLendbook GetLendbook( ApiProperties.Currency currency, int?limit_bids = null, int?limit_asks = null) { ObjRequestLendbook variable = new ObjRequestLendbook(Nonce, currency, limit_bids, limit_asks); string response = this.Request(variable, "GET"); ObjLendbook result = JsonConvert.DeserializeObject <ObjLendbook>(response); return(result); }
/// <summary> /// /// </summary> /// <param name="nonce"></param> /// <param name="currency"></param> /// <param name="timestamp">Only show trades at or after this timestamp.</param> /// <param name="limit_lends">Limit the number of swaps data returned. Must be >= 1</param> public ObjRequestLends( string nonce, ApiProperties.Currency currency, double timestamp, int?limit_lends = 50) { this.nonce = nonce; this.timestamp = timestamp; this.request = ApiProperties.LendsRequestUrl + @"/" + currency.GetEnumName(); if (limit_lends != null && limit_lends.Value >= 1) { this.limit_lends = limit_lends.Value; } }
public ObjRequestLendbook( string nonce, ApiProperties.Currency currency, int?limit_bids = 50, int?limit_asks = 50) { this.nonce = nonce; this.request = ApiProperties.LendbookRequestUrl + @"/" + currency.GetEnumName(); if (limit_bids != null && limit_bids.Value >= 0) { this.limit_bids = limit_bids.Value; } if (limit_asks != null && limit_asks.Value >= 0) { this.limit_asks = limit_asks.Value; } }
/// <summary> /// Can be called using: payment.GetApprovalUrl(); /// </summary> /// <param name="amount"></param> /// <param name="currency"></param> /// <param name="description"></param> /// <param name="returnURL"></param> /// <param name="cancelURL"></param> /// <returns></returns> public Payment RequestPayment( decimal amount, ApiProperties.Currency currency, string description, string returnURL, //@"https://www.google.pl/search?q=return" string cancelURL //@"https://www.google.pl/search?q=cancel" ) { if (amount <= 0) { return(null); } RedirectUrls redirect_urls = new RedirectUrls(); Transaction transaction = new Transaction(); Amount Amount = new Amount(); Payer payer = new Payer(); ApiProperties.PaymentIntent intent = ApiProperties.PaymentIntent.sale; ApiProperties.PaymentMethod payment_method = ApiProperties.PaymentMethod.paypal; redirect_urls.return_url = returnURL; redirect_urls.cancel_url = cancelURL; Amount.currency = currency.GetEnumName(); Amount.total = string.Format("{0:0.00}", amount); transaction.amount = Amount; transaction.description = description; payer.payment_method = payment_method.GetEnumName(); Payment payment = new Payment(); payment.intent = intent.GetEnumName(); payment.redirect_urls = redirect_urls; payment.payer = payer; payment.transactions = new List <Transaction>() { transaction }; return(payment.Create(this.Context)); }
// TODO: NOT TESTED /// <summary> /// Allow you to move available balances between your wallets. /// </summary> /// <param name="amount">Amount to transfer.</param> /// <param name="currency">Currency of funds to transfer.</param> /// <param name="walletfrom">Wallet to transfer from.</param> /// <param name="walletto">Wallet to transfer to.</param> /// <returns></returns> public ObjTransfer GetTransfer(decimal amount, ApiProperties.Currency currency, ApiProperties.WalletName walletfrom, ApiProperties.WalletName walletto) { return(this.GetTransfer(amount, currency.GetEnumName(), walletfrom.GetEnumName(), walletto.GetEnumName())); }