コード例 #1
0
        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;
        }
コード例 #2
0
 public StrategyLauncher(IbClient wrapper, MyAppSettings settings, bool useMatlab = false)
 {
     if (useMatlab)
     {
         //InitMatlabStrategy();
     }
     else
     {
         InitNetStrategy(wrapper, settings);
     }
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 private void InitNetStrategy(IbClient wrapper, MyAppSettings settings)
 {
     strategy = new SimplestNetStrategy(wrapper, settings);
     strategy.StartTrading();
 }