Exemplo n.º 1
0
        public async Task <XCommasResponse <MarketplaceItem[]> > GetMarketplaceItemsAsync(int limit = 50, int?offset = null, SignalProviders scope = SignalProviders.All)
        {
            var path = $"{BaseAddress}/ver1/marketplace/items?limit={limit}&offset={offset}&scope={scope.GetEnumMemberAttrValue()}";

            using (var request = XCommasRequest.Get(path).Force(UserMode).Sign(this))
            {
                return(await this.GetResponse <MarketplaceItem[]>(request).ConfigureAwait(false));
            }
        }
Exemplo n.º 2
0
        public async Task <XCommasResponse <Market[]> > GetMarketsAsync()
        {
            var path = $"{BaseAddress}/ver1/accounts/market_list";

            using (var request = XCommasRequest.Get(path))
            {
                return(await this.GetResponse <Market[]>(request).ConfigureAwait(false));
            }
        }
Exemplo n.º 3
0
        public async Task <XCommasResponse <Deal> > ShowDealAsync(int dealId)
        {
            var path = $"{BaseAddress}/ver1/deals/{dealId}/show";

            using (var request = XCommasRequest.Get(path).Sign(this))
            {
                return(await this.GetResponse <Deal>(request).ConfigureAwait(false));
            }
        }
Exemplo n.º 4
0
        public async Task <XCommasResponse <GridBot> > ShowGridBotAsync(int botId)
        {
            var path = $"{BaseAddress}/ver1/grid_bots/{botId}";

            using (var request = XCommasRequest.Get(path).Force(UserMode).Sign(this))
            {
                return(await this.GetResponse <GridBot>(request).ConfigureAwait(false));
            }
        }
Exemplo n.º 5
0
        public async Task <XCommasResponse <MarketplaceItem[]> > GetMarketplaceItemsAsync()
        {
            var path = $"{BaseAddress}/ver1/marketplace/items";

            using (var request = XCommasRequest.Get(path).Sign(this))
            {
                return(await this.GetResponse <MarketplaceItem[]>(request).ConfigureAwait(false));
            }
        }
Exemplo n.º 6
0
        public async Task <XCommasResponse <SmartTrade[]> > GetSmartTradesAsync(int limit = 50, int?offset = null, int?accountId = null, SmartTradeScope smartTradeScope = SmartTradeScope.All, string type = null)
        {
            var path = $"{BaseAddress}/ver1/smart_trades?limit={limit}&offset={offset}&account_id={accountId}&scope={smartTradeScope.GetEnumMemberAttrValue()}&type={type}";

            using (var request = XCommasRequest.Get(path).Sign(this))
            {
                return(await this.GetResponse <SmartTrade[]>(request).ConfigureAwait(false));
            }
        }
Exemplo n.º 7
0
        public async Task <XCommasResponse <Deal[]> > GetDealsAsync(int limit = 50, int?offset = null, int?accountId = null, int?botId = null, DealScope dealScope = DealScope.All, DealOrder dealOrder = DealOrder.CreatedAt)
        {
            var path = $"{BaseAddress}/ver1/deals?limit={limit}&offset={offset}&account_id={accountId}&bot_id={botId}&scope={dealScope.GetEnumMemberAttrValue()}&order={dealOrder.GetEnumMemberAttrValue()}";

            using (var request = XCommasRequest.Get(path).Sign(this))
            {
                return(await this.GetResponse <Deal[]>(request).ConfigureAwait(false));
            }
        }
Exemplo n.º 8
0
        public async Task <XCommasResponse <Bot> > ShowBotAsync(int botId)
        {
            var path = $"{BaseAddress}/ver1/bots/{botId}/show";

            using (var request = XCommasRequest.Get(path).Sign(this))
            {
                return(await this.GetResponse <Bot>(request).ConfigureAwait(false));
            }
        }
Exemplo n.º 9
0
        public async Task <XCommasResponse <Bot[]> > GetBotsAsync(int limit = 50, int?offset = null, int?accountId = null, int?botId = null, BotScope botScope = BotScope.Enabled, Strategy strategy = Strategy.Long)
        {
            var path = $"{BaseAddress}/ver1/bots?limit={limit}&offset={offset}&account_id={accountId}&bot_id={botId}&scope={botScope.GetEnumMemberAttrValue()}&strategy={strategy.GetEnumMemberAttrValue()}";

            using (var request = XCommasRequest.Get(path).Sign(this))
            {
                return(await this.GetResponse <Bot[]>(request).ConfigureAwait(false));
            }
        }
