public TradeTickerViewModel(IBtceModels btceModels, BtcePairEnum pair)
 {
     this.btceModels = btceModels;
     this.pair       = pair;
     Trades          = new List <IMarketTrade>();
     this.btceModels.MarketTradesUpdated += btceModels_MarketTradesUpdated;
 }
示例#2
0
        public decimal GetAmountFromEnum(BtcePairEnum Pair)
        {
            switch (Pair)
            {
            case BtcePairEnum.ltc_usd:
                return(LtcAmount);

                break;

            case BtcePairEnum.nmc_usd:
                return(NmcAmount);

                break;

            case BtcePairEnum.btc_usd:
                return(BtcAmount);

                break;

            case BtcePairEnum.ftc_btc:
                return(FtcAmount);

                break;

            default:
                return(1);

                break;
            }
        }
 public TradeTickerViewModel(IBtceModels btceModels, BtcePairEnum pair)
 {
     this.btceModels = btceModels;
     this.pair = pair;
     Trades = new List<IMarketTrade>();
     this.btceModels.MarketTradesUpdated += btceModels_MarketTradesUpdated;
 }
        public MarketDepthViewModel(IBtceModels btceModels, IConfiguration configuration, IBtceTradeApi btceTradeApi, ITradingConfigurations tradingConfigurations, BtcePairEnum pair)
        {
            this.CurrentPair = pair;
            this.btceModels = btceModels;
            this.configuration = configuration;
            this.btceTradeApi = btceTradeApi;
            this.tradingConfigurations = tradingConfigurations;
            this.paneTitle = "Depth: " + CurrentPair.ToString();

            AggregatedAsks = new List<IDepthOrderInfo>();
            AggregatedBids = new List<IDepthOrderInfo>();
            Asks = new List<IDepthOrderInfo>();
            Bids = new List<IDepthOrderInfo>();
            MarketMakerViewModel = new MarketMakerViewModel(CurrentPair, btceModels);
            TradeTickerViewModel = new TradeTickerViewModel(btceModels, CurrentPair);

            btceModels.DepthUpdated += btceModels_DepthUpdated;

            AskDoubbleClickCommand = new RelayCommand((tradeClickParameters) =>
                {
                    ShowTradeWindow(((IDepthOrderInfo)tradeClickParameters).Price, TradeTypeEnum.Sell);
                });

            BidsDoubbleClickCommand = new RelayCommand((tradeClickParameters) =>
            {
                ShowTradeWindow(((IDepthOrderInfo)tradeClickParameters).Price, TradeTypeEnum.Buy);
            });
        }
        public decimal GetAmountFromEnum(BtcePairEnum Pair)
        {
            switch (Pair)
            {
                case BtcePairEnum.ltc_usd:
                    return LtcAmount;
                    break;

                case BtcePairEnum.nmc_usd:
                    return NmcAmount;
                    break;

                case BtcePairEnum.btc_usd:
                    return BtcAmount;
                    break;

                case BtcePairEnum.ftc_btc:
                    return FtcAmount;
                    break;

                default:
                    return 1;
                    break;
            }
        }
        public MarketMakerViewModel(BtcePairEnum pair, IBtceModels models)
        {
            this.pair   = pair;
            this.models = models;

            ObservingSituation        = new MarketMakingSituation();
            this.models.DepthUpdated += models_DepthUpdated;
        }
        public MarketMakerViewModel(BtcePairEnum pair, IBtceModels models)
        {
            this.pair = pair;
            this.models = models;

            ObservingSituation = new MarketMakingSituation();
            this.models.DepthUpdated += models_DepthUpdated;
        }
示例#8
0
        public static BtcePairEnum FromString(string s)
        {
            BtcePairEnum ret = BtcePairEnum.Unknown;

            if (!Enum.TryParse <BtcePairEnum>(s.ToLowerInvariant(), out ret))
            {
                throw new InvalidOperationException(string.Format("Cannot parse {0} to BtcePairEnum", s));
            }


            return(ret);
        }
        public decimal CalculateAmount(BtcePairEnum pair, TradeTypeEnum tradeType, decimal CurrentHoldings)
        {
            decimal toReturn = 1;

            var tradeConf = DefaultTradingSizes.Find(a => a.Pair == pair && a.TradeType == tradeType);
            if (tradeConf == null)
                return toReturn;

            switch (tradeConf.TradeSizeType)
            {
                case DefaultTradingSizeType.FixedAmount:
                    toReturn = tradeConf.FixedAmount;
                    break;

                case DefaultTradingSizeType.PercentageOfCurrentHoldings:
                    toReturn = ((CurrentHoldings / 100) * tradeConf.PercentageOfCurrentHoldings);
                    break;
            }

            return toReturn;
        }
        public decimal CalculateAmount(BtcePairEnum pair, TradeTypeEnum tradeType, decimal CurrentHoldings)
        {
            decimal toReturn = 1;

            var tradeConf = DefaultTradingSizes.Find(a => a.Pair == pair && a.TradeType == tradeType);

            if (tradeConf == null)
            {
                return(toReturn);
            }

            switch (tradeConf.TradeSizeType)
            {
            case DefaultTradingSizeType.FixedAmount:
                toReturn = tradeConf.FixedAmount;
                break;

            case DefaultTradingSizeType.PercentageOfCurrentHoldings:
                toReturn = ((CurrentHoldings / 100) * tradeConf.PercentageOfCurrentHoldings);
                break;
            }

            return(toReturn);
        }
示例#11
0
        public MarketDepthViewModel(IBtceModels btceModels, IConfiguration configuration, IBtceTradeApi btceTradeApi, ITradingConfigurations tradingConfigurations, BtcePairEnum pair)
        {
            this.CurrentPair           = pair;
            this.btceModels            = btceModels;
            this.configuration         = configuration;
            this.btceTradeApi          = btceTradeApi;
            this.tradingConfigurations = tradingConfigurations;
            this.paneTitle             = "Depth: " + CurrentPair.ToString();

            AggregatedAsks       = new List <IDepthOrderInfo>();
            AggregatedBids       = new List <IDepthOrderInfo>();
            Asks                 = new List <IDepthOrderInfo>();
            Bids                 = new List <IDepthOrderInfo>();
            MarketMakerViewModel = new MarketMakerViewModel(CurrentPair, btceModels);
            TradeTickerViewModel = new TradeTickerViewModel(btceModels, CurrentPair);

            btceModels.DepthUpdated += btceModels_DepthUpdated;

            AskDoubbleClickCommand = new RelayCommand((tradeClickParameters) =>
            {
                ShowTradeWindow(((IDepthOrderInfo)tradeClickParameters).Price, TradeTypeEnum.Sell);
            });

            BidsDoubbleClickCommand = new RelayCommand((tradeClickParameters) =>
            {
                ShowTradeWindow(((IDepthOrderInfo)tradeClickParameters).Price, TradeTypeEnum.Buy);
            });
        }
示例#12
0
 public static string ToString(BtcePairEnum v)
 {
     return(Enum.GetName(typeof(BtcePairEnum), v).ToLowerInvariant());
 }
 public static string ToString(BtcePairEnum v)
 {
     return Enum.GetName(typeof(BtcePairEnum), v).ToLowerInvariant();
 }