Beispiel #1
0
        private void PostInit()
        {
            var accessKey = Program.Accesskey;
            var secretEky = Program.Secretkey;

            ApiData = new ApiData(accessKey, secretEky);
            React   = new React(accessKey, secretEky);

            AlgorithmList  = BotSetting.AlgorithmList;
            CandleTypeList = BotSetting.CandleTypeList;
            CoinList       = BotSetting.CoinList;

            algorithmBindingSource.DataSource  = AlgorithmList;
            candleTypeBindingSource.DataSource = CandleTypeList;
            coinBindingSource.DataSource       = CoinList;

            Algorithm  = AlgorithmList.Where(x => x.Id == Settings.Default.algorithm).FirstOrDefault();
            CandleType = CandleTypeList.Where(x => x.Minute == Settings.Default.candleType).FirstOrDefault();
            Coin       = CoinList.Where(x => x.Ticker.Equals(Settings.Default.coin)).FirstOrDefault();

            FeeRate     = Settings.Default.feeRate;
            TradeRate   = Settings.Default.tradeRate;
            Interval    = Convert.ToInt32(Settings.Default.interval);
            TriggerRate = Settings.Default.triggerRate;
            CandleCount = Convert.ToInt32(Settings.Default.candleCount);
        }
Beispiel #2
0
 public void SelectCoins(Func <CoinViewModel, bool> coinFilterPredicate)
 {
     foreach (var c in CoinList.ToArray())
     {
         c.IsSelected = coinFilterPredicate(c);
     }
 }
Beispiel #3
0
        public async Task <IActionResult> GetCoins()
        {
            List <int> coins = new List <int>();

            coins = await _repo.GetCoinNamesList();

            _coinlist = await GetCoinsInterval.GetCoinList_API(coins);      // call to set timer going that runs continuasly

            return(Ok(_coinlist));
        }
        public static void ShowCoins()
        {
            ICryptoCompareServices services = new CryptoCompareServices(new CryptoCompareConfig());
            CoinList coinList = services.CoinlistAsync(null, null).Result;

            Debug.WriteLine(coinList);
            foreach (KeyValuePair <string, CoinData> keyValuePair in coinList.Data)
            {
                Debug.WriteLine(keyValuePair.Key + " : " + keyValuePair.Value.FullName);
            }
        }
Beispiel #5
0
 /// <summary>
 /// Resets the actual Level
 /// </summary>
 public void ResetLevel()
 {
     SpikeList.Clear();
     SlowList.Clear();
     CoinList.Clear();
     RollList.Clear();
     SpeedList.Clear();
     BrettList.Clear();
     ResetScore();
     ResetPhase();
 }
 public void InitializeCoins()
 {
     CoinList.Add(1);
     CoinList.Add(5);
     CoinList.Add(10);
     CoinList.Add(20);
     CoinList.Add(50);
     CoinList.Add(100);
     CoinList.Add(200);
     CoinList.Add(500);
     CoinList.Add(1000);
 }
Beispiel #7
0
        private void OnSearch()
        {
            var tempSearch = SearchString;

            if (tempSearch == null)
            {
                return;
            }

            FilteredCoinList = new ObservableCollection <BasicCryptoModel>(CoinList.Where(c => c.Symbol.ToLowerInvariant().Contains(tempSearch) ||
                                                                                          c.Name.ToLowerInvariant().Contains(tempSearch))
                                                                           .ToList());
        }
        internal static async Task <CoinList> GetCoinList_API(List <int> coinsInDb)
        {
            try
            {
                if (blnStarted == false)
                {
                    _coinlist            = new CoinList();
                    _coinlist._CoinsInDB = coinsInDb;
                    blnStarted           = true;
                    aTimer = new System.Timers.Timer(300000);   // every 300 seconds / 5 mins
                    Timer();
                    _coinlist = await Task.Run(() => _coinlist.getCoinPrices_APIAsync());
                }
            }
            catch (Exception e)
            {
                System.Console.WriteLine(e.ToString());
            }

            return(_coinlist);
        }
