• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# SecurityType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中SecurityType的典型用法代码示例。如果您正苦于以下问题:C# SecurityType类的具体用法?C# SecurityType怎么用?C# SecurityType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SecurityType类属于命名空间,在下文中一共展示了SecurityType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SubscriptionDataConfig

 /********************************************************
 * CLASS CONSTRUCTOR
 *********************************************************/
 /// <summary>
 /// Constructor for Data Subscriptions
 /// </summary>
 /// <param name="objectType">Type of the data objects.</param>
 /// <param name="securityType">SecurityType Enum Set Equity/FOREX/Futures etc.</param>
 /// <param name="symbol">Symbol of the asset we're requesting</param>
 /// <param name="resolution">Resolution of the asset we're requesting</param>
 /// <param name="fillForward">Fill in gaps with historical data</param>
 /// <param name="extendedHours">Equities only - send in data from 4am - 8pm</param>
 public SubscriptionDataConfig(Type objectType, SecurityType securityType = SecurityType.Equity, string symbol = "", Resolution resolution = Resolution.Minute, bool fillForward = true, bool extendedHours = false)
 {
     this.Type = objectType;
     this.Security = securityType;
     this.Resolution = resolution;
     this.Symbol = symbol;
     this.FillDataForward = fillForward;
     this.ExtendedMarketHours = extendedHours;
     this.PriceScaleFactor = 1;
     this.MappedSymbol = symbol;
     switch (resolution)
     {
         case Resolution.Tick:
             Increment = TimeSpan.FromSeconds(0);
             break;
         case Resolution.Second:
             Increment = TimeSpan.FromSeconds(1);
             break;
         default:
         case Resolution.Minute:
             Increment = TimeSpan.FromMinutes(1);
             break;
         case Resolution.Hour:
             Increment = TimeSpan.FromHours(1);
             break;
         case Resolution.Daily:
             Increment = TimeSpan.FromDays(1);
             break;
     }
 }
开发者ID:kevinalexanderwong,项目名称:QCAlgorithm,代码行数:42,代码来源:SubscriptionDataConfig.cs


示例2: Security

        public Security(Guid securityId, SecurityType securityType, string name, string symbol, CurrencyFormat format, int fractionTraded)
        {
            if (securityId == Guid.Empty)
            {
                throw new ArgumentNullException("securityId");
            }

            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            if (string.IsNullOrEmpty(symbol))
            {
                throw new ArgumentNullException("symbol");
            }

            if (format == null)
            {
                throw new ArgumentNullException("signFormat");
            }

            if (fractionTraded <= 0)
            {
                throw new ArgumentOutOfRangeException("fractionTraded", "The fraction traded must be greater than or equal to one.");
            }

            this.SecurityId = securityId;
            this.SecurityType = securityType;
            this.Name = name;
            this.Symbol = symbol;
            this.Format = format;
            this.FractionTraded = fractionTraded;
        }
开发者ID:otac0n,项目名称:SharpBooks,代码行数:34,代码来源:Security.cs


示例3: Security

        /********************************************************
        * CONSTRUCTOR/DELEGATE DEFINITIONS
        *********************************************************/
        /// <summary>
        /// Construct the Market Vehicle
        /// </summary>
        public Security(string symbol, SecurityType type, Resolution resolution, bool fillDataForward, decimal leverage, bool extendedMarketHours)
        {
            //Set Basics:
            this._symbol = symbol;
            this._type = type;
            this._resolution = resolution;
            this._isFillDataForward = fillDataForward;
            this._leverage = leverage;
            this._isExtendedMarketHours = extendedMarketHours;

            //Holdings for new Vehicle:
            Cache = new SecurityCache();
            Holdings = new SecurityHolding(symbol, Model);
            Exchange = new SecurityExchange();

            //Cannot initalise a default model.
            Model = null;

            //Set data type:
            if (resolution == Resolution.Minute || resolution == Resolution.Second) {
                _dataType = typeof(TradeBar);
            } else {
                _dataType = typeof(Tick);
            }
        }
开发者ID:vdt,项目名称:QCAlgorithm,代码行数:31,代码来源:Security.cs


