public IbClient(RequestsClient client, MyAppSettings settings) { Client = client; Signal = new EReaderMonitorSignal(); ClientSocket = new EClientSocket(this, Signal); AccountNumber = settings.AccountNumber; AccountID = settings.AccountID; InstrumentID = settings.InstrumentID; }
public StrategyLauncher(IbClient wrapper, MyAppSettings settings, bool useMatlab = false) { if (useMatlab) { //InitMatlabStrategy(); } else { InitNetStrategy(wrapper, settings); } }
private static void GetAccountNumberAndAccountID() { var requestClient = new RequestsClient( MyAppSettings.PushSocketPort, MyAppSettings.RequestSocketPort); var acc = requestClient.RequestAccount(MyAppSettings.AccountID); if (acc == null) { throw new ArgumentNullException("No account info received."); } requestClient.Dispose(); ConfigurationRoot.GetSection("AccountNumber").Value = acc.AccountNumber; ConfigurationRoot.GetSection("AccountID").Value = acc.ID.ToString(); ConfigurationRoot.Reload(); MyAppSettings = JsonConvert.DeserializeObject <MyAppSettings>(ConfigurationRoot.GetSection("MyAppSettings").Value); }
public static void Main(string[] args) { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); ConfigurationRoot = builder.Build(); var app = new MyAppSettings(); ///ConfigurationRoot ConfigurationRoot.Bind("AppSettings", app); app.AccountID = 4; ConfigurationRoot.Reload();; MyAppSettings MyAppSettings = app; AccountID = MyAppSettings.AccountID; SetAndCreateLogDirectory(MyAppSettings.LogDirectory); MappingConfiguration.Register(); GetAccountNumberAndAccountID(); ConnectToIb(); new StrategyLauncher(wrapper, MyAppSettings); }
private void InitNetStrategy(IbClient wrapper, MyAppSettings settings) { strategy = new SimplestNetStrategy(wrapper, settings); strategy.StartTrading(); }