public Currency(json.CurrencyCall.Currency jsonCurrency) { tla = jsonCurrency.tla; name = jsonCurrency.name; description = jsonCurrency.desc; link = jsonCurrency.link; decimals = jsonCurrency.decimals; decimalsInternal = jsonCurrency.decimals_internal; confirmations = jsonCurrency.confirms; minimumDeposit = new Amount(jsonCurrency.mindeposit, jsonCurrency.decimals_internal); withdrawalFee = new Amount(jsonCurrency.withdrawfee, jsonCurrency.decimals_internal); feesGenerated = new Amount(jsonCurrency.feesgenned, jsonCurrency.decimals_internal); totalDeposited = new Amount(jsonCurrency.deposited, jsonCurrency.decimals_internal); }
public MarketPair(API api, json.MarketCall.Pair jsonMarketPair) { this.api = api; @base = api.GetCurrency(jsonMarketPair.@base); other = api.GetCurrency(jsonMarketPair.other); volume = new Amount(jsonMarketPair.volume, @base.DecimalsInternal); lastPrice = new Amount(jsonMarketPair.lastprice, @base.DecimalsInternal); bestAsk = new Amount(jsonMarketPair.bestask, @base.DecimalsInternal); bestBid = new Amount(jsonMarketPair.bestbid, @base.DecimalsInternal); depthAsk = new Amount(jsonMarketPair.depthask, other.DecimalsInternal); depthBid = new Amount(jsonMarketPair.depthbid, @base.DecimalsInternal); feeBase = int.Parse(jsonMarketPair.feebase, System.Globalization.NumberStyles.HexNumber) / 100; feeOther = int.Parse(jsonMarketPair.feeother, System.Globalization.NumberStyles.HexNumber) / 100; decimalsOrder = jsonMarketPair.decimals_order; minimumBase = new Amount(jsonMarketPair.minbase, @base.DecimalsInternal); minimumOther = new Amount(jsonMarketPair.minother, other.DecimalsInternal); }
public async Task<string> PlaceOrderAsync(MarketPair marketPair, bool bid, Amount price, Amount amount) { if (apiKey == null) { return null; } Task<Dictionary<string, MarketPair>> marketPairsTask = null; if (this.currencies == null) { marketPairsTask = QueryMarketPairsAsync(); } HttpClient client = new HttpClient(); Task<string> queryTask = client.GetStringAsync(host + "/a?orad" + "&base=" + marketPair.Base.TLA + "&other=" + marketPair.Other.TLA + "&price=" + price.ToRawHex() + "&amount=" + amount.ToRawHex() + "&bid=" + (bid ? "1" : "0") + "&enabled=1" + "&apik=" + apiKey); string json = await queryTask; if (marketPairsTask != null) { await marketPairsTask; } json.PlaceOrderCall query = JsonConvert.DeserializeObject<json.PlaceOrderCall>(json); return query.id; }
public string PlaceOrder(bool bid, Amount price, Amount amount) { return PlaceOrderAsync(bid, price, amount).Result; }
public async Task<string> PlaceOrderAsync(bool bid, Amount price, Amount amount) { return await api.PlaceOrderAsync(this, bid, price, amount); }
public Order(API api, json.UserCall.Order userOrder) { this.api = api; id = userOrder.id; marketPair = api.GetMarketPair(userOrder.pair); time = Utils.UnixTimeStampToDateTime(userOrder.time); amount = new Amount(userOrder.amount, api.GetCurrency(userOrder.side).DecimalsInternal); price = new Amount(userOrder.price, marketPair.Base.DecimalsInternal); bid = userOrder.side == marketPair.Base.TLA; }
public Balance(API api, json.UserCall.Balance userBalance) { this.api = api; currency = api.GetCurrency(userBalance.tla); total = new Amount(userBalance.total, currency.DecimalsInternal); available = new Amount(userBalance.avail, currency.DecimalsInternal); address = userBalance.address; }