Esempio n. 1
0
        public void CloseFromLong(OrderTestParameters parameters)
        {
            Log.Trace("");
            Log.Trace("CLOSE FROM LONG");
            Log.Trace("");
            // first go long
            PlaceZerodhaOrderWaitForStatus(parameters.CreateLongMarketOrder(GetDefaultQuantity()), OrderStatus.Filled);

            // now close it
            PlaceZerodhaOrderWaitForStatus(parameters.CreateShortOrder(GetDefaultQuantity()), parameters.ExpectedStatus);
        }
Esempio n. 2
0
        public void ReturnShortOrderTakerFees(OrderTestParameters parameters)
        {
            IFeeModel feeModel = new BitfinexFeeModel();

            Order order = parameters.CreateShortOrder(Quantity);
            var   price = order.Type == OrderType.Limit ? ((LimitOrder)order).LimitPrice : LowPrice;

            Assert.AreEqual(
                BitfinexFeeModel.TakerFee * price * Math.Abs(Quantity),
                feeModel.GetOrderFee(Security, order));
        }
        public void ReturnShortOrderMakerFees(OrderTestParameters parameters)
        {
            IFeeModel feeModel = new BitfinexFeeModel();

            Order order = parameters.CreateShortOrder(Quantity);
            var   price = order.Type == OrderType.Limit ? ((LimitOrder)order).LimitPrice : LowPrice;
            var   fee   = feeModel.GetOrderFee(new OrderFeeParameters(Security, order));

            Assert.AreEqual(
                BitfinexFeeModel.MakerFee * price * Math.Abs(Quantity), fee.Value.Amount);
            Assert.AreEqual(Currencies.USD, fee.Value.Currency);
        }
Esempio n. 4
0
        public void ReturnShortOrderCustomTakerFees(decimal mFee, decimal tFee, OrderTestParameters parameters)
        {
            IFeeModel feeModel = new BinanceFeeModel(mFee, tFee);

            var order = parameters.CreateShortOrder(Quantity);
            var price = order.Type == OrderType.Limit ? ((LimitOrder)order).LimitPrice : LowPrice;
            var fee   = feeModel.GetOrderFee(new OrderFeeParameters(Security, order));

            Assert.AreEqual(
                tFee * price * Math.Abs(Quantity),
                fee.Value.Amount);
            Assert.AreEqual("USDT", fee.Value.Currency);
        }
Esempio n. 5
0
        public void ReturnShortOrderTakerFees(OrderTestParameters parameters)
        {
            IFeeModel feeModel = new KrakenFeeModel();

            Order order = parameters.CreateShortOrder(Quantity);
            var   price = order.Type == OrderType.Limit ? ((LimitOrder)order).LimitPrice : LowPrice;
            var   fee   =
                feeModel.GetOrderFee(new OrderFeeParameters(Security, order));

            Assert.AreEqual(
                KrakenFeeModel.TakerTier1CryptoFee * 1 * Math.Abs(Quantity), fee.Value.Amount);
            Assert.AreEqual("ETH", fee.Value.Currency);
        }
Esempio n. 6
0
        public virtual void ShortFromLong(OrderTestParameters parameters)
        {
            Log.Trace("");
            Log.Trace("SHORT FROM LONG");
            Log.Trace("");
            // first go long
            PlaceZerodhaOrderWaitForStatus(parameters.CreateLongMarketOrder(GetDefaultQuantity()));

            // now go net short
            var order = PlaceZerodhaOrderWaitForStatus(parameters.CreateShortOrder(2 * GetDefaultQuantity()), parameters.ExpectedStatus);

            if (parameters.ModifyUntilFilled)
            {
                ModifyOrderUntilFilled(order, parameters);
            }
        }