Beispiel #1
0
        public override bool OnExecution()
        {
            BinanceConnectorNode binanceConnector = this.InParameters["connection"].GetValue() as BinanceConnectorNode;
            var result = binanceConnector.Client.FuturesUsdt.Market.GetKlines(this.InParameters["symbol"].GetValue().ToString(), global::Binance.Net.Enums.KlineInterval.OneHour);

            RSI         rsi      = new RSI(30);
            List <Ohlc> ohlcList = new List <Ohlc>();

            foreach (var candle in result.Data)
            {
                ohlcList.Add(new Ohlc()
                {
                    Date     = candle.CloseTime,
                    Open     = (double)candle.Open,
                    High     = (double)candle.High,
                    Low      = (double)candle.Low,
                    Close    = (double)candle.Close,
                    Volume   = (double)candle.QuoteVolume,
                    AdjClose = 1
                });
            }
            rsi.Load(ohlcList);
            var serie = rsi.Calculate();

            this.OutParameters["RSI"].SetValue(serie.RSI.LastOrDefault());
            return(true);
        }
        public override bool OnExecution()
        {
            BinanceConnectorNode binanceConnector = this.InParameters["connection"].GetValue() as BinanceConnectorNode;

            this.OutParameters["averagePrice"].SetValue((double)binanceConnector.Client.Spot.Market.GetCurrentAvgPrice(this.InParameters["symbol"].GetValue().ToString()).Data.Price);
            return(true);
        }
Beispiel #3
0
        public override bool OnExecution()
        {
            BinanceConnectorNode binanceConnector = this.InParameters["connection"].GetValue() as BinanceConnectorNode;
            var result = binanceConnector.Client.Spot.Market.Get24HPrice(this.InParameters["symbol"].GetValue().ToString());

            this.OutParameters["baseVolume"].SetValue((double)result.Data.BaseVolume);
            this.OutParameters["quoteVolume"].SetValue((double)result.Data.QuoteVolume);

            return(true);
        }
        public override bool OnExecution()
        {
            BinanceConnectorNode binanceConnector = this.InParameters["connection"].GetValue() as BinanceConnectorNode;
            var result = binanceConnector.Client.Spot.Market.GetKlines(this.InParameters["symbol"].GetValue().ToString(), global::Binance.Net.Enums.KlineInterval.ThirtyMinutes);

            var rsi = this.CalculateRsi(result.Data.Select(x => (double)x.Close).ToList());

            this.OutParameters["RSI"].SetValue(rsi);
            return(true);
        }
        public override void SetupEvent()
        {
            BinanceConnectorNode binanceConnector = this.InParameters["connection"].GetValue() as BinanceConnectorNode;

            binanceConnector.SocketClient.Spot.SubscribeToBookTickerUpdates(this.InParameters["symbol"].GetValue().ToString(), (data) =>
            {
                var instanciatedParameters = this.InstanciateParametersForCycle();
                instanciatedParameters["bestAskPrice"].SetValue((double)data.BestAskPrice);
                instanciatedParameters["bestAskQuantity"].SetValue((double)data.BestAskQuantity);
                instanciatedParameters["bestBidPrice"].SetValue((double)data.BestBidPrice);
                instanciatedParameters["bestBidQuantity"].SetValue((double)data.BestBidQuantity);
                this.Graph.AddCycle(this, instanciatedParameters);
            });
        }
Beispiel #6
0
        public override bool OnExecution()
        {
            try
            {
                BinanceConnectorNode binanceConnector = this.InParameters["connection"].GetValue() as BinanceConnectorNode;
                decimal quantity = decimal.Parse(this.InParameters["quantity"].GetValue().ToString(), CultureInfo.InvariantCulture);
                var     order    = binanceConnector.Client.Spot.Order.PlaceOrder(this.InParameters["symbol"].GetValue().ToString(), global::Binance.Net.Enums.OrderSide.Sell, global::Binance.Net.Enums.OrderType.Market, quantity: quantity);
                this.OutParameters["orderId"].SetValue(order.Data.OrderId);
                this.OutParameters["price"].SetValue(order.Data.Price);
                this.OutParameters["result"].SetValue(order.Success);
            }
            catch (Exception ex)
            {
                this.InParameters["result"].SetValue(false);
                return(false);
            }

            return(true);
        }