Esempio n. 1
0
 public void Release()
 {
     if (_api != null)
     {
         Connected = false;
         _api.Release();
         _api = null;
     }
 }
Esempio n. 2
0
        public MarketData(String _brokerID, String _userID, String _password, String _mdAddr)
        {
            marketData      = new List <List <MD> >();
            instrumentIndex = new Dictionary <string, int>();

            brokerID = _brokerID;
            userID   = _userID;
            password = _password;
            mdAddr   = _mdAddr;

            mdApi = new CtpMdApi(brokerID, userID, mdAddr, mdCallBackFunction);
        }
 public void Release()
 {
     if (_api != null)
     {
         _publisher.Post(ConnectionStatus.Releasing);
         Connected = false;
         _api.Release();
         _api = null;
         _instruments.Clear();
         _publisher.Post(ConnectionStatus.Disconnected);
     }
 }
Esempio n. 4
0
        public void Init(ServerInfoField server, UserInfoField user)
        {
            if (_api != null)
            {
                return;
            }
            User      = user;
            Server    = server;
            UserLogin = null;
            _api      = new CtpMdApi(GetFlowPath(server, user));
            InitHandler();
            var items = server.Address.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var item in items)
            {
                _api.RegisterFront(item);
            }
            _publisher.Post(ConnectionStatus.Connecting);
            _api.Init();
        }