Exemplo n.º 10
0
        public async Task <XCommasResponse <BotStats> > GetBotStatsAsync()
        {
            var path = $"{BaseAddress}/ver1/bots/stats";

            using (var request = XCommasRequest.Get(path).Sign(this))
            {
                return(await this.GetResponse <BotStats>(request).ConfigureAwait(false));
            }
        }
Exemplo n.º 11
0
        public async Task <XCommasResponse <CurrencyRate> > GetCurrencyRateAsync(string pair, string prettyDisplayType = "Binance")
        {
            var path = $"{BaseAddress}/ver1/accounts/currency_rates?pretty_display_type={prettyDisplayType}&pair={pair}";

            using (var request = XCommasRequest.Get(path))
            {
                return(await this.GetResponse <CurrencyRate>(request).ConfigureAwait(false));
            }
        }
Exemplo n.º 12
0
        public async Task <XCommasResponse <BotPairsBlackListData> > GetBotPairsBlackListAsync()
        {
            var path = $"{BaseAddress}/ver1/bots/pairs_black_list";

            using (var request = XCommasRequest.Get(path).Sign(this))
            {
                return(await this.GetResponse <BotPairsBlackListData>(request).ConfigureAwait(false));
            }
        }
Exemplo n.º 13
0
        public async Task <XCommasResponse <Account[]> > GetAccountsAsync()
        {
            var path = $"{BaseAddress}/ver1/accounts";

            using (var request = XCommasRequest.Get(path).Sign(this))
            {
                return(await this.GetResponse <Account[]>(request).ConfigureAwait(false));
            }
        }
Exemplo n.º 14
0
        public async Task <XCommasResponse <CurrencyRate> > GetCurrencyRateAsync(string pair, string marketcode = "binance")
        {
            var path = $"{BaseAddress}/ver1/accounts/currency_rates?market_code={marketcode}&pair={pair}";

            using (var request = XCommasRequest.Get(path))
            {
                return(await this.GetResponse <CurrencyRate>(request).ConfigureAwait(false));
            }
        }
Exemplo n.º 15
0
        public async Task <XCommasResponse <string[]> > GetMarketPairsAsync(string marketCode)
        {
            var path = $"{BaseAddress}/ver1/accounts/market_pairs?market_code={marketCode}";

            using (var request = XCommasRequest.Get(path))
            {
                return(await this.GetResponse <string[]>(request).ConfigureAwait(false));
            }
        }
Exemplo n.º 16
0
        public async Task <XCommasResponse <GridBot[]> > GetGridBotsAsync(int limit = 10, int?offset = null, int[] accountIds = null, string accountTypes = null, BotScope botState = BotScope.Enabled, string sortBy = "bot_id", string sortDirection = "asc")
        {
            var path = $"{BaseAddress}/ver1/grid_bots?limit={limit}&offset={offset}&state={botState.GetEnumMemberAttrValue()}&sort_by={sortBy}&sort_direction={sortDirection}";

            using (var request = XCommasRequest.Get(path).Sign(this))
            {
                return(await this.GetResponse <GridBot[]>(request).ConfigureAwait(false));
            }
        }
Exemplo n.º 17
0
        public async Task <XCommasResponse <SmartTrade> > GetSmartTradeAsync(int id)
        {
            var path = $"{BaseAddress}/v2/smart_trades/{id}";

            using (var request = XCommasRequest.Get(path).Force(UserMode).Sign(this))
            {
                return(await this.GetResponse <SmartTrade>(request).ConfigureAwait(false));
            }
        }
Exemplo n.º 18
0
        public async Task <XCommasResponse <Bot[]> > GetBotsAsync(int limit = 50, int?offset = null, int?accountId = null, int?botId = null, BotScope?botScope = null, Strategy?strategy = null)
        {
            var path = $"{BaseAddress}/ver1/bots?limit={limit}&offset={offset}&account_id={accountId}&bot_id={botId}";

            if (botScope.HasValue)
            {
                path += $"&scope={botScope.GetEnumMemberAttrValue()}";
            }
            if (strategy.HasValue)
            {
                path += $"&strategy={strategy.GetEnumMemberAttrValue()}";
            }

            using (var request = XCommasRequest.Get(path).Force(UserMode).Sign(this))
            {
                return(await this.GetResponse <Bot[]>(request).ConfigureAwait(false));
            }
        }
Exemplo n.º 19
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));
            }
        }