Пример #1
0
        public static KucoinSocketClient CreateSocketClient(IWebsocket socket, KucoinSocketClientOptions options = null)
        {
            KucoinSocketClient client;

            client = options != null ? new KucoinSocketClient(options) : new KucoinSocketClient(new KucoinSocketClientOptions()
            {
                LogVerbosity = LogVerbosity.Debug, ApiCredentials = new KucoinApiCredentials("Test", "Test", "Test")
            });
            client.SocketFactory = Mock.Of <IWebsocketFactory>();
            Mock.Get(client.SocketFactory).Setup(f => f.CreateWebsocket(It.IsAny <Log>(), It.IsAny <string>())).Returns(socket);
            return(client);
        }
Пример #2
0
        /// <summary>
        /// Create a new instance of the KucoinSocketClient with the provided options
        /// </summary>
        public KucoinSocketClient(KucoinSocketClientOptions options) : base(options, options.ApiCredentials == null ? null : new KucoinAuthenticationProvider(options.ApiCredentials))
        {
            MaxSocketConnections = 10;

            SendPeriodic(TimeSpan.FromSeconds(30), (connection) => new KucoinPing()
            {
                Id   = Math.Round((DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalMilliseconds).ToString(CultureInfo.InvariantCulture),
                Type = "ping"
            });

            AddGenericHandler("Ping", (con, msg) => { });
            AddGenericHandler("Welcome", (con, msg) => { });
        }
Пример #3
0
 /// <summary>
 /// Sets the default options to use for new clients
 /// </summary>
 /// <param name="options">The options to use for new clients</param>
 public static void SetDefaultOptions(KucoinSocketClientOptions options)
 {
     defaultOptions = options;
 }
Пример #4
0
 /// <summary>
 /// Create a new instance of the KucoinSocketClient with the provided options
 /// </summary>
 public KucoinSocketClient(KucoinSocketClientOptions options)
 {
     Spot    = new KucoinSocketClientSpot(options);
     Futures = new KucoinSocketClientFutures(options);
 }