Ejemplo n.º 1
0
        public override Margin GetMargin()
        {
            if (this.api_client_ == null)
            {
                return((Margin)null);
            }
            ByBitMarginResult margin = this.api_client_.GetMargin();

            if (margin == null)
            {
                return((Margin)null);
            }
            if (margin.BTCMarginData == null)
            {
                return((Margin)null);
            }
            return(new Margin()
            {
                Exchange = nameof(ByBit),
                Balance = margin.BTCMarginData.AvailableBalance,
                Equity = margin.BTCMarginData.Equity
            });
        }
Ejemplo n.º 2
0
        public ByBitMarginResult GetMargin()
        {
            ByBit_Response byBitResponse = this.Get <ByBit_Response>("/v2/private/wallet/balance", new Dictionary <string, object>()
            {
                {
                    "api_key",
                    (object)this.api_key_
                },
                {
                    "timestamp",
                    (object)DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString()
                }
            });

            if (byBitResponse != null && byBitResponse.Result != null)
            {
                ByBitMarginResult byBitMarginResult = JsonConvert.DeserializeObject <ByBitMarginResult>(byBitResponse.Result.ToString());
                if (byBitMarginResult != null)
                {
                    return(byBitMarginResult);
                }
            }
            return((ByBitMarginResult)null);
        }