示例#1
0
        public void PlaceOrders(decimal quantity, decimal currrentClose, StrategyOutput strategyOutput, StrategyData strategyData)
        {
            BinancePlacedOrder placedOrder = null;

            if (strategyOutput == StrategyOutput.OpenPositionWithBuy || strategyOutput == StrategyOutput.ExitPositionWithBuy ||
                strategyOutput == StrategyOutput.BookProfitWithBuy || strategyOutput == StrategyOutput.MissedPositionBuy ||
                strategyOutput == StrategyOutput.ExitPositionHeavyLossWithBuy)
            {
                placedOrder = webCall.PlaceBuyOrder(quantity, -1, true);
            }

            else if (strategyOutput == StrategyOutput.OpenPositionWithSell || strategyOutput == StrategyOutput.ExitPositionWithSell ||
                     strategyOutput == StrategyOutput.BookProfitWithSell || strategyOutput == StrategyOutput.MissedPositionSell ||
                     strategyOutput == StrategyOutput.ExitPositionHeavyLossWithSell)
            {
                placedOrder = webCall.PlaceSellOrder(quantity, -1, true);
            }

            else if (strategyOutput == StrategyOutput.EscapeTrapWithBuy)
            {
                if (BinanceBotSettings.settings.ReOpenOnEscape)
                {
                    placedOrder = webCall.PlaceBuyOrder(quantity * 2, -1, true);
                }
                else
                {
                    placedOrder = webCall.PlaceBuyOrder(quantity, -1, true);
                }
            }

            else if (strategyOutput == StrategyOutput.EscapeTrapWithSell)
            {
                if (BinanceBotSettings.settings.ReOpenOnEscape)
                {
                    placedOrder = webCall.PlaceSellOrder(quantity * 2, -1, true);
                }
                else
                {
                    placedOrder = webCall.PlaceSellOrder(quantity, -1, true);
                }
            }
            else
            {
                //no action
            }

            if (placedOrder != null)
            {
                DumpToLog(currrentClose, strategyOutput.ToString(), strategyData);
            }
        }