Пример #1
0
        public async Task <CallResult <UpdateSubscription> > Test <T>(string pair, Action <T> onData)
        {
            // var tre = new P2pSocketSubscribeRequest() { Id = 1, Method = "depth.subscribe", Params = new System.Collections.Generic.List<object>() {"ETH_BTC", 20, "0" } };
            var req = SocketRequestFactory.Create(new OrderBookSubscribeParam(pair), "depth.subscribe");

            Console.WriteLine(JsonConvert.SerializeObject(req));
            return(await Subscribe(JsonConvert.SerializeObject(req), null, false, onData).ConfigureAwait(false));
        }
Пример #2
0
        public async Task <CallResult <UpdateSubscription> > SubscribeDeals(string pair, Action <P2pSocketEvent <DealsEvent> > onData)
        {
            var req = SocketRequestFactory.Create(new string[] { pair }, "deals.subscribe");

            //   await Subscribe(JsonConvert.SerializeObject(req), null, false, onData).ConfigureAwait(false);
            //  await Task.Delay(400);
            log.Write(CryptoExchange.Net.Logging.LogVerbosity.Info, $"Subscribing to {req.Method}");
            return(await Subscribe(JsonConvert.SerializeObject(req), null, false, onData).ConfigureAwait(false));
        }
Пример #3
0
        public async Task <CallResult <UpdateSubscription> > SubscribeToOrderBookUpdates(string pair, int limit, Action <P2pSocketEvent <P2pOrderBookUpdate> > onData)
        {
            var req = SocketRequestFactory.Create(new OrderBookSubscribeParam(pair, limit), "depth.subscribe");

            return(await Subscribe(JsonConvert.SerializeObject(req), null, false, onData).ConfigureAwait(false));
        }
Пример #4
0
 public P2pSocketClient(P2pSocketClientOptions exchangeOptions, P2pAuthenticationProvider authenticationProvider) : base(exchangeOptions, authenticationProvider)
 {
     //  AddGenericHandler("Pong", (connection, token) => { });
     SendPeriodic(TimeSpan.FromSeconds(5), con => SocketRequestFactory.Create("server.ping"));
 }
Пример #5
0
 public P2pSocketClient() : base(new P2pSocketClientOptions(), null)
 {
     //Console.WriteLine(ping);
     //  AddGenericHandler("Pong", (connection, token) => { });
     SendPeriodic(TimeSpan.FromSeconds(5), con => JsonConvert.SerializeObject(SocketRequestFactory.Create("server.ping")));
 }