Esempio n. 1
0
        protected override async Task <IReadOnlyDictionary <string, ExchangeCurrency> > OnGetCurrenciesAsync()
        {
            var    currencies = new Dictionary <string, ExchangeCurrency>(StringComparer.OrdinalIgnoreCase);
            JToken array      = await MakeJsonRequestAsync <JToken>("/v1/hadax/common/currencys");

            foreach (JToken token in array)
            {
                bool enabled = true;
                var  coin    = new ExchangeCurrency
                {
                    BaseAddress       = null,
                    CoinType          = null,
                    FullName          = null,
                    DepositEnabled    = enabled,
                    WithdrawalEnabled = enabled,
                    MinConfirmations  = 0,
                    Name  = token.ToStringInvariant(),
                    Notes = null,
                    TxFee = 0,
                };

                currencies[coin.Name] = coin;
            }

            return(currencies);
        }
Esempio n. 2
0
        protected override async Task <IReadOnlyDictionary <string, ExchangeCurrency> > OnGetCurrenciesAsync()
        {
            var    currencies = new Dictionary <string, ExchangeCurrency>(StringComparer.OrdinalIgnoreCase);
            JToken array      = await MakeJsonRequestAsync <JToken>("/currencies");

            foreach (JToken token in array)
            {
                bool enabled = token["status"].ToStringLowerInvariant() == "online" ? true : false;
                var  coin    = new ExchangeCurrency
                {
                    CoinType          = token["coinType"].ToStringInvariant(),
                    FullName          = token["name"].ToStringInvariant(),
                    DepositEnabled    = enabled,
                    WithdrawalEnabled = enabled,
                    MinConfirmations  = token["minConfirmations"].ConvertInvariant <int>(),
                    Name  = token["symbol"].ToStringUpperInvariant(),
                    Notes = token["notice"].ToStringInvariant(),
                    TxFee = token["txFee"].ConvertInvariant <decimal>(),
                };

                currencies[coin.Name] = coin;
            }

            return(currencies);
        }
        protected override async Task <IReadOnlyDictionary <string, ExchangeCurrency> > OnGetCurrenciesAsync()
        {
            var    currencies = new Dictionary <string, ExchangeCurrency>(StringComparer.OrdinalIgnoreCase);
            JToken array      = await MakeJsonRequestAsync <JToken>("/public/getcurrencies");

            foreach (JToken token in array)
            {
                bool enabled = token["IsActive"].ConvertInvariant <bool>();
                var  coin    = new ExchangeCurrency
                {
                    BaseAddress       = token["BaseAddress"].ToStringInvariant(),
                    CoinType          = token["CoinType"].ToStringInvariant(),
                    FullName          = token["CurrencyLong"].ToStringInvariant(),
                    DepositEnabled    = enabled,
                    WithdrawalEnabled = enabled,
                    MinConfirmations  = token["MinConfirmation"].ConvertInvariant <int>(),
                    Name  = token["Currency"].ToStringUpperInvariant(),
                    Notes = token["Notice"].ToStringInvariant(),
                    TxFee = token["TxFee"].ConvertInvariant <decimal>(),
                };

                currencies[coin.Name] = coin;
            }

            return(currencies);
        }
