GeezerVison is showing github.com — Rework liquidity provider & country code to generic Market class, com… · nuswgg/Lean@26e8cf4
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: Algorithm.Python/PythonAlgorithm.cs +7-7Lines changed: 7 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -37,14 +37,14 @@ public override void Initialize() | 37 | 37 | PythonEngine.Initialize(); | 38 | 38 | _gs = PythonEngine.AcquireLock(); | 39 | 39 |
| 40 | | - const string s = @"../../../../tests"; | 41 | | - Type RTClass = typeof(Runtime.Runtime); | | 40 | + //const string s = @"../../../../tests"; | | 41 | + //Type RTClass = typeof(Runtime.Runtime); | 42 | 42 |
| 43 | | - /* pyStrPtr = PyString_FromString(s); */ | 44 | | - MethodInfo PyString_FromString = RTClass.GetMethod("PyString_FromString", BindingFlags.NonPublic | BindingFlags.Static); | 45 | | - object[] funcArgs = new object[1]; | 46 | | - funcArgs[0] = s; | 47 | | - IntPtr pyStrPtr = (IntPtr)PyString_FromString.Invoke(null, funcArgs); | | 43 | + ///* pyStrPtr = PyString_FromString(s); */ | | 44 | + //MethodInfo PyString_FromString = RTClass.GetMethod("PyString_FromString", BindingFlags.NonPublic | BindingFlags.Static); | | 45 | + //object[] funcArgs = new object[1]; | | 46 | + //funcArgs[0] = s; | | 47 | + //IntPtr pyStrPtr = (IntPtr)PyString_FromString.Invoke(null, funcArgs); | 48 | 48 |
| 49 | 49 | } | 50 | 50 |
| |
Collapse file Copy file name to clipboardExpand all lines: Algorithm.VisualBasic/QuantConnect.Algorithm.VisualBasic.vbproj +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 89 | 89 | <Name>QuantConnect.Interfaces</Name> | 90 | 90 | </ProjectReference> | 91 | 91 | </ItemGroup> | | 92 | + <ItemGroup> | | 93 | + <Folder Include="My Project\" /> | | 94 | + </ItemGroup> | 92 | 95 | <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> | 93 | 96 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | 94 | 97 | Other similar extension points exist, see Microsoft.Common.targets. | |
Collapse file Copy file name to clipboardExpand all lines: AlgorithmFactory/Loader.cs +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -164,7 +164,7 @@ public bool TryCreateAlgorithmInstance(string assemblyPath, out IAlgorithm algor | 164 | 164 |
| 165 | 165 | //Get the list of extention classes in the library: | 166 | 166 | var types = GetExtendedTypeNames(assembly); | 167 | | - Log.Trace("Loader.CreateInstance(): Assembly types: " + string.Join(",", types)); | | 167 | + Log.Debug("Loader.CreateInstance(): Assembly types: " + string.Join(",", types)); | 168 | 168 |
| 169 | 169 | //No extensions, nothing to load. | 170 | 170 | if (types.Count == 0) | |
Collapse file Copy file name to clipboardExpand all lines: Common/Data/Market/Tick.cs +3-17Lines changed: 3 additions & 17 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -285,26 +285,12 @@ public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, | 285 | 285 | string source; | 286 | 286 | var symbol = string.IsNullOrEmpty(config.MappedSymbol) ? config.Symbol : config.MappedSymbol; | 287 | 287 | var securityType = config.SecurityType.ToString().ToLower(); | 288 | | - var countryCode = config.Country.ToString().ToLower(); | | 288 | + var market = config.Market.ToLower(); | 289 | 289 | var resolution = config.Resolution.ToString().ToLower(); | 290 | 290 | var file = date.ToString(dateFormat) + "_" + dataType.ToString().ToLower() + ".zip"; | 291 | 291 |
| 292 | | - if (config.SecurityType == SecurityType.Equity) | 293 | | - { | 294 | | - //Add in the country code for equities for internationalization support. | 295 | | - source = Path.Combine(Constants.DataFolder, securityType, countryCode, resolution, symbol.ToLower(), file); | 296 | | - } | 297 | | - else if (config.SecurityType == SecurityType.Forex || config.SecurityType == SecurityType.Cfd) | 298 | | - { | 299 | | - //FX, CFD's are brokerage/liquidity provider specific (eg. different brokerages have different spreads). | 300 | | - var dataSource = config.LiquiditySource.ToString().ToLower(); | 301 | | - source = Path.Combine(Constants.DataFolder, securityType, dataSource, resolution, symbol.ToLower(), file); | 302 | | - } | 303 | | - else | 304 | | - { | 305 | | - //All other asset types default here | 306 | | - source = Path.Combine(Constants.DataFolder, securityType, resolution, symbol.ToLower(), file); | 307 | | - } | | 292 | + //Add in the market for equities/cfd/forex for internationalization support. | | 293 | + source = Path.Combine(Constants.DataFolder, securityType, market, resolution, symbol.ToLower(), file); | 308 | 294 |
| 309 | 295 | return new SubscriptionDataSource(source, SubscriptionTransportMedium.LocalFile); | 310 | 296 | } | |
Collapse file Copy file name to clipboardExpand all lines: Common/Data/Market/TradeBar.cs +2-11Lines changed: 2 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -333,8 +333,7 @@ public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, | 333 | 333 | var securityTypePath = config.SecurityType.ToString().ToLower(); | 334 | 334 | var resolutionPath = config.Resolution.ToString().ToLower(); | 335 | 335 | var symbolPath = (string.IsNullOrEmpty(config.MappedSymbol) ? config.Symbol : config.MappedSymbol).ToLower(); | 336 | | - var countryCode = config.Country.ToString().ToLower(); | 337 | | - var liquiditySource = config.LiquiditySource.ToString().ToLower(); | | 336 | + var market = config.Market.ToLower(); | 338 | 337 | var filename = date.ToString(dateFormat) + "_" + dataType.ToString().ToLower() + ".zip"; | 339 | 338 |
| 340 | 339 |
| @@ -345,15 +344,7 @@ public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, | 345 | 344 | symbolPath = string.Empty; | 346 | 345 | } | 347 | 346 |
| 348 | | - if (config.Country == CountryCode.None) | 349 | | - { | 350 | | - //No country are international or brokerage specific liquidity providers with certain spreads. | 351 | | - source = Path.Combine(Constants.DataFolder, securityTypePath, liquiditySource, resolutionPath, symbolPath, filename); | 352 | | - } | 353 | | - else | 354 | | - { | 355 | | - source = Path.Combine(Constants.DataFolder, securityTypePath, countryCode, resolutionPath, symbolPath, filename); | 356 | | - } | | 347 | + source = Path.Combine(Constants.DataFolder, securityTypePath, market, resolutionPath, symbolPath, filename); | 357 | 348 |
| 358 | 349 | return new SubscriptionDataSource(source, SubscriptionTransportMedium.LocalFile); | 359 | 350 | } | |
Collapse file Copy file name to clipboardExpand all lines: Common/Data/SubscriptionDataConfig.cs +2-7Lines changed: 2 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -103,14 +103,9 @@ public class SubscriptionDataConfig | 103 | 103 | public string MappedSymbol; | 104 | 104 |
| 105 | 105 | /// <summary> | 106 | | - /// Country code for the subscription | | 106 | + /// Set the market / scope of the symbol | 107 | 107 | /// </summary> | 108 | | - public CountryCode Country = CountryCode.None; | 109 | | - | 110 | | - /// <summary> | 111 | | - /// The liquidity provider source for the data. | 112 | | - /// </summary> | 113 | | - public LiquidityProviderDataSource LiquiditySource = LiquidityProviderDataSource.NotApplicable; | | 108 | + public string Market; | 114 | 109 |
| 115 | 110 | /// <summary> | 116 | 111 | /// Consolidators that are registred with this subscription | |
Collapse file Copy file name to clipboardExpand all lines: Common/Data/SubscriptionManager.cs +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -93,11 +93,11 @@ public SubscriptionDataConfig Add(Type dataType, SecurityType security, string s | 93 | 93 | { | 94 | 94 | case SecurityType.Forex: | 95 | 95 | //Currently QC FX data source is FXCM pricing. | 96 | | - newConfig.LiquiditySource = LiquidityProviderDataSource.FXCM; | | 96 | + newConfig.Market = QuantConnect.Market.FXCM; | 97 | 97 | break; | 98 | 98 | case SecurityType.Equity: | 99 | 99 | //Currently QC Equities are US Only. | 100 | | - newConfig.Country = CountryCode.USA; | | 100 | + newConfig.Market = QuantConnect.Market.USA; | 101 | 101 | break; | 102 | 102 | } | 103 | 103 |
| |
Collapse file Copy file name to clipboardExpand all lines: Common/Global.cs -58Lines changed: 0 additions & 58 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -322,64 +322,6 @@ public enum Resolution | 322 | 322 | Daily | 323 | 323 | } | 324 | 324 |
| 325 | | - /// <summary> | 326 | | - /// Country codes for data grouping to support internationalization | 327 | | - /// </summary> | 328 | | - public enum CountryCode | 329 | | - { | 330 | | - /// No country / global. | 331 | | - None, | 332 | | - /// United States | 333 | | - USA, | 334 | | - /// United Kingdom | 335 | | - GBR, | 336 | | - /// Japan | 337 | | - JPN, | 338 | | - /// Germany | 339 | | - DEU, | 340 | | - /// China | 341 | | - CHN, | 342 | | - /// India | 343 | | - IND, | 344 | | - /// Brazil | 345 | | - BRA, | 346 | | - /// Australia | 347 | | - AUS, | 348 | | - /// Switzerland | 349 | | - CHE, | 350 | | - /// Hong Kong | 351 | | - HKG, | 352 | | - /// Canada | 353 | | - CAN, | 354 | | - /// France | 355 | | - FRA, | 356 | | - /// Spain | 357 | | - ESP, | 358 | | - /// Mexico | 359 | | - MEX, | 360 | | - /// Korea | 361 | | - KOR, | 362 | | - /// South Africa | 363 | | - ZAF, | 364 | | - /// Taiwan | 365 | | - TWN | 366 | | - } | 367 | | - | 368 | | - | 369 | | - /// <summary> | 370 | | - /// Data source for data which is liquidity provider specific, such as CFD or Forex. | 371 | | - /// </summary> | 372 | | - public enum LiquidityProviderDataSource | 373 | | - { | 374 | | - /// Liquidity is exchange driven and not brokerage specific. | 375 | | - NotApplicable, | 376 | | - | 377 | | - /// FXCM Supplies Lean Forex Data | 378 | | - FXCM, | 379 | | - | 380 | | - /// Oanda supplies Lean Forex and Cfd Data | 381 | | - Oanda | 382 | | - } | 383 | 325 |
| 384 | 326 | /// <summary> | 385 | 327 | /// Wrapper for algorithm status enum to include the charting subscription. | |
Collapse file Copy file name to clipboard +38Lines changed: 38 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +/* | | 2 | + * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. | | 3 | + * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. | | 4 | + * | | 5 | + * Licensed under the Apache License, Version 2.0 (the "License"); | | 6 | + * you may not use this file except in compliance with the License. | | 7 | + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | | 8 | + * | | 9 | + * Unless required by applicable law or agreed to in writing, software | | 10 | + * distributed under the License is distributed on an "AS IS" BASIS, | | 11 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | | 12 | + * See the License for the specific language governing permissions and | | 13 | + * limitations under the License. | | 14 | +*/ | | 15 | +namespace QuantConnect | | 16 | +{ | | 17 | + /// <summary> | | 18 | + /// Markets Collection: Soon to be expanded to a collection of items specifying the market hour, timezones and country codes. | | 19 | + /// </summary> | | 20 | + public static class Market | | 21 | + { | | 22 | + /// <summary> | | 23 | + /// USA Market | | 24 | + /// </summary> | | 25 | + public static string USA = "usa"; | | 26 | + | | 27 | + /// <summary> | | 28 | + /// Oanda Market | | 29 | + /// </summary> | | 30 | + public static string Oanda = "oanda"; | | 31 | + | | 32 | + /// <summary> | | 33 | + /// FXCM Market Hours | | 34 | + /// </summary> | | 35 | + public static string FXCM = "fxcm"; | | 36 | + | | 37 | + } | | 38 | +} |
Collapse file Copy file name to clipboardExpand all lines: Common/QuantConnect.csproj +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 132 | 132 | <Compile Include="Data\Market\Splits.cs" /> | 133 | 133 | <Compile Include="Data\SubscriptionDataSource.cs" /> | 134 | 134 | <Compile Include="Field.cs" /> | | 135 | + <Compile Include="Market.cs" /> | 135 | 136 | <Compile Include="Notifications\Notification.cs" /> | 136 | 137 | <Compile Include="Notifications\NotificationManager.cs" /> | 137 | 138 | <Compile Include="Orders\MarketOnCloseOrder.cs" /> | |
|