コード例 #1
0
        public void CheckPairedName()
        {
            if (Qname.EndsWith("/1"))
            {
                PairIndex = 1;
                PairName  = Qname.Substring(0, Qname.Length - 2);
            }
            else if (Qname.EndsWith("/2"))
            {
                PairIndex = 2;
                PairName  = Qname.Substring(0, Qname.Length - 2);
            }
            else if (Flags.HasFlag(SAMFlags.FirstReadInPair))
            {
                PairIndex = 1;
                PairName  = Qname;
            }
            else if (Flags.HasFlag(SAMFlags.SecondReadInPair))
            {
                PairIndex = 2;
                PairName  = Qname;
            }
            else
            {
                throw new ArgumentException(string.Format("Query name is not in pair format (should be end with /1 or /2): {0}", Qname));
            }

            if (PairName.EndsWith("#0"))
            {
                PairName = PairName.Substring(0, PairName.Length - 2);
            }
        }
コード例 #2
0
        public Bot4ViewModel(PairName pairName)
        {
            DirectionStrong = 51;
            UnLockInput     = true;
            var directionArray = Enum.GetValues(typeof(Direction));

            DirectionList = new List <Direction>();
            foreach (Direction item in directionArray)
            {
                DirectionList.Add(item);
            }

            _startAction = new Action(() => {
                switch (Account1.SelectedPlatform)
                {
                case Platform.HitBTC:
                    _model.startWork(
                        new HitBtcClient(Account1.ApiKey, Account1.ApiSecret, pairName),
                        Ident, Depth, Volume,
                        OrderSpace, DirectionStrong, Range, _ct);
                    break;
                }
            });
            _stopAction = new Action(() => {
                _ts.Cancel();
                Task.WaitAny(_startTask);
                Task.Run(() => {
                    _model.stopWork();
                }).Wait();
                RaisePropertyChanged();
                return;
            });

            _model.PropertyChanged += (s, e) => { if (e.PropertyName.Equals("Log"))
                                                  {
                                                      Log = (s as Bot4Model).Log;
                                                  }
            };
            _model.PropertyChanged += (s, e) => { if (e.PropertyName.Equals("MyAskVolume"))
                                                  {
                                                      MyAskVolume = (s as Bot4Model).MyAskVolume;
                                                  }
            };
            _model.PropertyChanged += (s, e) => { if (e.PropertyName.Equals("MyBidVolume"))
                                                  {
                                                      MyBidVolume = (s as Bot4Model).MyBidVolume;
                                                  }
            };
            _model.PropertyChanged += (s, e) => { if (e.PropertyName.Equals("MyOrdersCount"))
                                                  {
                                                      MyOrdersCount = (s as Bot4Model).MyOrdersCount;
                                                  }
            };
            _model.PropertyChanged += (s, e) => { if (e.PropertyName.Equals("MyTotalVolume"))
                                                  {
                                                      MyTotalVolume = (s as Bot4Model).MyTotalVolume;
                                                  }
            };
        }
コード例 #3
0
        // token id: 1061087
        // token secret: iZOgflUeF2uRFIYvBkfUvKJq9W/UzeLxvTJT6lcp2NZrGc2JoBxV9KVqYEhU5tWtdaZKi5LsG+1LVYTUlvoAoQ==

        /*
         *
         * wmWjP6JDuc3nZDL+qtL6Rhk8T5EOPtr/30m3XvGbHYNHydodV39AVOwTcTosej9tSLVXOxMuAbSIzdiWxJdwjw==
         *
         * 1063807
         *
         */

        public LiquidClient(string apiKey, string apiSecret, PairName pairName)
        {
            _option = new LiquidQuoineClientOptions()
            {
                ApiCredentials = new ApiCredentials(apiKey, apiSecret)
            };
            _api = new LiquidQuoineClient(_option);
            setPairName(pairName);
        }