示例4: Security

        /********************************************************
        * CONSTRUCTOR/DELEGATE DEFINITIONS
        *********************************************************/
        /// <summary>
        /// Construct a new security vehicle based on the user options.
        /// </summary>
        public Security(string symbol, SecurityType type, Resolution resolution, bool fillDataForward, decimal leverage, bool extendedMarketHours, bool isDynamicallyLoadedData = false)
        {
            //Set Basics:
            _symbol = symbol;
            _type = type;
            _resolution = resolution;
            _isFillDataForward = fillDataForward;
            _leverage = leverage;
            _isExtendedMarketHours = extendedMarketHours;
            _isDynamicallyLoadedData = isDynamicallyLoadedData;

            //Setup Transaction Model for this Asset
            switch (type)
            {
                case SecurityType.Equity:
                    Model = new EquityTransactionModel();
                    DataFilter = new EquityDataFilter();
                    break;
                case SecurityType.Forex:
                    Model = new ForexTransactionModel();
                    DataFilter = new ForexDataFilter();
                    break;
                case SecurityType.Base:
                    Model = new SecurityTransactionModel();
                    DataFilter = new SecurityDataFilter();
                    break;
            }

            //Holdings for new Vehicle:
            Cache = new SecurityCache();
            Holdings = new SecurityHolding(symbol, type, Model);
            Exchange = new SecurityExchange();
        }
开发者ID:intelliBrain,项目名称:Lean,代码行数:39,代码来源:Security.cs


示例5: Get

        /// <summary>
        /// Get historical data enumerable for a single symbol, type and resolution given this start and end time (in UTC).
        /// </summary>
        /// <param name="symbol">Symbol for the data we're looking for.</param>
        /// <param name="type">Security type</param>
        /// <param name="resolution">Resolution of the data request</param>
        /// <param name="startUtc">Start time of the data in UTC</param>
        /// <param name="endUtc">End time of the data in UTC</param>
        /// <returns>Enumerable of base data for this symbol</returns>
        public IEnumerable<BaseData> Get(Symbol symbol, SecurityType type, Resolution resolution, DateTime startUtc, DateTime endUtc)
        {
            // We subtract one day to make sure we have data from yahoo
            var finishMonth = endUtc.Month;
            var finishDay = endUtc.Subtract(TimeSpan.FromDays(1)).Day;
            var finishYear = endUtc.Year;
            var url = string.Format(_urlPrototype, symbol, 01, 01, 1990, finishMonth, finishDay, finishYear, "d");

            using (var cl = new WebClient())
            {
                var data = cl.DownloadString(url);
                var lines = data.Split('\n');

                for (var i = lines.Length - 1; i >= 1; i--)
                {
                    var str = lines[i].Split(',');
                    if (str.Length < 6) continue;
                    var ymd = str[0].Split('-');
                    var year = Convert.ToInt32(ymd[0]);
                    var month = Convert.ToInt32(ymd[1]);
                    var day = Convert.ToInt32(ymd[2]);
                    var open = decimal.Parse(str[1]);
                    var high = decimal.Parse(str[2]);
                    var low = decimal.Parse(str[3]);
                    var close = decimal.Parse(str[4]);
                    var volume = int.Parse(str[5]);
                    yield return new TradeBar(new DateTime(year, month, day), symbol, open, high, low, close, volume, TimeSpan.FromDays(1));
                }
            }
        }
开发者ID:reinhardtken,项目名称:Lean,代码行数:39,代码来源:YahooDataDownloader.cs


示例6: HistoryRequest

 /// <summary>
 /// Initializes a new instance of the <see cref="HistoryRequest"/> class from the specified parameters
 /// </summary>
 /// <param name="startTimeUtc">The start time for this request,</param>
 /// <param name="endTimeUtc">The start time for this request</param>
 /// <param name="dataType">The data type of the output data</param>
 /// <param name="symbol">The symbol to request data for</param>
 /// <param name="securityType">The security type of the symbol</param>
 /// <param name="resolution">The requested data resolution</param>
 /// <param name="market">The market this data belongs to</param>
 /// <param name="exchangeHours">The exchange hours used in fill forward processing</param>
 /// <param name="fillForwardResolution">The requested fill forward resolution for this request</param>
 /// <param name="includeExtendedMarketHours">True to include data from pre/post market hours</param>
 /// <param name="isCustomData">True for custom user data, false for normal QC data</param>
 public HistoryRequest(DateTime startTimeUtc, 
     DateTime endTimeUtc,
     Type dataType,
     Symbol symbol,
     SecurityType securityType,
     Resolution resolution,
     string market,
     SecurityExchangeHours exchangeHours,
     Resolution? fillForwardResolution,
     bool includeExtendedMarketHours,
     bool isCustomData
     )
 {
     StartTimeUtc = startTimeUtc;
     EndTimeUtc = endTimeUtc;
     Symbol = symbol;
     ExchangeHours = exchangeHours;
     Resolution = resolution;
     FillForwardResolution = fillForwardResolution;
     IncludeExtendedMarketHours = includeExtendedMarketHours;
     DataType = dataType;
     SecurityType = securityType;
     Market = market;
     IsCustomData = isCustomData;
     TimeZone = exchangeHours.TimeZone;
 }