Beispiel #9
0
        public void SaveCoins(List <CoinDTO> ApiLoadedCoins)
        {
            var doc = liteDatabase.GetCollection <CoinList>(DOC_COIN);
            var res = doc.FindOne(x => x.Updated == DateTime.Today);

            if (res != null)
            {
                res.Coins = ApiLoadedCoins;
                doc.Update(res);
            }
            else
            {
                CoinList coinDbEntry = new CoinList
                {
                    Coins   = ApiLoadedCoins,
                    Updated = DateTime.Today
                };

                doc.Insert(coinDbEntry);
            }
        }
Beispiel #10
0
 internal void UpdateCoinType()
 {
     SelectedCoin = CoinList.Where(x => x.CoinType.Equals(Pool.CoinType)).FirstOrDefault();
 }
        public MainViewModel()
            : base(Locator.Current.GetService <IViewStackService>())
        {
            Global = Locator.Current.GetService <Global>();
            Global.SetDefaultWallet();
            Task.Run(async() => await App.LoadWalletAsync());

            ShowWalletInfoCommand = ReactiveCommand.CreateFromObservable(() =>
            {
                ViewStackService.PushPage(new WalletInfoViewModel(Global.Wallet.KeyManager)).Subscribe();
                return(Observable.Return(Unit.Default));
            });

            if (Disposables != null)
            {
                throw new Exception("Wallet opened before it was closed.");
            }

            // init with UI config
            Balance = Global.UiConfig.Balance;

            Transactions = new ObservableCollection <TransactionViewModel>();

            OpenTransactionDetail = ReactiveCommand.CreateFromObservable((TransactionViewModel tvm) =>
            {
                ViewStackService.PushPage(tvm).Subscribe();
                return(Observable.Return(Unit.Default));
            });

            TryWriteTableFromCache();

            Initializing += OnInit;
            Initializing(this, EventArgs.Empty);

            StatusViewModel = new StatusViewModel();

            var coinListReady = this.WhenAnyValue(x => x.CoinList.IsCoinListLoading,
                                                  stillLoading => !stillLoading);

            _hasSeed = this.WhenAnyValue(x => x.Global.UiConfig.HasSeed)
                       .ToProperty(this, nameof(HasSeed));

            _isBackedUp = this.WhenAnyValue(x => x.Global.UiConfig.IsBackedUp)
                          .ToProperty(this, nameof(IsBackedUp));

            var canBackUp = this.WhenAnyValue(x => x.HasSeed, x => x.IsBackedUp,
                                              (hasSeed, isBackedUp) => hasSeed && !isBackedUp);

            canBackUp.ToProperty(this, x => x.CanBackUp, out _canBackUp);

            NavBackUpCommand = ReactiveCommand.CreateFromObservable(() =>
            {
                ViewStackService.PushPage(new StartBackUpViewModel()).Subscribe();
                return(Observable.Return(Unit.Default));
            }, canBackUp);

            NavReceiveCommand = ReactiveCommand.CreateFromObservable(() =>
            {
                ViewStackService.PushPage(new ReceiveViewModel()).Subscribe();
                return(Observable.Return(Unit.Default));
            });

            InitCoinJoin = ReactiveCommand.CreateFromObservable(() =>
            {
                CoinList.SelectOnlyPrivateCoins(false);
                ViewStackService.PushPage(CoinJoinViewModel).Subscribe();
                return(Observable.Return(Unit.Default));
            }, coinListReady);

            SendCommand = ReactiveCommand.CreateFromObservable(() =>
            {
                CoinList.SelectOnlyPrivateCoins(true);
                ViewStackService.PushPage(SendAmountViewModel).Subscribe();
                return(Observable.Return(Unit.Default));
            }, coinListReady);

            _hasCoins = this
                        .WhenAnyValue(x => x.Balance)
                        .Select(bal => Money.Parse(bal) > 0)
                        .ToProperty(this, nameof(HasCoins));
        }
Beispiel #12
0
 public CoinsController(DataContext context, ICryptoRepository repo, CoinList coinlist)
 {
     _repo = repo;
 }
 private static async void OnTimedEvent(Object source, ElapsedEventArgs e)
 {
     _coinlist = await Task.Run(() => _coinlist.getCoinPrices_APIAsync());
 }