コード例 #4
0
        public void setPairName(PairName pairName)
        {
            var result = _api.GetAllProducts();

            switch (pairName)
            {
            case PairName.ETHADH:
                foreach (var item in result.Data)
                {
                    if (item.CurrencyPairCode == "ADHETH")
                    {
                        _symbol = new Symbol(
                            item.QuotedCurrency,
                            item.BaseCurrency,
                            // TODO количество знаков после запятой пересчитать
                            0.00000001f,
                            100
                            );
                        _productId = item.Id;
                        _pairName  = item.CurrencyPairCode;
                    }
                }
                break;

            case PairName.BTCADH:
                foreach (var item in result.Data)
                {
                    if (item.CurrencyPairCode == "ADHBTC")
                    {
                        _symbol = new Symbol(
                            item.QuotedCurrency,
                            item.BaseCurrency,
                            // TODO количество знаков после запятой пересчитать
                            0.00000001f,
                            100
                            );
                        _productId = item.Id;
                        _pairName  = item.CurrencyPairCode;
                    }
                }
                break;
            }
        }
コード例 #5
0
        public void setPairName(PairName pairName)
        {
            switch (pairName)
            {
            case PairName.ETHADH:
                _pairName = "ADHETH";
                break;

            case PairName.BTCADH:
                _pairName = "ADHBTC";
                break;

            case PairName.ETHLRC:
                _pairName = "LRCETH";
                break;

            case PairName.BTCLRC:
                _pairName = "LRCBTC";
                break;
            }
        }
コード例 #6
0
        public Bot1ViewModel(PairName pairName)
        {
            WaitNextDay        = Visibility.Hidden;
            MyTotalLimitVolume = 0;
            MissingPurchases   = 0;
            MissingSales       = 0;
            UnLockInput        = true;
            directionList      = new List <Enum>()
            {
                Direction.Up,
                Direction.Down,
                Direction.Flat
            };
            stopValueList        = new List <int>(Enumerable.Range(1, 10));
            priceShiftValuesList = new List <int>(Enumerable.Range(1, 10));
            Interval             = 1;

            _direction     = Direction.Flat;
            TargetVolume   = 1000000;
            ReservedVolume = 10;
            SwapTime       = 60;
            Interval       = 1;

            _model.PropertyChanged += (s, e) => { if (e.PropertyName == "Log")
                                                  {
                                                      Log = (s as Bot1Model).Log;
                                                  }
            };
            _model.PropertyChanged += (s, e) => { if (e.PropertyName == "BotStarted")
                                                  {
                                                      BotStarted = (s as Bot1Model).BotStarted;
                                                  }
            };
            _model.PropertyChanged += (s, e) => { if (e.PropertyName == "CurrentVolume")
                                                  {
                                                      CurrentVolume = (s as Bot1Model).CurrentVolume;
                                                  }
            };
            _model.PropertyChanged += (s, e) => { if (e.PropertyName == "MyMarketOrderVolume")
                                                  {
                                                      MyMarketOrderVolume = (s as Bot1Model).MyMarketOrderVolume;
                                                  }
            };
            _model.PropertyChanged += (s, e) => { if (e.PropertyName == "MyLimitVolumeClosedByOtherTraders")
                                                  {
                                                      MyLimitVolumeClosedByOtherTraders = (s as Bot1Model).MyLimitVolumeClosedByOtherTraders;
                                                  }
            };
            _model.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == "MyTotalLimitVolume")
                {
                    MyTotalLimitVolume = (s as Bot1Model).MyTotalLimitVolume;
                }
                TotalVolume = MyTotalLimitVolume + OtherMarketOrderVolume;
            };
            _model.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == "OtherMarketOrderVolume")
                {
                    OtherMarketOrderVolume = (s as Bot1Model).OtherMarketOrderVolume;
                }
                TotalVolume = MyTotalLimitVolume + OtherMarketOrderVolume;
            };

            _startAction = new Action(() => {
                BotStarted = true;
                if (Account1.SelectedPlatform != Account2.SelectedPlatform)
                {
                    Log += "\nОшибка. торговая площадка на первом аккаунте отличается от торговой площадки на втором аккаунте.";
                    return;
                }
                switch (Account1.SelectedPlatform)
                {
                case Platform.HitBTC:
                    _model.StartWork(
                        new HitBtcClient(Account1.ApiKey, Account1.ApiSecret, pairName),
                        new HitBtcClient(Account2.ApiKey, Account2.ApiSecret, pairName),
                        _direction,
                        _targetVolume,
                        _swapTime,
                        Interval,
                        _ct);
                    break;

                case Platform.Bistox:
                    _model.StartWork(
                        new BistoxClient(Account1.ApiKey, Account1.ApiSecret, pairName),
                        new BistoxClient(Account2.ApiKey, Account2.ApiSecret, pairName),
                        _direction,
                        _targetVolume,
                        _swapTime,
                        Interval,
                        _ct);
                    break;

                default:
                    _model.StartWork(
                        new LiquidClient(Account1.ApiKey, Account1.ApiSecret, pairName),
                        new LiquidClient(Account2.ApiKey, Account2.ApiSecret, pairName),
                        _direction,
                        _targetVolume,
                        _swapTime,
                        Interval,
                        _ct);
                    break;
                }
            });
            _stopAction = new Action(() => {
                _ts.Cancel();
                Task.WaitAny(_startTask);
                Task.Run(() => {
                    _model.StopWork();
                }).Wait();
                BotStarted = false;
                RaisePropertyChanged();
                return;
            });
        }