Esempio n. 4
0
        public override IReadOnlyDictionary <string, ExchangeCurrency> GetCurrencies()
        {
            /*
             * {"1CR":{"id":1,"name":"1CRedit","txFee":"0.01000000","minConf":3,"depositAddress":null,"disabled":0,"delisted":1,"frozen":0},
             *  "XC":{"id":230,"name":"XCurrency","txFee":"0.01000000","minConf":12,"depositAddress":null,"disabled":1,"delisted":1,"frozen":0},
             *   ... }
             */
            var currencies = new Dictionary <string, ExchangeCurrency>();
            Dictionary <string, JToken> currencyMap = MakeJsonRequest <Dictionary <string, JToken> >("/public?command=returnCurrencies");

            foreach (var kvp in currencyMap)
            {
                var currency = new ExchangeCurrency
                {
                    BaseAddress      = kvp.Value["depositAddress"].ToStringInvariant(),
                    FullName         = kvp.Value["name"].ToStringInvariant(),
                    IsEnabled        = true,
                    MinConfirmations = kvp.Value["minConf"].ConvertInvariant <int>(),
                    Name             = kvp.Key,
                    TxFee            = kvp.Value["txFee"].ConvertInvariant <decimal>(),
                };

                string disabled = kvp.Value["disabled"].ToStringInvariant();
                string delisted = kvp.Value["delisted"].ToStringInvariant();
                string frozen   = kvp.Value["frozen"].ToStringInvariant();
                if (string.Equals(disabled, "1") || string.Equals(delisted, "1") || string.Equals(frozen, "1"))
                {
                    currency.IsEnabled = false;
                }

                currencies[currency.Name] = currency;
            }

            return(currencies);
        }
        public override IReadOnlyDictionary <string, ExchangeCurrency> GetCurrencies()
        {
            var currencies = new Dictionary <string, ExchangeCurrency>(StringComparer.OrdinalIgnoreCase);

            JObject obj    = MakeJsonRequest <JObject>("/public/getcurrencies");
            JToken  result = CheckError(obj);

            if (result is JArray array)
            {
                foreach (JToken token in array)
                {
                    var coin = new ExchangeCurrency
                    {
                        BaseAddress      = token["BaseAddress"].ToStringInvariant(),
                        CoinType         = token["CoinType"].ToStringInvariant(),
                        FullName         = token["CurrencyLong"].ToStringInvariant(),
                        IsEnabled        = token["IsActive"].ConvertInvariant <bool>(),
                        MinConfirmations = token["MinConfirmation"].ConvertInvariant <int>(),
                        Name             = token["Currency"].ToStringUpperInvariant(),
                        Notes            = token["Notice"].ToStringInvariant(),
                        TxFee            = token["TxFee"].ConvertInvariant <decimal>(),
                    };

                    currencies[coin.Name] = coin;
                }
            }

            return(currencies);
        }
        protected override async Task <IReadOnlyDictionary <string, ExchangeCurrency> > OnGetCurrenciesAsync()
        {
            Dictionary <string, ExchangeCurrency> currencies = new Dictionary <string, ExchangeCurrency>();
            //[{"Id":1, "Name":"Bitcoin", "Symbol":"BTC", "Algorithm":"sha256" "WithdrawFee":0.00010000, "MinWithdraw":0.00040000, "MinBaseTrade":0.0, "IsTipEnabled":false, "MinTip":0.0, "DepositConfirmations":6, "Status":"Maintenance","StatusMessage":"Unable to sync network","ListingStatus": "Active" }, ... ]
            JToken result = await MakeJsonRequestAsync <JToken>("/GetCurrencies");

            foreach (JToken token in result)
            {
                ExchangeCurrency currency = new ExchangeCurrency()
                {
                    Name             = token["Symbol"].ToStringInvariant(),
                    FullName         = token["Name"].ToStringInvariant(),
                    MinConfirmations = token["DepositConfirmations"].ConvertInvariant <int>(),
                    Notes            = token["StatusMessage"].ToStringInvariant(),
                    TxFee            = token["WithdrawFee"].ConvertInvariant <decimal>()
                };
                if (token["ListingStatus"].ToStringInvariant().Equals("Active"))
                {
                    currency.IsEnabled = !token["Status"].ToStringInvariant().Equals("Maintenance");
                }
                else
                {
                    currency.IsEnabled = false;
                }

                currencies[token["Symbol"].ToStringInvariant()] = currency;
            }
            return(currencies);
        }
        protected override async Task <IReadOnlyDictionary <string, ExchangeCurrency> > OnGetCurrenciesAsync()
        {
            var currencies = new Dictionary <string, ExchangeCurrency>(StringComparer.OrdinalIgnoreCase);
            Dictionary <string, object> payload = await GetNoncePayloadAsync();

            JToken result = await MakeJsonRequestAsync <JToken>("/coinList", payload : payload);

            JToken array = result["coinList"];

            foreach (JToken token in array)
            {
                /*
                 * {
                 *          "coinCode": "BTC",
                 *          "coinName": "Bitcoin",
                 *          "canDeposit": true,
                 *          "canWithdraw": true,
                 *          "minWithdrawal": 0.00100000
                 *  }
                 */
                var coin = new ExchangeCurrency
                {
                    //BaseAddress = token["BaseAddress"].ToStringInvariant(),
                    //CoinType = token["CoinType"].ToStringInvariant(),
                    FullName          = token["coinName"].ToStringInvariant(),
                    DepositEnabled    = token["canDeposit"].ConvertInvariant <bool>(),
                    WithdrawalEnabled = token["canWithdraw"].ConvertInvariant <bool>(),
                    //MinConfirmations = token["MinConfirmation"].ConvertInvariant<int>(),
                    Name = token["coinCode"].ToStringUpperInvariant(),
                    //Notes = token["Notice"].ToStringInvariant(),
                    //TxFee = token["TxFee"].ConvertInvariant<decimal>(),
                    AmountPrecision   = token["amountPrecision"].ConvertInvariant <int>(),
                    MinWithdrawalSize = token["minWithdrawal"].ConvertInvariant <decimal>(),
                };

                currencies[coin.Name] = coin;
                // Available fields not persisted in the model

                /*
                 * {
                 *  "id": "5c4b0deb929d4f9d15a16cc6",
                 * "isCrypto": true,
                 * "safeName": "bitcoin",
                 * "autoWithdrawalEnabled": false,
                 * "hotWalletMaxAmount": 0,
                 * "hotWalletTransferMinThreshold": 0,
                 * }*/
            }
            return(currencies);
        }
        protected override async Task <IReadOnlyDictionary <string, ExchangeCurrency> > OnGetCurrenciesAsync()
        {
            var currencies = new Dictionary <string, ExchangeCurrency>();
            var symbols    = await GetMarketSymbolsAsync();

            foreach (string symbol in symbols)
            {
                var currency = new ExchangeCurrency
                {
                    Name = symbol
                };
                currencies[currency.Name] = currency;
            }

            return(currencies);
        }
