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