コード例 #7
0
 public HitBtcClient(string apiKey, string apiSecret, PairName pairName)
 {
     _api = new HitBtcRestApi();
     _api.Auth(apiKey, apiSecret);
     setPairName(pairName);
 }
コード例 #8
0
        public void setPairName(PairName pairName)
        {
            switch (pairName)
            {
            case PairName.ETHXRP:
                _pairName = "ethxrp";
                _symbol   = new Symbol(
                    "xrp",
                    "eth",
                    0.00000001f,
                    1
                    );
                break;

            case PairName.ETHXLM:
                _pairName = "ethxlm";
                _symbol   = new Symbol(
                    "xlm",
                    "eth",
                    0.00000001f,
                    1
                    );
                break;

            case PairName.ETHADH:
                break;

            case PairName.BTCADH:
                break;

            case PairName.ETHLRC:
                break;

            case PairName.BTCLRC:
                break;

            case PairName.ETHBCH:
                _pairName = "ethbch";
                _symbol   = new Symbol(
                    "bch",
                    "eth",
                    0.00000001f,
                    0.0001f
                    );
                break;

            case PairName.ETHLTC:
                _pairName = "ethltc";
                _symbol   = new Symbol(
                    "ltc",
                    "eth",
                    0.00000001f,
                    0.0001f
                    );
                break;

            case PairName.BTCBCH:
                _pairName = "btcbch";
                _symbol   = new Symbol(
                    "bch",
                    "btc",
                    0.00000001f,
                    0.0001f
                    );
                break;

            case PairName.BTCETH:
                _pairName = "btcbch";
                _symbol   = new Symbol(
                    "bch",
                    "btc",
                    0.00000001f,
                    0.0001f
                    );
                break;

            case PairName.BTCXRP:
                _pairName = "btcxrp";
                _symbol   = new Symbol(
                    "xrp",
                    "btc",
                    0.00000001f,
                    1f
                    );
                break;

            case PairName.BTCXLM:
                _pairName = "btcxlm";
                _symbol   = new Symbol(
                    "xlm",
                    "btc",
                    0.00000001f,
                    1f
                    );
                break;

            case PairName.BTCLTC:
                _pairName = "btcltc";
                _symbol   = new Symbol(
                    "ltc",
                    "btc",
                    0.00000001f,
                    0.001f
                    );
                break;

            case PairName.BTCXEM:
                _pairName = "btcxem";
                _symbol   = new Symbol(
                    "xem",
                    "btc",
                    0.00000001f,
                    1f
                    );
                break;
            }
        }
コード例 #9
0
 public BistoxClient(string apiKey, string apiSecret, PairName pairName)
 {
     _api = new BistoxRestApi();
     setPairName(pairName);
 }