示例#1
0
 public void BuildCommands()
 {
     AccountBalance   = BuildAccountBalanceCommand();
     BuyOrder         = BuildBuyOrderCommand();
     CancelOrder      = BuildCancelOrderCommand();
     OpenOrders       = BuildOpenOrdersCommand();
     OrderBook        = BuildOrderBookCommand();
     SellOrder        = BuildSellOrderCommand();
     Tick             = BuildTickCommand();
     Transactions     = BuildTransactionsCommand();
     UserTransactions = BuildUserTransactionsCommand();
 }
示例#2
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>));
        }