Lean
$LEAN_TAG$
|
Provides access to exchange hours and raw data times zones in various markets More...
Classes | |
class | Entry |
Represents a single entry in the MarketHoursDatabase More... | |
Public Member Functions | |
MarketHoursDatabase (Dictionary< SecurityDatabaseKey, Entry > exchangeHours) | |
Initializes a new instance of the MarketHoursDatabase class More... | |
SecurityExchangeHours | GetExchangeHours (SubscriptionDataConfig configuration) |
Convenience method for retrieving exchange hours from market hours database using a subscription config More... | |
SecurityExchangeHours | GetExchangeHours (string market, Symbol symbol, SecurityType securityType) |
Convenience method for retrieving exchange hours from market hours database using a subscription config More... | |
DateTimeZone | GetDataTimeZone (string market, Symbol symbol, SecurityType securityType) |
Performs a lookup using the specified information and returns the data's time zone if found, if an entry is not found, an exception is thrown More... | |
virtual Entry | SetEntry (string market, string symbol, SecurityType securityType, SecurityExchangeHours exchangeHours, DateTimeZone dataTimeZone=null) |
Sets the entry for the specified market/symbol/security-type. This is intended to be used by custom data and other data sources that don't have explicit entries in market-hours-database.csv. At run time, the algorithm can update the market hours database via calls to AddData. More... | |
virtual Entry | SetEntryAlwaysOpen (string market, string symbol, SecurityType securityType, DateTimeZone timeZone) |
Convenience method for the common custom data case. Sets the entry for the specified symbol using SecurityExchangeHours.AlwaysOpen(timeZone) This sets the data time zone equal to the exchange time zone as well. More... | |
virtual Entry | GetEntry (string market, string symbol, SecurityType securityType) |
Gets the entry for the specified market/symbol/security-type More... | |
bool | TryGetEntry (string market, Symbol symbol, SecurityType securityType, out Entry entry) |
Tries to get the entry for the specified market/symbol/security-type More... | |
bool | TryGetEntry (string market, string symbol, SecurityType securityType, out Entry entry) |
Tries to get the entry for the specified market/symbol/security-type More... | |
virtual Entry | GetEntry (string market, Symbol symbol, SecurityType securityType) |
Gets the entry for the specified market/symbol/security-type More... | |
Static Public Member Functions | |
static void | Reset () |
Resets the market hours database, forcing a reload when reused. Called in tests where multiple algorithms are run sequentially, and we need to guarantee that every test starts with the same environment. More... | |
static MarketHoursDatabase | FromDataFolder () |
Gets the instance of the MarketHoursDatabase class produced by reading in the market hours data found in /Data/market-hours/ More... | |
static MarketHoursDatabase | FromFile (string path) |
Reads the specified file as a market hours database instance More... | |
static string | GetDatabaseSymbolKey (Symbol symbol) |
Gets the correct string symbol to use as a database key More... | |
Public Attributes | |
List< KeyValuePair< SecurityDatabaseKey, Entry > > | ExchangeHoursListing => _entries.ToList() |
Gets all the exchange hours held by this provider More... | |
Protected Member Functions | |
bool | ContainsKey (SecurityDatabaseKey key) |
Determines if the database contains the specified key More... | |
Properties | |
static MarketHoursDatabase | AlwaysOpen [get] |
Gets a MarketHoursDatabase that always returns SecurityExchangeHours.AlwaysOpen More... | |
Provides access to exchange hours and raw data times zones in various markets
Definition at line 33 of file MarketHoursDatabase.cs.
QuantConnect.Securities.MarketHoursDatabase.MarketHoursDatabase | ( | Dictionary< SecurityDatabaseKey, Entry > | exchangeHours | ) |
Initializes a new instance of the MarketHoursDatabase class
exchangeHours | The full listing of exchange hours by key |
Definition at line 67 of file MarketHoursDatabase.cs.
SecurityExchangeHours QuantConnect.Securities.MarketHoursDatabase.GetExchangeHours | ( | SubscriptionDataConfig | configuration | ) |
Convenience method for retrieving exchange hours from market hours database using a subscription config
configuration | The subscription data config to get exchange hours for |
Definition at line 77 of file MarketHoursDatabase.cs.
SecurityExchangeHours QuantConnect.Securities.MarketHoursDatabase.GetExchangeHours | ( | string | market, |
Symbol | symbol, | ||
SecurityType | securityType | ||
) |
Convenience method for retrieving exchange hours from market hours database using a subscription config
market | The market the exchange resides in, i.e, 'usa', 'fxcm', ect... |
symbol | The particular symbol being traded |
securityType | The security type of the symbol |
Definition at line 89 of file MarketHoursDatabase.cs.
DateTimeZone QuantConnect.Securities.MarketHoursDatabase.GetDataTimeZone | ( | string | market, |
Symbol | symbol, | ||
SecurityType | securityType | ||
) |
Performs a lookup using the specified information and returns the data's time zone if found, if an entry is not found, an exception is thrown
market | The market the exchange resides in, i.e, 'usa', 'fxcm', ect... |
symbol | The particular symbol being traded |
securityType | The security type of the symbol |
Definition at line 102 of file MarketHoursDatabase.cs.
|
static |
Resets the market hours database, forcing a reload when reused. Called in tests where multiple algorithms are run sequentially, and we need to guarantee that every test starts with the same environment.
Definition at line 112 of file MarketHoursDatabase.cs.
|
static |
Gets the instance of the MarketHoursDatabase class produced by reading in the market hours data found in /Data/market-hours/
Definition at line 139 of file MarketHoursDatabase.cs.
|
static |
Reads the specified file as a market hours database instance
path | The market hours database file path |
Definition at line 162 of file MarketHoursDatabase.cs.
|
virtual |
Sets the entry for the specified market/symbol/security-type. This is intended to be used by custom data and other data sources that don't have explicit entries in market-hours-database.csv. At run time, the algorithm can update the market hours database via calls to AddData.
market | The market the exchange resides in, i.e, 'usa', 'fxcm', ect... |
symbol | The particular symbol being traded |
securityType | The security type of the symbol |
exchangeHours | The exchange hours for the specified symbol |
dataTimeZone | The time zone of the symbol's raw data. Optional, defaults to the exchange time zone |
Definition at line 179 of file MarketHoursDatabase.cs.
|
virtual |
Convenience method for the common custom data case. Sets the entry for the specified symbol using SecurityExchangeHours.AlwaysOpen(timeZone) This sets the data time zone equal to the exchange time zone as well.
market | The market the exchange resides in, i.e, 'usa', 'fxcm', ect... |
symbol | The particular symbol being traded |
securityType | The security type of the symbol |
timeZone | The time zone of the symbol's exchange and raw data |
Definition at line 202 of file MarketHoursDatabase.cs.
|
virtual |
Gets the entry for the specified market/symbol/security-type
market | The market the exchange resides in, i.e, 'usa', 'fxcm', ect... |
symbol | The particular symbol being traded |
securityType | The security type of the symbol |
Definition at line 214 of file MarketHoursDatabase.cs.
bool QuantConnect.Securities.MarketHoursDatabase.TryGetEntry | ( | string | market, |
Symbol | symbol, | ||
SecurityType | securityType, | ||
out Entry | entry | ||
) |
Tries to get the entry for the specified market/symbol/security-type
market | The market the exchange resides in, i.e, 'usa', 'fxcm', ect... |
symbol | The particular symbol being traded |
securityType | The security type of the symbol |
entry | The entry found if any |
Definition at line 252 of file MarketHoursDatabase.cs.
bool QuantConnect.Securities.MarketHoursDatabase.TryGetEntry | ( | string | market, |
string | symbol, | ||
SecurityType | securityType, | ||
out Entry | entry | ||
) |
Tries to get the entry for the specified market/symbol/security-type
market | The market the exchange resides in, i.e, 'usa', 'fxcm', ect... |
symbol | The particular symbol being traded |
securityType | The security type of the symbol |
entry | The entry found if any |
Definition at line 265 of file MarketHoursDatabase.cs.
|
virtual |
Gets the entry for the specified market/symbol/security-type
market | The market the exchange resides in, i.e, 'usa', 'fxcm', ect... |
symbol | The particular symbol being traded (Symbol class) |
securityType | The security type of the symbol |
Definition at line 286 of file MarketHoursDatabase.cs.
|
static |
Gets the correct string symbol to use as a database key
symbol | The symbol |
Definition at line 296 of file MarketHoursDatabase.cs.
|
protected |
Determines if the database contains the specified key
key | The key to search for |
Definition at line 332 of file MarketHoursDatabase.cs.
List<KeyValuePair<SecurityDatabaseKey,Entry> > QuantConnect.Securities.MarketHoursDatabase.ExchangeHoursListing => _entries.ToList() |
Gets all the exchange hours held by this provider
Definition at line 45 of file MarketHoursDatabase.cs.
|
staticget |
Gets a MarketHoursDatabase that always returns SecurityExchangeHours.AlwaysOpen
Definition at line 51 of file MarketHoursDatabase.cs.