开发者ID:vikewoods,项目名称:Lean,代码行数:40,代码来源:HistoryRequest.cs


示例7: Connection

 public Connection(string dataSource, SecurityType securityType, string userId, string password)
 {
     m_DataSource = dataSource;
     m_Password = password;
     m_UserId = userId;
     m_SecurityType = securityType;
 }
开发者ID:tiestvilee,项目名称:GUI-experiment,代码行数:7,代码来源:Connection.cs


示例8: Security

        /********************************************************
        * CONSTRUCTOR/DELEGATE DEFINITIONS
        *********************************************************/
        /// <summary>
        /// Construct the Market Vehicle
        /// </summary>
        public Security(string symbol, SecurityType type, Resolution resolution, bool fillDataForward, decimal leverage, bool extendedMarketHours, bool useQuantConnectData = false)
        {
            //Set Basics:
            this._symbol = symbol;
            this._type = type;
            this._resolution = resolution;
            this._isFillDataForward = fillDataForward;
            this._leverage = leverage;
            this._isExtendedMarketHours = extendedMarketHours;
            this._isQuantConnectData = useQuantConnectData;

            //Setup Transaction Model for this Asset
            switch (type)
            {
                case SecurityType.Equity:
                    Model = new EquityTransactionModel();
                    break;
                case SecurityType.Forex:
                    Model = new ForexTransactionModel();
                    break;
                case SecurityType.Base:
                    Model = new SecurityTransactionModel();
                    break;
            }

            //Holdings for new Vehicle:
            Cache = new SecurityCache();
            Holdings = new SecurityHolding(symbol, Model);
            Exchange = new SecurityExchange();
        }
开发者ID:nagyist,项目名称:QuantConnect-QCAlgorithm,代码行数:36,代码来源:Security.cs


示例9: TradeBar

        /// <summary>
        /// Parse a line from the CSV's into our trade bars.
        /// </summary>
        /// <param name="symbol">Symbol for this tick</param>
        /// <param name="baseDate">Base date of this tick</param>
        /// <param name="line">CSV from data files.</param>
        public TradeBar(SecurityType type, string line, string symbol, DateTime baseDate)
        {
            try {
                string[] csv = line.Split(',');
                //Parse the data into a trade bar:
                this.Symbol = symbol;
                base.Type = MarketDataType.TradeBar;
                decimal scaleFactor = 10000m;

                switch (type)
                {
                    case SecurityType.Equity:
                        Time = baseDate.Date.AddMilliseconds(Convert.ToInt32(csv[0]));
                        Open = Convert.ToDecimal(csv[1]) / scaleFactor;
                        High = Convert.ToDecimal(csv[2]) / scaleFactor;
                        Low = Convert.ToDecimal(csv[3]) / scaleFactor;
                        Close = Convert.ToDecimal(csv[4]) / scaleFactor;
                        Volume = Convert.ToInt64(csv[5]);
                        break;
                    case SecurityType.Forex:
                        Time = DateTime.ParseExact(csv[0], "yyyyMMdd HH:mm:ss.ffff", CultureInfo.InvariantCulture);
                        Open = Convert.ToDecimal(csv[1]);
                        High = Convert.ToDecimal(csv[2]);
                        Low = Convert.ToDecimal(csv[3]);
                        Close = Convert.ToDecimal(csv[4]);
                        break;
                }

                base.Price = Close;
            } catch (Exception err) {
                Log.Error("DataModels: TradeBar(): Error Initializing - " + type + " - " + err.Message + " - " + line);
            }
        }
开发者ID:vdt,项目名称:QCAlgorithm,代码行数:39,代码来源:TradeBar.cs


示例10: ServerTreeNode

 /// <summary>
 /// Initializes a new instance of the <see cref="ServerTreeNode"/> class.
 /// </summary>
 public ServerTreeNode()
 {
     this.ImageIndex = 0;
     this.SelectedImageIndex = 0;
     _sType = SecurityType.Integrated;
     _connected = false;
 }
