示例#1
0
        public void SubscribingToUserStream_Should_TriggerWhenAccountUpdateStreamMessageIsReceived()
        {
            // arrange
            var socket = new TestSocket();
            var client = TestHelpers.CreateSocketClient(socket);

            BinanceStreamBalanceUpdate result = null;

            client.Spot.SubscribeToUserDataUpdates("test", null, null, null, (test) => result = test);

            var data = new BinanceStreamBalanceUpdate()
            {
                Event        = "balanceUpdate",
                EventTime    = new DateTime(2017, 1, 1),
                Asset        = "BTC",
                BalanceDelta = 1,
                ClearTime    = new DateTime(2018, 1, 1),
            };

            // act
            socket.InvokeMessage(data);

            // assert
            Assert.IsNotNull(result);
            Assert.IsTrue(TestHelpers.AreEqual(data, result));
        }
示例#2
0
        public static Transaction FromBinanceStreamBalanceUpdate(BinanceStreamBalanceUpdate update)
        {
            Transaction t = new Transaction();

            t.Asset     = update.Asset;
            t.Amount    = update.BalanceDelta;
            t.Timestamp = update.EventTime;
            return(t);
        }
 private void UpdateAccountBalance(BinanceStreamBalanceUpdate balUpdate)
 {
     Console.WriteLine("Binance UpdateAccountBalance");
 }
示例#4
0
 public BalanceUpdate(BinanceStreamBalanceUpdate update)
 {
     Timestamp = update.EventTime;
     Asset     = update.Asset;
     Amount    = update.BalanceDelta;
 }