本文整理汇总了C#中SecurityType类的典型用法代码示例。如果您正苦于以下问题:C# SecurityType类的具体用法?C# SecurityType怎么用?C# SecurityType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SecurityType类属于命名空间,在下文中一共展示了SecurityType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例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;
}
示例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);
}
}
示例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();
}
示例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));
}
}
}
示例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;
}
示例7: Connection
public Connection(string dataSource, SecurityType securityType, string userId, string password)
{
m_DataSource = dataSource;
m_Password = password;
m_UserId = userId;
m_SecurityType = securityType;
}
示例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();
}
示例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);
}
}
示例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;
}
示例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());
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}