开发者ID:ViniciusConsultor,项目名称:sqlschematool,代码行数:10,代码来源:ServerTreeNode.cs


示例11: CreateTradeBarDataConfig

 private SubscriptionDataConfig CreateTradeBarDataConfig(SecurityType type)
 {
     if (type == SecurityType.Equity)
         return new SubscriptionDataConfig(typeof(TradeBar), Symbols.USDJPY, Resolution.Minute, TimeZones.NewYork, TimeZones.NewYork, true, true, true);
     if (type == SecurityType.Forex)
         return new SubscriptionDataConfig(typeof(TradeBar), Symbols.USDJPY, Resolution.Minute, TimeZones.EasternStandard, TimeZones.EasternStandard, true, true, true);
     throw new NotImplementedException(type.ToString());
 }
开发者ID:iorixyz,项目名称:Lean,代码行数:8,代码来源:ForexTransactionModelTests.cs


示例12: KrsExecutionFilter

        /// <summary>
        /// Full Constructor
        /// </summary>
        /// <param name="clientId">Filter the results of the ReqExecutions() method based on the clientId.</param>
        /// <param name="acctCode">Filter the results of the ReqExecutions() method based on an account code.</param>
        /// <param name="time">Filter the results of the ReqExecutions() method based on execution reports received after the specified time.</param>
        /// <param name="symbol">Filter the results of the ReqExecutions() method based on the order symbol.</param>
        /// <param name="securityType">Refer to the Contract struct for the list of valid security types.</param>
        /// <param name="exchange">Filter the results of the ReqExecutions() method based on the order exchange.</param>
        /// <param name="side">Filter the results of the ReqExecutions() method based on the order action.</param>
        public KrsExecutionFilter(int clientId, String acctCode, DateTime time, String symbol, SecurityType securityType,
            String exchange, ActionSide side)
        {
            DateTime = time;
            SecurityType = securityType;
            ActionSide = side;

            Convert();
        }
开发者ID:cadoogi,项目名称:IBNet,代码行数:19,代码来源:KrsExecutionFilter.cs


示例13: LeanDataPathComponents

        public readonly Symbol Symbol; // for options this is a 'canonical' symbol using info derived from the path

        /// <summary>
        /// Initializes a new instance of the <see cref="LeanDataPathComponents"/> class
        /// </summary>
        public LeanDataPathComponents(SecurityType securityType, string market, Resolution resolution, Symbol symbol, string filename, DateTime date)
        {
            Date = date;
            SecurityType = securityType;
            Market = market;
            Resolution = resolution;
            Filename = filename;
            Symbol = symbol;
        }
开发者ID:kaffeebrauer,项目名称:Lean,代码行数:14,代码来源:LeanDataPathComponents.cs


示例14: SymbolSecurityType

 /// <summary>
 /// Initialzies a new instance of the <see cref="SymbolSecurityType"/> class
 /// </summary>
 /// <param name="symbol">The symbol of the security</param>
 /// <param name="securityType">The security type of the security</param>
 public SymbolSecurityType(string symbol, SecurityType securityType)
 {
     if (symbol == null)
     {
         throw new ArgumentNullException("symbol");
     }
     Symbol = symbol;
     SecurityType = securityType;
 }
开发者ID:dalebrubaker,项目名称:Lean,代码行数:14,代码来源:SymbolSecurityType.cs


示例15: ProformaSubmitOrderRequest

 public ProformaSubmitOrderRequest(OrderType orderType, SecurityType securityType, string symbol, int quantity, decimal stopPrice, decimal limitPrice, DateTime time, string tag) : base(orderType, securityType, symbol, quantity, stopPrice, limitPrice, time, tag)
 {
     SecurityType = securityType;
     Symbol = symbol.ToUpper();
     OrderType = orderType;
     Quantity = quantity;
     LimitPrice = limitPrice;
     StopPrice = stopPrice;
 }
开发者ID:bizcad,项目名称:LeanITrend,代码行数:9,代码来源:ProformaSubmitOrderRequest.cs


示例16: ConvertSymbol

        private static Symbol ConvertSymbol(string instrument, SecurityType securityType)
        {
            if (securityType == SecurityType.Forex)
            {
                return new Symbol(SecurityIdentifier.GenerateForex(instrument, Market.Oanda), instrument);
            }

            throw new NotImplementedException("The specfied security type has not been implemented yet: " + securityType);
        }
