本文整理汇总了C#中Resolution.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Resolution.ToString方法的具体用法?C# Resolution.ToString怎么用?C# Resolution.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resolution
的用法示例。
在下文中一共展示了Resolution.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateZipEntryName
/// <summary>
/// Creates the entry name for a QC zip data file
/// </summary>
public static string CreateZipEntryName(string symbol, SecurityType securityType, DateTime date, Resolution resolution)
{
if (resolution == Resolution.Hour || resolution == Resolution.Daily)
{
return symbol + ".csv";
}
if (securityType == SecurityType.Forex)
{
return String.Format("{0}_{1}_{2}_quote.csv", date.ToString(DateFormat.EightCharacter), symbol.ToLower(), resolution.ToString().ToLower());
}
return String.Format("{0}_{1}_{2}_trade.csv", date.ToString(DateFormat.EightCharacter), symbol.ToLower(), resolution.ToString().ToLower());
}
示例2: CreateZipEntryName
/// <summary>
/// Creates the entry name for a QC zip data file
/// </summary>
public static string CreateZipEntryName(string symbol, SecurityType securityType, DateTime date, Resolution resolution, TickType dataType = TickType.Trade)
{
symbol = symbol.ToLower();
if (resolution == Resolution.Hour || resolution == Resolution.Daily)
{
return symbol + ".csv";
}
//All fx is quote data.
if (securityType == SecurityType.Forex) dataType = TickType.Quote;
return String.Format("{0}_{1}_{2}_{3}.csv", date.ToString(DateFormat.EightCharacter), symbol, resolution.ToString().ToLower(), dataType.ToString().ToLower());
}
示例3: GetCountLimitReason
/// <summary>
/// Gets reason string for having a larger count than the limits
/// </summary>
private string GetCountLimitReason(Resolution resolution)
{
return string.Format("We currently only support {0} {1} at a time due to physical memory limitations", _tickLimit, resolution.ToString().ToLower());
}
示例4: AddSecurity
/// <summary>
/// Add specified data to required list. QC will funnel this data to the handle data routine.
/// </summary>
/// <param name="securityType">MarketType Type: Equity, Commodity, Future or FOREX</param>
/// <param name="symbol">Symbol Reference for the MarketType</param>
/// <param name="resolution">Resolution of the Data Required</param>
/// <param name="fillDataForward">When no data available on a tradebar, return the last data that was generated</param>
/// <param name="leverage">Custom leverage per security</param>
public void AddSecurity(SecurityType securityType, string symbol, Resolution resolution, bool fillDataForward, decimal leverage, bool extendedMarketHours)
{
try
{
if (!_locked) {
symbol = symbol.ToUpper();
if (securityType != SecurityType.Equity && securityType != SecurityType.Forex) {
throw new Exception("We only support Equities or FOREX at this time.");
}
if (_resolution != "" && _resolution != resolution.ToString()) {
throw new Exception("We can only accept one resolution at this time. Make all your datafeeds the lowest resolution you require.");
}
//If it hasn't been set, use some defaults based on the portfolio type:
if (leverage <= 0)
{
switch (securityType)
{
case SecurityType.Equity:
leverage = 1; //RegT = 2 or 4.
break;
case SecurityType.Forex:
leverage = 50;
break;
}
}
//Add the symbol to Data Manager -- generate unified data streams for algorithm events
DataManager.Add(securityType, symbol, resolution, fillDataForward, extendedMarketHours);
//Add the symbol to Securities Manager -- manage collection of portfolio entities for easy access.
Securities.Add(symbol, securityType, resolution, fillDataForward, leverage, extendedMarketHours);
} else {
throw new Exception("Algorithm.AddSecurity(): Cannot add another security after algorithm running.");
}
} catch (Exception err) {
Error("Algorithm.AddMarketData(): " + err.Message);
}
}
示例5: GenerateRelativeZipFilePath
/// <summary>
/// Generates the relative zip file path rooted in the /Data directory
/// </summary>
public static string GenerateRelativeZipFilePath(string symbol, SecurityType securityType, string market, DateTime date, Resolution resolution)
{
var directory = Path.Combine(securityType.ToString().ToLower(), market.ToLower(), resolution.ToString().ToLower());
if (resolution != Resolution.Daily && resolution != Resolution.Hour)
{
directory = Path.Combine(directory, symbol.ToLower());
}
return Path.Combine(directory, GenerateZipFileName(symbol, securityType, date, resolution));
}
示例6: LoadConfigFile
public void LoadConfigFile()
{
//file will always be usersettings.ini
if (!File.Exists("usersettings.ini"))
File.WriteAllLines("usersettings.ini", DefaultSettings);
string[] settings = File.ReadAllLines("usersettings.ini");
foreach(string s in settings)
{
if (s != string.Empty && s[0] != '#') //Allow comments/blank lines in settings file
{
string setting_name = s.Split(' ')[0];
int setting_val = int.Parse(s.Split(' ')[1]);
if (!Settings.ContainsKey(setting_name))
Settings.Add(setting_name, setting_val);
else
Settings[setting_name] = setting_val;
}
}
//Update resolution
Resolution user_res = new Resolution(Settings["ResolutionWidth"], Settings["ResolutionHeight"]);
CurrentResolutionIndex = 0;
for(int i = 0; i < Resolutions.Length; i++)
{
if (Resolutions[i] == user_res)
CurrentResolutionIndex = i;
}
ResolutionText.text = user_res.ToString();
//Update antialiasing level
int user_aa = Settings["AALevel"];
CurrentAAIndex = 0;
for (int i = 0; i < 4; i++)
if (AALevels[i] == user_aa)
CurrentAAIndex = i;
CurrentAAText.text = user_aa.ToString();
int user_wfs = Mathf.Clamp(Settings["Fullscreen"], 0, 1);
FullscreenToggle.isOn = user_wfs == 0 ? false : true;
Screen.SetResolution(Settings["ResolutionWidth"], Settings["ResolutionHeight"], Settings["Fullscreen"] == 1);
QualitySettings.antiAliasing = Settings["AALevel"];
}
示例7: BuildFileName
public string BuildFileName(DataItem dataItem, Country country, Resolution resolution)
{
var url = "{0}_{1}_{2}";
url = string.Format(url, dataItem.ToXString(), resolution.ToXString(), resolution.ToString());
return url;
}