Пример #1
0
        private CommandFactory()
        {
            Build();

            var param = new List <ExchangeParameter>
            {
                new ExchangeParameter(ParameterMethod.Url, "base", StandardParameter.Base),
                new ExchangeParameter(ParameterMethod.Url, "counter", StandardParameter.Counter)
            };

            Tick = new TickCommand(
                Method.GET,
                new Uri("products/{base}-{counter}/ticker", UriKind.Relative),
                false,
                typeof(TickModel),
                param);

            param = new List <ExchangeParameter>
            {
                new ExchangeParameter(ParameterMethod.Url, "base", StandardParameter.Base),
                new ExchangeParameter(ParameterMethod.Url, "counter", StandardParameter.Counter)
            };


            param = new List <ExchangeParameter>
            {
                new ExchangeParameter(ParameterMethod.Url, "base", StandardParameter.Base),
                new ExchangeParameter(ParameterMethod.Url, "counter", StandardParameter.Counter)
            };

            OrderBook = new OrderBookCommand(
                Method.GET,
                new Uri("products/{base}-{counter}/book?level=2", UriKind.Relative),
                false,
                typeof(OrderBookModel),
                param);

            // /products/<product-id>/trades

            param = new List <ExchangeParameter>
            {
                new ExchangeParameter(ParameterMethod.Url, "base", StandardParameter.Base),
                new ExchangeParameter(ParameterMethod.Url, "counter", StandardParameter.Counter)
            };

            Transactions = new TransactionsCommand(
                Method.GET,
                new Uri("products/{base}-{counter}/trades", UriKind.Relative),
                false,
                typeof(List <TransactionModel>),
                param);

            AccountBalance = new AccountBalanceCommand(
                Method.GET,
                new Uri("accounts", UriKind.Relative),
                true,
                typeof(List <AccountBalanceModel>));

            OpenOrders = new OpenOrdersCommand(
                Method.GET,
                new Uri("orders", UriKind.Relative),
                true,
                typeof(List <OpenOrderModel>));

            UserTransactions = new UserTransactionsCommand(
                Method.GET,
                new Uri("fills", UriKind.Relative),
                true,
                typeof(List <UserTransactionModel>));
        }
        public async Task <IActionResult> B2cTransact([FromBody] AccountBalanceCommand b2CRequest)
        {
            var result = await _mediator.Send(b2CRequest);

            return(result != null ? (IActionResult)Ok(result) : NotFound());
        }