Exemplo n.º 1
0
        public UserDynamic(API api, json.UserCall userCall)
        {
            this.api = api;

            if (userCall.error != 0)
            {
                return;
            }

            balances = new Dictionary<string, Balance>();
            orders = new Order[userCall.orders.Length];

            logID = userCall.logid;
            chatKey = userCall.chatkey;
            chatExpiry = Utils.UnixTimeStampToDateTime(userCall.chatexp);

            for (int i = 0; i < userCall.orders.Length; i++)
            {
                orders[i] = new Order(api, userCall.orders[i]);
            }

            for (int i = 0; i < userCall.balances.Length; i++)
            {
                balances[userCall.balances[i].tla] = new Balance(api, userCall.balances[i]);
            }
        }
Exemplo n.º 2
0
        public MarketPair(API api, json.MarketCall.Pair jsonMarketPair)
        {
            this.api = api;

            @base = api.GetCurrency(jsonMarketPair.@base);
            other = api.GetCurrency(jsonMarketPair.other);
            volume = new Amount(jsonMarketPair.volume, @base.DecimalsInternal);
            lastPrice = new Amount(jsonMarketPair.lastprice, @base.DecimalsInternal);
            bestAsk = new Amount(jsonMarketPair.bestask, @base.DecimalsInternal);
            bestBid = new Amount(jsonMarketPair.bestbid, @base.DecimalsInternal);
            depthAsk = new Amount(jsonMarketPair.depthask, other.DecimalsInternal);
            depthBid = new Amount(jsonMarketPair.depthbid, @base.DecimalsInternal);
            feeBase = int.Parse(jsonMarketPair.feebase, System.Globalization.NumberStyles.HexNumber) / 100;
            feeOther = int.Parse(jsonMarketPair.feeother, System.Globalization.NumberStyles.HexNumber) / 100;
            decimalsOrder = jsonMarketPair.decimals_order;
            minimumBase = new Amount(jsonMarketPair.minbase, @base.DecimalsInternal);
            minimumOther = new Amount(jsonMarketPair.minother, other.DecimalsInternal);
        }
Exemplo n.º 3
0
            public Order(API api, json.UserCall.Order userOrder)
            {
                this.api = api;

                id = userOrder.id;
                marketPair = api.GetMarketPair(userOrder.pair);
                time = Utils.UnixTimeStampToDateTime(userOrder.time);
                amount = new Amount(userOrder.amount, api.GetCurrency(userOrder.side).DecimalsInternal);
                price = new Amount(userOrder.price, marketPair.Base.DecimalsInternal);
                bid = userOrder.side == marketPair.Base.TLA;
            }
Exemplo n.º 4
0
            public Balance(API api, json.UserCall.Balance userBalance)
            {
                this.api = api;

                currency = api.GetCurrency(userBalance.tla);
                total = new Amount(userBalance.total, currency.DecimalsInternal);
                available = new Amount(userBalance.avail, currency.DecimalsInternal);
                address = userBalance.address;
            }