示例#1
0
        public override bool OnExecution()
        {
            try
            {
                MxcConnectorNode mxcConnector = this.InParameters["connection"].GetValue() as MxcConnectorNode;
                decimal          quantity     = decimal.Parse(this.InParameters["quantity"].GetValue().ToString(), CultureInfo.InvariantCulture);

                Dictionary <string, string> param = new Dictionary <string, string>();
                param.Add("symbol", this.InParameters["symbol"].GetValue().ToString());
                param.Add("depth", "1");

                var result = mxcConnector.Client.Get <MarketPriceEntity>("/open/api/v2/market/depth", param);
                var price  = result.data.asks[0].price.ToString().Replace(",", ".");
                param.Clear();
                param.Add("symbol", this.InParameters["symbol"].GetValue().ToString());
                param.Add("price", price);
                param.Add("quantity", this.InParameters["quantity"].GetValue().ToString());
                param.Add("trade_type", "BID");
                param.Add("order_type", "IMMEDIATE_OR_CANCEL");

                result = mxcConnector.Client.Post <dynamic>("/open/api/v2/order/place", param, true);



                this.OutParameters["orderId"].SetValue(result.data);
                this.OutParameters["result"].SetValue(true);
            }
            catch (Exception ex)
            {
                this.InParameters["result"].SetValue(false);
                return(false);
            }

            return(true);
        }
示例#2
0
        public override bool OnExecution()
        {
            try
            {
                MxcConnectorNode mxcConnector = this.InParameters["connection"].GetValue() as MxcConnectorNode;;

                Dictionary <string, string> param = new Dictionary <string, string>();
                param.Add("symbol", this.InParameters["symbol"].GetValue().ToString());
                param.Add("price", this.InParameters["price"].GetValue().ToString());
                param.Add("quantity", this.InParameters["quantity"].GetValue().ToString());
                param.Add("trade_type", "BID");
                param.Add("order_type", "LIMIT_ORDER");

                var result = mxcConnector.Client.Post <dynamic>("/open/api/v2/order/place", param, true);

                this.OutParameters["orderId"].SetValue(result.data);
                this.OutParameters["result"].SetValue(true);
            }
            catch (Exception ex)
            {
                this.InParameters["result"].SetValue(false);
                return(false);
            }

            return(true);
        }
        public override bool OnExecution()
        {
            MxcConnectorNode connector = this.InParameters["mxc"].GetValue() as MxcConnectorNode;

            var result = connector.Client.Get <BalanceEntity>("/open/api/v2/account/info", new Dictionary <string, string>(), true);

            this.OutParameters["data"].SetValue(result.data.ToString());
            return(true);
        }
示例#4
0
        public override bool OnExecution()
        {
            MxcConnectorNode            connector = this.InParameters["mxc"].GetValue() as MxcConnectorNode;
            Dictionary <string, string> param     = new Dictionary <string, string>();

            param.Add("symbol", this.InParameters["symbol"].GetValue().ToString());
            param.Add("depth", "1");

            var result = connector.Client.Get <MarketPriceEntity>("/open/api/v2/market/depth", param);

            this.OutParameters["ask_price"].SetValue(result.data.asks[0].price);
            this.OutParameters["ask_quantity"].SetValue(result.data.asks[0].quantity);

            this.OutParameters["bid_price"].SetValue(result.data.bids[0].price);
            this.OutParameters["bid_quantity"].SetValue(result.data.bids[0].quantity);

            return(true);
        }