Exemplo n.º 1
0
        public void BuildNewOrderMessageTest()
        {
            Wallet w = new Wallet("1E5B4C6DDDB2BDD6B40344808812D6D3254D7D4E105A52BA51C032EB7BAC1035", Network.Test);

            w.SetSequence(0);//Have to reset, wallet automatically refreshes it's sequence on creation
            var msgBytes    = BroadcastMessageBuilder.BuildNewOrderMessage("000-EF6_BNB", OrderType.Limit, Side.Buy, 499, (decimal)0.00001, TimeInForce.GTE, w);
            var msgStr      = BitConverter.ToString(msgBytes).Replace("-", "").ToUpper();
            var expectedStr = "D901F0625DEE0A63CE6DC0430A141B0A2CFFAE1193EE0BDE3E01C62E34D82E3BFA0A122A314230413243464641453131393345453042444533453031433632453334443832453342464130412D311A0B3030302D4546365F424E42200228013080A696F2B90138E8074001126E0A26EB5AE9872103D2B6A5194D34703971E6C7544B2E5CE687AF7CF58346F662936D8E26C20A301312405121493068E6C918E07CBD4275621472B4937A03E51BC15C8FB68170508AFA817F4391B31FE1AA81BE9B55C50DCC4606A08E9CCB7AE2FE9D87913285D3C84F6D18ECE028";

            Assert.AreEqual(msgStr, expectedStr);
        }
Exemplo n.º 2
0
 public BroadcastResponse NewOrder(string symbol, OrderType orderType, Side side, decimal price, decimal qty, TimeInForce tif)
 {
     //Ensure no other broadcast transaction interferes with sequence until it hit the blockchain
     lock (BroadcastLockObject)
     {
         if (VerifySequenceBeforeSend)
         {
             Wallet.RefreshSequence();
         }
         var msg    = BroadcastMessageBuilder.BuildNewOrderMessage(symbol, orderType, side, price, qty, tif, Wallet);
         var result = HTTP.BroadcastToBlockchain(msg, WaitForTransactionConfirmationOnBroadcast);
         if (result.ok)
         {
             _wallet.IncrementSequence();
         }
         return(result);
     }
 }