Exemplo n.º 1
0
        public static Balance ToBalance(this PoloniexBalanceDataType balanceItemDataType, CurrencyOfMarket currency, string cryptoAddress)
        {
            var balance = new Balance(
                currency, CryptoAddress.FromString(cryptoAddress),
                balanceItemDataType.Available ?? 0,
                0,
                balanceItemDataType.Pending ?? 0);

            return(balance);
        }
Exemplo n.º 2
0
        public static CurrencyOfMarket ToCurrency(this PoloniexCurrencyDataType currencyDataType, string currencyShortName, Market market)
        {
            var currency = new CurrencyOfMarket(
                new Currency(currencyShortName, currencyDataType.CurrencyName),
                market, currencyDataType.TaxFee, !currencyDataType.IsDisabled,
                CryptoAddress.FromString(currencyDataType.DepositAddress),
                currencyDataType.MinConfirmation);

            return(currency);
        }
Exemplo n.º 3
0
        public static CurrencyOfMarket ToCurrency(this BittrexCurrencyDataType currencyDataType, Market market)
        {
            var currency = new CurrencyOfMarket(
                new Currency(currencyDataType.CurrencyName, currencyDataType.CurrencyLongName),
                market, currencyDataType.TxFee, currencyDataType.IsActive,
                CryptoAddress.FromString(currencyDataType.BaseAddress),
                currencyDataType.MinConfirmation);

            return(currency);
        }
Exemplo n.º 4
0
        public Balance Balance(Market market, Currency currency)
        {
            double total     = 0;
            double available = 0;
            double pending   = 0;

            if (!currency.Equals(CurrencyDummy.Usdt) && !currency.Equals(CurrencyDummy.Eth))
            {
                GetRandomBalance(out total, out available, out pending);
            }
            return(new Balance(market, currency, CryptoAddress.FromString("address"), total, available, pending));
        }
Exemplo n.º 5
0
        public static Balance ToBalance(this BittrexBalanceItemDataType balanceItemDataType, Market market, Currency currency)
        {
            double reserved = 0;

            if (balanceItemDataType.Balance.HasValue && balanceItemDataType.Available.HasValue)
            {
                reserved = balanceItemDataType.Balance.Value - balanceItemDataType.Available.Value;
            }

            var balance = new Balance(
                market, currency, CryptoAddress.FromString(balanceItemDataType.CryptoAddress),
                balanceItemDataType.Available ?? 0,
                reserved,
                balanceItemDataType.Pending ?? 0);

            return(balance);
        }
Exemplo n.º 6
0
        public IEnumerable <Balance> Balances(Market market)
        {
            var balances = new List <Balance>();

            double reserved;
            double available;
            double pending;

            GetRandomBalance(out reserved, out available, out pending);
            balances.Add(new Balance(market, CurrencyDummy.Btc, CryptoAddress.FromString("address btc"), available, reserved, pending));

            GetRandomBalance(out reserved, out available, out pending);
            balances.Add(new Balance(market, CurrencyDummy.Eth, CryptoAddress.FromString("address eth"), available, reserved, pending));

            GetRandomBalance(out reserved, out available, out pending);
            balances.Add(new Balance(market, CurrencyDummy.Ltc, CryptoAddress.FromString("address ltc"), available, reserved, pending));

            return(balances);
        }