コード例 #1
0
ファイル: AppManager.cs プロジェクト: avneraz/RoboTrader
        private void BuildManagers()
        {
            AccountManager = new AccountManager(APIWrapper);

            ManagedSecuritiesManager = new ManagedSecuritiesManager(APIWrapper);
            List <ManagedSecurity> activeUNLList;

            UNLManagerDic = new Dictionary <string, SimpleBaseLogic>();
            using (var session = DBSessionFactory.Instance.OpenSession())
            {
                activeUNLList = session.Query <ManagedSecurity>()
                                .Where(contract => contract.IsActive && contract.OptionChain).ToList();
            }
            foreach (var managedSecurity in activeUNLList)
            {
                var unlManager = new UNLManager(managedSecurity, APIWrapper, Distributer);
                UNLManagerDic.Add(managedSecurity.Symbol, unlManager);
                unlManager.PositionNeedToOptimized += UNLManagerOnPositionNeedToOptimized;
            }
            MarginManager = new MarginManager();

            DbWriter = new DBWriter(Configurations.Application.DBWritePeriod);
            Distributer.SetManagers(UNLManagerDic, AccountManager, ManagedSecuritiesManager, DbWriter, MarginManager);
            //UIDataManager = new UIDataManager();
        }
コード例 #2
0
ファイル: Distributer.cs プロジェクト: avneraz/IBRTrader
 public void SetManagers(Dictionary <string, SimpleBaseLogic> unlManagerDic,
                         AccountManager accountManager, ManagedSecuritiesManager managedSecuritiesManager,
                         DBWriter writer, MarginManager marginManager)
 {
     _unlManagersDic           = unlManagerDic;
     _accountManager           = accountManager;
     _managedSecuritiesManager = managedSecuritiesManager;
     _dbWriter     = writer;
     MarginManager = marginManager;
 }
コード例 #3
0
ファイル: AppManager.cs プロジェクト: avneraz/RoboTrader
        public double CalculateMarginTest(double unlRate, double strike, bool mate, EOptionType type = EOptionType.Call)
        {
            var result = MarginManager.CalculateMargin(unlRate, strike, mate, type);

            return(result);
        }