Esempio n. 1
0
        private static ICommisionCalculator CreateCommissionCalculator(SimulatedSymbol dbSymbol)
        {
            switch (dbSymbol.CommissionType)
            {
            case CommonObjects.Enums.ComisionType.PerContract:
                return(new CommissionPerContractCalculator(dbSymbol.CommissionValue));

            case CommonObjects.Enums.ComisionType.Percent:
                return(new CommissionPercentCalculator(dbSymbol.CommissionValue));

            default:
                return(null);
            }
        }
Esempio n. 2
0
 private static Security CreateSecurity(SimulatedSymbol dbSymbol, string dataFeedName)
 {
     return(new Security
     {
         Digit = 2,
         Name = dbSymbol.Symbol,
         AssetClass = "STOCK",
         DataFeed = dataFeedName,
         BaseCurrency = dbSymbol.Currency,
         ContractSize = dbSymbol.ContractSize,
         MarginRate = dbSymbol.Margin,
         MarketOpen = new TimeSpan(8, 0, 0),
         MarketClose = new TimeSpan(17, 0, 0),
         MaxPosition = 500000,
         PriceIncrement = 0.01m,
         QtyIncrement = 1m,
         SecurityId = dbSymbol.Id,
         Symbol = dbSymbol.Symbol,
         UnitOfMeasure = dbSymbol.Currency,
         UnitPrice = 1000,
         CommisionCalculator = CreateCommissionCalculator(dbSymbol)
     });
 }