Esempio n. 9
0
        public override IEnumerable <ExchangeCurrency> GetCurrencies()
        {
            var    currencies = new List <ExchangeCurrency>();
            JToken products   = MakeJsonRequest <JToken>("/currencies");

            foreach (JToken product in products)
            {
                var currency = new ExchangeCurrency();
                currency.Name      = product["id"].ToStringUpperInvariant();
                currency.FullName  = product["name"].ToStringInvariant();
                currency.IsEnabled = true;

                currencies.Add(currency);
            }

            return(currencies);
        }
Esempio n. 10
0
        public override IReadOnlyDictionary <string, ExchangeCurrency> GetCurrencies()
        {
            var    currencies = new Dictionary <string, ExchangeCurrency>();
            JToken products   = MakeJsonRequest <JToken>("/currencies");

            foreach (JToken product in products)
            {
                var currency = new ExchangeCurrency();
                currency.Name      = product["id"].ToStringUpperInvariant();
                currency.FullName  = product["name"].ToStringInvariant();
                currency.IsEnabled = true;

                currencies[currency.Name] = currency;
            }

            return(currencies);
        }
Esempio n. 11
0
        protected override async Task <IReadOnlyDictionary <string, ExchangeCurrency> > OnGetCurrenciesAsync()
        {
            var    currencies = new Dictionary <string, ExchangeCurrency>();
            JToken products   = await MakeJsonRequestAsync <JToken>("/currencies");

            foreach (JToken product in products)
            {
                var currency = new ExchangeCurrency
                {
                    Name      = product["id"].ToStringUpperInvariant(),
                    FullName  = product["name"].ToStringInvariant(),
                    IsEnabled = true
                };

                currencies[currency.Name] = currency;
            }

            return(currencies);
        }
