コード例 #1
0
        private static void PublicUnsubscribeExample(CfWebSocketApi cfWs)
        {
            ////////// public feeds //////////

            var productIds = new List <string> {
                "PI_XBTUSD"
            };
            string feed;

            //// subscribe to trade
            feed = "trade";
            cfWs.UnsubscribePublic(feed, productIds);

            // subscribe to book
            feed = "book";
            cfWs.UnsubscribePublic(feed, productIds);

            // subscribe to ticker
            feed = "ticker";
            cfWs.UnsubscribePublic(feed, productIds);

            // subscribe to ticker lite
            feed = "ticker_lite";
            cfWs.UnsubscribePublic(feed, productIds);

            // subscribe to heartbeat
            feed = "heartbeat";
            cfWs.UnsubscribePublic(feed);
        }
コード例 #2
0
        private static void PrivateUnsubscribeExample(CfWebSocketApi cfWs)
        {
            ////////// private feeds //////////
            string feed;

            // subscribe to account balances and margis
            feed = "account_balances_and_margins";
            cfWs.UnsubscribePrivate(feed);
            //
            // subscribe to account log
            feed = "account_log";
            cfWs.UnsubscribePrivate(feed);
            //
            // subscribe to deposits withdrawals
            feed = "deposits_withdrawals";
            cfWs.UnsubscribePrivate(feed);
            //
            // subscribe to fills
            feed = "fills";
            cfWs.UnsubscribePrivate(feed);

            // subscribe to open positions
            feed = "open_positions";
            cfWs.UnsubscribePrivate(feed);

            // subscribe to open orders
            feed = "open_orders";
            cfWs.UnsubscribePrivate(feed);
            //
            // subscribe to notifications
            feed = "notifications_auth";
            cfWs.UnsubscribePrivate(feed);
        }
コード例 #3
0
        public static void Main()
        {
            string url       = "wss://www.cryptofacilities.com/ws/v1";
            string apiKey    = "..."; //accessible on your Account page under Settings->API Keys
            string apiSecret = "..."; //accessible on your Account page under Settings -> API Keys
            var    cfWs      = new CfWebSocketApi(url, apiKey, apiSecret);

            //Subscribe
            PublicSubscribeExample(cfWs);
            PrivateSubscribeExample(cfWs);

            // Wait for 5 Sec
            System.Threading.Thread.Sleep(5000);

            //Unsubscribe
            PublicUnsubscribeExample(cfWs);
            PrivateUnsubscribeExample(cfWs);

            Console.ReadKey(true);
        }