public async Task <List <MarketTrade> > GetMarketTrades(MarketId marketId) { BterMarketId bterMarketId = (BterMarketId)marketId; return(BterMarketTrade.Parse(marketId, await CallPublic <JObject>(Method.trade, bterMarketId))); }
/// <summary> /// Make a call to a public (non-authenticated) API /// </summary> /// <param name="method">The method to call on the Bter API</param> /// <param name="quoteCurrencyCode">A quote currency code to append to the URL</param> /// <returns>The raw JSON returned from Bter</returns> private async Task <T> CallPublic <T>(Method method, BterMarketId marketId) where T : JToken { StringBuilder url = new StringBuilder(BuildPublicUrl(method)); url.Append("/") .Append(Uri.EscapeUriString(marketId.Value)); return((T)JToken.Parse(await CallPublic(url.ToString()))); }
public static List <Market> ParseMarkets(JObject marketsJson) { List <Market> markets = new List <Market>(); foreach (JProperty marketProperty in marketsJson.Properties()) { BterMarketId marketId = new BterMarketId(marketProperty.Name); JObject marketJson = (JObject)marketProperty.Value; MarketStatistics marketStats = new MarketStatistics() { HighTrade = marketJson.Value <decimal>("high"), LastTrade = marketJson.Value <decimal>("last"), LowTrade = marketJson.Value <decimal>("low"), Volume24HBase = marketJson.Value <decimal>("vol_" + marketId.BaseCurrencyCode.ToLower()) }; markets.Add(new BterMarket(marketId, marketStats)); } return(markets); }
public static List<Market> ParseMarkets(JObject marketsJson) { List<Market> markets = new List<Market>(); foreach (JProperty marketProperty in marketsJson.Properties()) { BterMarketId marketId = new BterMarketId(marketProperty.Name); JObject marketJson = (JObject)marketProperty.Value; MarketStatistics marketStats = new MarketStatistics() { HighTrade = marketJson.Value<decimal>("high"), LastTrade = marketJson.Value<decimal>("last"), LowTrade = marketJson.Value<decimal>("low"), Volume24HBase = marketJson.Value<decimal>("vol_" + marketId.BaseCurrencyCode.ToLower()) }; markets.Add(new BterMarket(marketId, marketStats)); } return markets; }
public BterOrderId(BterMarketId setMarketId, string setValue) { this.MarketId = setMarketId; this.Value = setValue; }
public override async Task <Model.Book> GetMarketDepth(MarketId marketId) { BterMarketId bterMarketId = (BterMarketId)marketId; return(BterParsers.ParseOrderBook(await CallPublic <JObject>(Method.depth, bterMarketId))); }
public async Task <List <BterMarketId> > GetPairs() { JArray pairsJson = await CallPublic <JArray>(Method.tickers); return(BterMarketId.ParsePairs(pairsJson)); }
public BterMarket(BterMarketId id, MarketStatistics statistics) : base(id, id.BaseCurrencyCode, id.QuoteCurrencyCode, id.ToString(), statistics) { }