Esempio n. 12
0
        protected override async Task <IReadOnlyDictionary <string, ExchangeCurrency> > OnGetCurrenciesAsync()
        {
            var currencies = new Dictionary <string, ExchangeCurrency>(StringComparer.OrdinalIgnoreCase);
            Dictionary <string, object> payload = await GetNoncePayloadAsync();

            payload["Consumer"]      = $"{AuthHeaderPrefix} <{ConsumerToken}>";
            payload["Authorization"] = $"{AuthHeaderPrefix} <{autenticationToken}>";

            JToken array = await MakeJsonRequestAsync <JToken>("/currencies", payload : payload);

            foreach (JToken token in array)
            {
                bool enabled = token["isActive"].ConvertInvariant <bool>();
                var  coin    = new ExchangeCurrency
                {
                    //BaseAddress = token["BaseAddress"].ToStringInvariant(),
                    //CoinType = token["CoinType"].ToStringInvariant(),
                    FullName          = token["name"].ToStringInvariant(),
                    DepositEnabled    = token["depositActive"].ConvertInvariant <bool>(),
                    WithdrawalEnabled = token["withdrawActive"].ConvertInvariant <bool>(),
                    //MinConfirmations = token["MinConfirmation"].ConvertInvariant<int>(),
                    Name = token["symbol"].ToStringUpperInvariant(),
                    //Notes = token["Notice"].ToStringInvariant(),
                    //TxFee = token["TxFee"].ConvertInvariant<decimal>(),
                    AmountPrecision = token["amountPrecision"].ConvertInvariant <int>(),
                };

                currencies[coin.Name] = coin;
                // Available fields not persisted in the model

                /*
                 * {
                 *  "id": "5c4b0deb929d4f9d15a16cc6",
                 * "isCrypto": true,
                 * "safeName": "bitcoin",
                 * "autoWithdrawalEnabled": false,
                 * "hotWalletMaxAmount": 0,
                 * "hotWalletTransferMinThreshold": 0,
                 * }*/
            }
            return(currencies);
        }
        protected override async Task <IReadOnlyDictionary <string, ExchangeCurrency> > OnGetCurrenciesAsync()
        {
            var currencies = new Dictionary <string, ExchangeCurrency>();

            /*
             * {
             *  "success": true,
             *  "message": null,
             *  "result": [
             *  {
             *      "currency": "BOLI",
             *      "currencyLong": "Bolivarcoin",
             *      "minConfirmation": 3,
             *      "txFee": 0.00000000,
             *      "status": "OK"
             *  },
             *  {
             *      "currency": "BTC",
             *      "currencyLong": "Bitcoin",
             *      "minConfirmation": 6,
             *      "txFee": 0.00000000,
             *      "status": "OK"
             *  }
             *  ]
             * }*/
            var result = await MakeJsonRequestAsync <JToken>("/public/getcurrencies");

            foreach (var token in result)
            {
                var currency = new ExchangeCurrency
                {
                    Name              = token["currency"].ToStringInvariant(),
                    FullName          = token["currencyLong"].ToStringInvariant(),
                    MinConfirmations  = token["minConfirmation"].ConvertInvariant <int>(),
                    TxFee             = token["txFee"].ConvertInvariant <decimal>(),
                    DepositEnabled    = token["status"].ToStringInvariant().Equals("OK"),
                    WithdrawalEnabled = token["status"].ToStringInvariant().Equals("OK")
                };
                currencies[token["currency"].ToStringInvariant()] = currency;
            }
            return(currencies);
        }
Esempio n. 14
0
        protected override async Task<IReadOnlyDictionary<string, ExchangeCurrency>> OnGetCurrenciesAsync()
        {
            // https://api.kraken.com/0/public/Assets
            Dictionary<string, ExchangeCurrency> allCoins = new Dictionary<string, ExchangeCurrency>(StringComparer.OrdinalIgnoreCase);

            var currencies = new Dictionary<string, ExchangeCurrency>(StringComparer.OrdinalIgnoreCase);
            JToken array = await MakeJsonRequestAsync<JToken>("/0/public/Assets");
            foreach (JProperty token in array)
            {
                var coin = new ExchangeCurrency
                {
                    CoinType = token.Value["aclass"].ToStringInvariant(),
                    Name = token.Name,
                    FullName = token.Value["altname"].ToStringInvariant()
                };

                currencies[coin.Name] = coin;
            }

            return currencies;
        }