开发者ID:vikewoods,项目名称:Lean,代码行数:9,代码来源:Program.cs


示例17: Add

 /// <summary>
 /// Add Market Data Required (Overloaded method for backwards compatibility).
 /// </summary>
 /// <param name="security">Market Data Asset</param>
 /// <param name="symbol">Symbol of the asset we're like</param>
 /// <param name="resolution">Resolution of Asset Required</param>
 /// <param name="fillDataForward">when there is no data pass the last tradebar forward</param>
 /// <param name="extendedMarketHours">Request premarket data as well when true </param>
 public SubscriptionDataConfig Add(SecurityType security, string symbol, Resolution resolution = Resolution.Minute, bool fillDataForward = true, bool extendedMarketHours = false)
 {
     //Set the type: market data only comes in two forms -- ticks(trade by trade) or tradebar(time summaries)
     var dataType = typeof(TradeBar);
     if (resolution == Resolution.Tick)
     {
         dataType = typeof(Tick);
     }
     return Add(dataType, security, symbol, resolution, fillDataForward, extendedMarketHours, true, true);
 }
开发者ID:reddream,项目名称:Lean,代码行数:18,代码来源:SubscriptionManager.cs


示例18: SecurityHolding

        /// <summary>
        /// Create a new holding class instance setting the initial properties to $0.
        /// </summary>
        public SecurityHolding(string symbol, SecurityType type, ISecurityTransactionModel transactionModel)
        {
            _model = transactionModel;
            _symbol = symbol;
            _securityType = type;

            //Total Sales Volume for the day
            _totalSaleVolume = 0;
            _lastTradeProfit = 0;
        }
开发者ID:intelliBrain,项目名称:Lean,代码行数:13,代码来源:SecurityHolding.cs


示例19: SubmitOrderRequest

 /// <summary>
 /// Initializes a new instance of the <see cref="SubmitOrderRequest"/> class.
 /// The <see cref="OrderRequest.OrderId"/> will default to <see cref="OrderResponseErrorCode.UnableToFindOrder"/>
 /// </summary>
 /// <param name="orderType">The order type to be submitted</param>
 /// <param name="securityType">The symbol's <see cref="SecurityType"/></param>
 /// <param name="symbol">The symbol to be traded</param>
 /// <param name="quantity">The number of units to be ordered</param>
 /// <param name="stopPrice">The stop price for stop orders, non-stop orers this value is ignored</param>
 /// <param name="limitPrice">The limit price for limit orders, non-limit orders this value is ignored</param>
 /// <param name="time">The time this request was created</param>
 /// <param name="tag">A custom tag for this request</param>
 public SubmitOrderRequest(OrderType orderType, SecurityType securityType, string symbol, int quantity, decimal stopPrice, decimal limitPrice, DateTime time, string tag)
     : base(time, (int) OrderResponseErrorCode.UnableToFindOrder, tag)
 {
     SecurityType = securityType;
     Symbol = symbol.ToUpper();
     OrderType = orderType;
     Quantity = quantity;
     LimitPrice = limitPrice;
     StopPrice = stopPrice;
 }
开发者ID:rchien,项目名称:Lean,代码行数:22,代码来源:SubmitOrderRequest.cs


示例20: GetLeanSymbol

        /// <summary>
        /// Converts an InteractiveBrokers symbol to a Lean symbol instance
        /// </summary>
        /// <param name="brokerageSymbol">The InteractiveBrokers symbol</param>
        /// <param name="securityType">The security type</param>
        /// <param name="market">The market</param>
        /// <returns>A new Lean Symbol instance</returns>
        public Symbol GetLeanSymbol(string brokerageSymbol, SecurityType securityType, string market)
        {
            if (string.IsNullOrWhiteSpace(brokerageSymbol))
                throw new ArgumentException("Invalid symbol: " + brokerageSymbol);

            if (securityType != SecurityType.Forex && securityType != SecurityType.Equity)
                throw new ArgumentException("Invalid security type: " + securityType);

            return Symbol.Create(brokerageSymbol, securityType, market);
        }
开发者ID:skyfyl,项目名称:Lean,代码行数:17,代码来源:InteractiveBrokersSymbolMapper.cs



注:本文中的SecurityType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SecurityZone类代码示例发布时间:2022-05-24
下一篇:
C# SecurityTokenRequirement类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap