예제 #1
0
        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
 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
        public double CalculateMarginTest(double unlRate, double strike, bool mate, EOptionType type = EOptionType.Call)
        {
            var result = MarginManager.CalculateMargin(unlRate, strike, mate, type);

            return(result);
        }