Example #1
0
        public BaseExchangeData ReadExcel(string filePath, TRANSACTION_TYPE type)
        {
            try {
                using (StreamReader sr = new StreamReader(filePath)) {
                    sr.ReadLine(); //Descarte de la primera line de cabecera

                    string line = string.Empty;
                    while (!sr.EndOfStream)
                    {
                        line = sr.ReadLine();

                        switch (type)
                        {
                        case TRANSACTION_TYPE.BUY:
                        case TRANSACTION_TYPE.SELL:
                            transactions.Add(new BinanceTransactionData(line));
                            break;

                        case TRANSACTION_TYPE.DEPOSIT:
                        case TRANSACTION_TYPE.WITHDRAW:
                            depositWithdraws.Add(new BinanceDepositWithdrawData(line));
                            break;
                        }
                    }
                }
            } catch (Exception e) {
                Console.WriteLine("The File could not be read:");
                Console.WriteLine(e.Message);
                Console.ReadLine();
            }
            Console.WriteLine(Path.GetFileName(filePath));
            return(null);
        }
        /// <summary>
        /// 为市价单定单信息赋值
        /// </summary>
        /// <param name="type">定单类型,买跌或买涨</param>
        private void AssignmentOrderInfo(TRANSACTION_TYPE type)
        {
            ProductInformation selectedPt = SelectedProduct;

            _newOrderInfo.AllowMaxPriceDeviation = (CbDeviation.IsChecked == true ? AllowMaxPriceDiff : 0);
            _newOrderInfo.Count               = Count;
            _newOrderInfo.MAC                 = MacAddress.LocalMAC;
            _newOrderInfo.OrderType           = type;
            _newOrderInfo.PercentageOfDeposit = selectedPt.PercentageOfDeposit;
            _newOrderInfo.ProductCode         = selectedPt.ProductCode;
            _newOrderInfo.RealTimeTime        = selectedPt.RealTimeTime;
            _newOrderInfo.RealTimePrice       = (type == TRANSACTION_TYPE.Order ? selectedPt.OrderPrice : selectedPt.RecoveryPrice);
            _newOrderInfo.StopLossPrice       = (EnableStopLoss ? DataDigitFilter.FilterDouble(StopLoss, selectedPt.SpreadDigit) : 0);
            _newOrderInfo.StopProfitPrice     = (EnableStopProfit ? DataDigitFilter.FilterDouble(StopProfit, selectedPt.SpreadDigit) : 0);
        }
Example #3
0
        /// <summary>
        /// Assignment pending order information.
        /// </summary>
        /// <param name="type">transaction type</param>
        private void AssignmentOrderInfo(TRANSACTION_TYPE type)
        {
            ProductInformation selectedData = SelectedProduct;

            _newOrderInfo.Count               = Count;
            _newOrderInfo.DueDate             = DueDate;
            _newOrderInfo.MAC                 = MacAddress.LocalMAC;
            _newOrderInfo.OrderType           = type;
            _newOrderInfo.PendingOrdersPrice  = PendingOrderPrice;
            _newOrderInfo.PercentageOfDeposit = selectedData.PercentageOfDeposit;
            _newOrderInfo.ProductCode         = selectedData.ProductCode;
            _newOrderInfo.RealTimeTime        = selectedData.RealTimeTime;
            _newOrderInfo.RealTimePrice       = (type == TRANSACTION_TYPE.Order ? selectedData.OrderPrice : selectedData.RecoveryPrice);
            _newOrderInfo.StopLossPrice       = (EnableStopLoss ? DataDigitFilter.FilterDouble(StopLoss, selectedData.SpreadDigit) : 0);
            _newOrderInfo.StopProfitPrice     = (EnableStopProfit ? DataDigitFilter.FilterDouble(StopProfit, selectedData.SpreadDigit) : 0);
        }
        /// <summary>
        /// 为市价单定单信息赋值
        /// </summary>
        /// <param name="type">定单类型,买跌或买涨</param>
        private void AssignmentOrderInfo( TRANSACTION_TYPE type ) {
            ProductInformation selectedPt = SelectedProduct;

            _newOrderInfo.AllowMaxPriceDeviation = ( CbDeviation.IsChecked == true ? AllowMaxPriceDiff : 0 );
            _newOrderInfo.Count = Count;
            _newOrderInfo.MAC = MacAddress.LocalMAC;
            _newOrderInfo.OrderType = type;
            _newOrderInfo.PercentageOfDeposit = selectedPt.PercentageOfDeposit;
            _newOrderInfo.ProductCode = selectedPt.ProductCode;
            _newOrderInfo.RealTimeTime = selectedPt.RealTimeTime;
            _newOrderInfo.RealTimePrice = ( type == TRANSACTION_TYPE.Order ? selectedPt.OrderPrice : selectedPt.RecoveryPrice );
            _newOrderInfo.StopLossPrice = ( EnableStopLoss ? DataDigitFilter.FilterDouble( StopLoss, selectedPt.SpreadDigit ) : 0 );
            _newOrderInfo.StopProfitPrice = ( EnableStopProfit ? DataDigitFilter.FilterDouble( StopProfit, selectedPt.SpreadDigit ) : 0 );
        }
Example #5
0
 private static string GetStringType(TRANSACTION_TYPE type)
 {
     return(Enum.GetName(typeof(TRANSACTION_TYPE), type).Replace('_', ' '));
 }
        /// <summary>
        /// Assignment pending order information.
        /// </summary>
        /// <param name="type">transaction type</param>
        private void AssignmentOrderInfo( TRANSACTION_TYPE type ) {
            ProductInformation selectedData = SelectedProduct;

            _newOrderInfo.Count = Count;
            _newOrderInfo.DueDate = DueDate;
            _newOrderInfo.MAC = MacAddress.LocalMAC;
            _newOrderInfo.OrderType = type;
            _newOrderInfo.PendingOrdersPrice = PendingOrderPrice;
            _newOrderInfo.PercentageOfDeposit = selectedData.PercentageOfDeposit;
            _newOrderInfo.ProductCode = selectedData.ProductCode;
            _newOrderInfo.RealTimeTime = selectedData.RealTimeTime;
            _newOrderInfo.RealTimePrice = ( type == TRANSACTION_TYPE.Order ? selectedData.OrderPrice : selectedData.RecoveryPrice );
            _newOrderInfo.StopLossPrice = ( EnableStopLoss ? DataDigitFilter.FilterDouble( StopLoss, selectedData.SpreadDigit ) : 0 );
            _newOrderInfo.StopProfitPrice = ( EnableStopProfit ? DataDigitFilter.FilterDouble( StopProfit, selectedData.SpreadDigit ) : 0 );
        }