示例#1
0
        private Dictionary <string, object> CreatePoloniexBody(PoloniexBodyType bodyType)
        {
            var body = new Dictionary <string, object> {
                { "nonce", BaseAuthenticator.GetLongNonce() }
            };

            switch (bodyType)
            {
            case PoloniexBodyType.ReturnBalances:
                body.Add("command", "returnBalances");
                break;

            case PoloniexBodyType.ReturnCompleteBalances:
                body.Add("command", "returnCompleteBalances");
                break;

            case PoloniexBodyType.ReturnDepositAddresses:
                body.Add("command", "returnDepositAddresses");
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(bodyType), bodyType, null);
            }

            return(body);
        }
示例#2
0
        public WebProviderConnector Create()
        {
            var credentials = _manager.Credentials;

            var agressoAuthenticator = new AgressoAuthenticator()
            {
                Password = credentials.Password
            };
            var authenticators = new BaseAuthenticator[] { agressoAuthenticator };

            if (_config.Url == null)
            {
                throw new ApplicationException("The Unit4 SOAP service URL is not set in the config file.");
            }

            var connector = new WebProviderConnector()
            {
                Name           = "WebService",
                Authenticators = authenticators,
                Authenticator  = agressoAuthenticator,
                Datasource     = _config.Url
            };

            agressoAuthenticator.Name   = credentials.Username;
            agressoAuthenticator.Client = _config.Client.ToString();

            return(connector);
        }
示例#3
0
        private Dictionary <string, object> CreateKrakenBody()
        {
            var body  = new Dictionary <string, object>();
            var nonce = BaseAuthenticator.GetLongNonce();

            body.Add("nonce", nonce);

            return(body);
        }
示例#4
0
        private Dictionary <string, object> CreatePoloniexBody(PoloniexBodyType bodyType)
        {
            var body = new Dictionary <string, object> {
                { "nonce", BaseAuthenticator.GetLongNonce() }
            };

            switch (bodyType)
            {
            case PoloniexBodyType.ReturnBalances:
                body.Add("command", "returnBalances");
                break;

            case PoloniexBodyType.ReturnCompleteBalances:
                body.Add("command", "returnCompleteBalances");
                break;

            case PoloniexBodyType.ReturnDepositAddresses:
                body.Add("command", "returnDepositAddresses");
                break;

            case PoloniexBodyType.LimitOrderBuy:
                body.Add("command", "buy");
                break;

            case PoloniexBodyType.LimitOrderSell:
                body.Add("command", "sell");
                break;

            case PoloniexBodyType.ReturnOrderStatus:
                body.Add("command", "returnOrderTrades");
                break;

            case PoloniexBodyType.ReturnOpenOrders:
                body.Add("command", "returnOpenOrders");
                break;

            case PoloniexBodyType.ReturnTradeHistory:
                body.Add("command", "returnTradeHistory");
                break;

            case PoloniexBodyType.CancelOrder:
                body.Add("command", "cancelOrder");
                break;

            case PoloniexBodyType.Withdraw:
                body.Add("command", "withdraw");
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(bodyType), bodyType, null);
            }

            return(body);
        }