コード例 #1
0
        public IScriptLastTrades GetLastTrades(IScriptMarket market)
        {
            LastTradesContainer trades = null;

            try
            {
                var response = Query(false, "/spot/v3/instruments/" + market.SecondaryCurrency.ToUpper() + "-" + market.PrimaryCurrency.ToUpper() + "/trades", new Dictionary <string, string>()
                {
                    { "limit", "100" }
                });

                if (response != null && response.Value <bool>("success"))
                {
                    trades        = new LastTradesContainer();
                    trades.Market = market;
                    trades.Trades = response.Value <JArray>("result")
                                    .Select(c => Trade.ParsePublicTrade(market, c as JObject))
                                    .Cast <IScriptOrder>()
                                    .OrderByDescending(c => c.Timestamp)
                                    .ToList();
                }
            }
            catch (Exception e)
            {
                OnError(e.Message);
            }

            return(trades);
        }
コード例 #2
0
        public IScriptLastTrades GetLastTrades(IScriptMarket market)
        {
            LastTradesContainer trades = null;

            Console.Out.WriteLine("GetLastTrades");

            try
            {
                var response = Query(false, "/v1/trade-history?", new Dictionary <string, string>()
                {
                    { "symbol", market.PrimaryCurrency.ToUpper() + market.SecondaryCurrency.ToUpper() },
                    { "count", "100" }
                });

                if (response != null)
                {
                    trades        = new LastTradesContainer();
                    trades.Market = market;
                    trades.Trades = response.Value <JArray>("result")
                                    .Select(c => Trade.ParsePublicTrade(market, c as JObject))
                                    .Cast <IScriptOrder>()
                                    .OrderByDescending(c => c.Timestamp)
                                    .ToList();
                }
            }
            catch (Exception e)
            {
                OnError(e.Message);
            }

            return(trades);
        }