示例#1
0
        public async Task <XCommasResponse <SmartTrade[]> > GetSmartTradesAsync(int?accountId = null, string pair = null, SmartTradeType?type = null, SmartTradeStatus?status = null, OrderBy?orderBy = null, OrderDirection?orderDirection = null, int?page = null, int?perPage = null)
        {
            var param = new Dictionary <string, string>();

            if (accountId.HasValue)
            {
                param.Add("accountId", accountId.Value.ToString());
            }
            AddIfHasValue(param, "pair", pair);
            AddIfHasValue(param, "type", type?.GetEnumMemberAttrValue());
            AddIfHasValue(param, "status", status?.GetEnumMemberAttrValue());
            AddIfHasValue(param, "order_by", orderBy?.GetEnumMemberAttrValue());
            AddIfHasValue(param, "order_direction", orderDirection?.GetEnumMemberAttrValue());
            AddIfHasValue(param, "page", page.ToString());
            AddIfHasValue(param, "per_page", perPage.ToString());

            var qString = BuildQueryString(param);
            var path    = $"{BaseAddress}/v2/smart_trades{qString}";

            using (var request = XCommasRequest.Get(path).Force(UserMode).Sign(this))
            {
                return(await this.GetResponse <SmartTrade[]>(request).ConfigureAwait(false));
            }
        }