Beispiel #1
0
        //Market Data
        public void reqMktData(int tickerId, Contract contract, string genericTickList, bool snapshot, List <TagValue> mktDataOptions)
        {
            int barId = _db.getBarDataId(contract.ConId, _barType, _minBarSize, _source);

            loadMktData(barId, _minBarSize);
            if (snapshot)
            {
                Bar bar = _mktData[barId][_currMktIndices[barId]];
                _wrapper.tickPrice(tickerId, 1, bar.close, 1);
                _wrapper.tickPrice(tickerId, 2, bar.close, 1);
                _wrapper.tickPrice(tickerId, 4, bar.close, 1);
                _wrapper.tickPrice(tickerId, 6, bar.high, 0);
                _wrapper.tickPrice(tickerId, 7, bar.low, 0);
                _wrapper.tickPrice(tickerId, 9, bar.close, 1);
            }
            else
            {
                lock (_lock)
                {
                    _tickTickerMap.Add(tickerId, barId);
                    if (_contractBarMap.ContainsKey(contract.ConId))
                    {
                        _contractBarMap[contract.ConId] = barId;
                    }
                    else
                    {
                        _contractBarMap.Add(contract.ConId, barId);
                    }
                    if (!_mktTimeZoneMap.ContainsKey(barId))
                    {
                        ContractDetails details = _db.getContractDetails(contract);
                        _mktTimeZoneMap.Add(barId, Strategy.mapDotNetTimeZone(details.TimeZoneId));
                        _barSlippageMap.Add(barId, _slippage * details.MinTick);
                    }
                }
            }
        }