Esempio n. 15
0
        protected override async Task <IReadOnlyDictionary <string, ExchangeCurrency> > OnGetCurrenciesAsync()
        {
            var currencies = new Dictionary <string, ExchangeCurrency>(StringComparer.OrdinalIgnoreCase);
            //{ "success" : true,"message" : "", "result" : [{"Currency" : "BTC","CurrencyLong" : "Bitcoin","MinConfirmation" : 2,"TxFee" : 0.00080000,"IsActive" : true, "CoinType" : "BITCOIN","MaintenanceMode" : false}, ...
            JToken result = await MakeJsonRequestAsync <JToken>("/public/getcurrencies", null, null);

            foreach (JToken token in result)
            {
                var coin = new ExchangeCurrency
                {
                    CoinType         = token["CoinType"].ToStringInvariant(),
                    FullName         = token["CurrencyLong"].ToStringInvariant(),
                    IsEnabled        = token["MaintenanceMode"].ConvertInvariant <bool>().Equals(false),
                    MinConfirmations = token["MinConfirmation"].ConvertInvariant <int>(),
                    Name             = token["Currency"].ToStringUpperInvariant(),
                    Notes            = token["Notice"].ToStringInvariant(),
                    TxFee            = token["TxFee"].ConvertInvariant <decimal>(),
                };
                currencies[coin.Name] = coin;
            }
            return(currencies);
        }
Esempio n. 16
0
        protected override async Task <IReadOnlyDictionary <string, ExchangeCurrency> > OnGetCurrenciesAsync()
        {
            var currencies = new Dictionary <string, ExchangeCurrency>();
            //[{"currency":"ETHCA","active":true,"precision":8,"api_precision":8,"minimum_withdrawal_amount":"0.00200000","minimum_deposit_amount":"0.00000000","deposit_fee_currency":"ETHCA","deposit_fee_const":"0.00000000","deposit_fee_percent":0,"withdrawal_fee_currency":"ETHCA","withdrawal_fee_const":"0.00100000","withdrawal_fee_percent":0,"currency_long":"Ethcash","block_explorer_url":""}, ... ]
            var result = await MakeJsonRequestAsync <JToken>("/currencies");

            foreach (var token in result)
            {
                var currency = new ExchangeCurrency()
                {
                    Name     = token["currency"].ToStringInvariant(),
                    FullName = token["currency_long"].ToStringInvariant(),
                    //MinConfirmations = token["DepositConfirmations"].ConvertInvariant<int>(),
                    //Notes = token["StatusMessage"].ToStringInvariant(),
                    TxFee             = token["withdrawal_fee_const"].ConvertInvariant <decimal>(),
                    DepositEnabled    = token["active"].ToObject <bool>(),
                    WithdrawalEnabled = token["active"].ToObject <bool>()
                };
                currencies[token["currency"].ToStringInvariant()] = currency;
            }
            return(currencies);
        }
Esempio n. 17
0
        protected override async Task <IReadOnlyDictionary <string, ExchangeCurrency> > OnGetCurrenciesAsync()
        {
            var currencies = new Dictionary <string, ExchangeCurrency>();
            var result     = await MakeJsonRequestAsync <JToken>("/markets");

            foreach (var token in result)
            {
                var baseSymbol = token[0].ToStringInvariant();
                if (currencies.ContainsKey(baseSymbol))
                {
                    continue;
                }
                var currency = new ExchangeCurrency()
                {
                    Name              = baseSymbol,
                    FullName          = baseSymbol,
                    DepositEnabled    = true,
                    WithdrawalEnabled = true
                };
                currencies[baseSymbol] = currency;
            }
            return(currencies);
        }
        public override IEnumerable <ExchangeCurrency> GetCurrencies()
        {
            var     currencies = new List <ExchangeCurrency>();
            JObject obj        = MakeJsonRequest <JObject>("/public/getcurrencies");
            JToken  result     = CheckError(obj);

            if (result is JArray array)
            {
                foreach (JToken token in array)
                {
                    var coin = new ExchangeCurrency
                    {
                        Name      = token["Currency"].ToStringUpperInvariant(),
                        FullName  = token["CurrencyLong"].ToStringInvariant(),
                        TxFee     = token["TxFee"].ConvertInvariant <decimal>(),
                        IsEnabled = token["IsActive"].ConvertInvariant <bool>(),
                        Notes     = token["Notice"].ToStringInvariant()
                    };
                    currencies.Add(coin);
                }
            }

            return(currencies);
        }