Skip to content

Streaming Market Data

Subscribe Tick

In

using System;
using System.Collections.Generic;
using Sinopac.Shioaji;

namespace ConsoleApplication15
{
    internal class Program
    {
        private static void myCB(string topic, Dictionary<string, dynamic> msg)
        {
            Console.WriteLine("topic: " + topic);
            foreach (var item in msg)
            {
                Console.WriteLine(item.Key + ": " + item.Value);
            }

            Console.WriteLine("-----------------------------------");
        }
        public static void Main(string[] args)
        {
            var _api = new Shioaji();
            var _accounts = _api.Login("PERSON_ID", "PASSWORD");
            _api.SetQuoteCallback(myCB);
            _api.Subscribe(_api.Contracts.Stocks["TSE"]["2330"], QuoteType.tick);
            System.Threading.Thread.Sleep(5000);
        }
    }
}

Out

Connecting as shioaji@sinopac on 203.66.91.161:80...
Response Code: SOLCLIENT_OK | Event Code: 0 | Info: host '203.66.91.161:80', IP 203.66.91.161:80 (host 1 of 1) (host connection attempt 1 of 1) (total connection attempt 1 of 1ReResponse Code: SOLCLIENT_OK | Event Code: 0 | Info: host '203.66.91.161:80', IP 203.66.91.161:80 (host 1 of 1) (host connection attempt 1 of 1) (total connection attempt 1 of 1)
| Event: Session up
Subscribe MKT/ */TSE/2330
topic: MKT/idcdmzpcr01/TSE/2330
Date: 2021/02/03
Time: 11:04:20.751919
Close: [634]
Volume: [1]
VolSum: [29820]
AmountSum: [19001762000]
TickType: [2]
-----------------------------------
topic: MKT/idcdmzpcr01/TSE/2330
Date: 2021/02/03
Time: 11:04:23.183556
Close: [635]
Volume: [1]
VolSum: [29821]
AmountSum: [19002397000]
TickType: [1]
-----------------------------------
topic: MKT/idcdmzpcr01/TSE/2330
Date: 2021/02/03
Time: 11:04:25.149339
Close: [635]
Volume: [1]
VolSum: [29822]
AmountSum: [19003032000]
TickType: [1]
-----------------------------------

Subscribe BidAsk

In

using System;
using System.Collections.Generic;
using Sinopac.Shioaji;

namespace ConsoleApplication15
{
    internal class Program
    {
        private static void myCB(string topic, Dictionary<string, dynamic> msg)
        {
            Console.WriteLine("topic: " + topic);
            foreach (var item in msg)
            {
                Console.WriteLine(item.Key + ": " + item.Value);
            }

            Console.WriteLine("-----------------------------------");
        }
        public static void Main(string[] args)
        {
            var _api = new Shioaji();
            var _accounts = _api.Login("PERSON_ID", "PASSWORD");
            _api.SetQuoteCallback(myCB);
            _api.Subscribe(_api.Contracts.Stocks["TSE"]["2330"], QuoteType.bidask);
            System.Threading.Thread.Sleep(5000);
        }
    }
}

Out

Response Code: SOLCLIENT_OK | Event Code: 0 | Info: host '203.66.91.161:80', IP 203.66.91.161:80 (host 1 of 1) (host connection attempt 1 of 1) (total connection attempt 1 of 1)
| Event: Session up
Subscribe QUT/ */TSE/2330
topic: QUO/v2/ */TSE/2330/ODDLOT
Date: 2021/02/03
Time: 13:24:38.847295
BidPrice: [631,630,629,628,627]
AskPrice: [632,633,634,635,636]
BidVolume: [127,832,462,453,1297]
AskVolume: [296,204,177,573,377]
-----------------------------------
topic: QUO/v2/ */TSE/2330/ODDLOT
Date: 2021/02/03
Time: 13:24:39.046382
BidPrice: [631,630,629,628,627]
AskPrice: [632,633,634,635,636]
BidVolume: [128,832,462,453,1297]
AskVolume: [296,204,177,573,377]
-----------------------------------
topic: QUO/v2/ */TSE/2330/ODDLOT
Date: 2021/02/03
Time: 13:24:39.238539
BidPrice: [631,630,629,628,627]
AskPrice: [632,633,634,635,636]
BidVolume: [127,832,462,453,1297]
AskVolume: [296,204,177,573,377]
-----------------------------------