示例#1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new OptionsTrackerContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <OptionsTrackerContext> >()))
            {
                if (context.Trades.Any())
                {
                    return;   // DB has been seeded
                }

                context.Trades.AddRange(
                    new Trade
                {
                    Market         = "ZC",
                    ContractMonth  = "Z20",
                    ContractType   = "Call",
                    StrikePrice    = "540",
                    ExpirationDate = DateTime.Parse("2020-11-30"),
                    EntryDate      = DateTime.Parse("2020-04-02"),
                    NbrOfContracts = 2,
                    EntryPrice     = 35,
                    CurrentPrice   = 50,
                    CommissionFees = 13.47M,
                    ExitDate       = DateTime.Parse("2020-10-15"),
                    ExitPrice      = 50
                },


                    new Trade
                {
                    Market         = "ZS",
                    ContractMonth  = "H21",
                    ContractType   = "Put",
                    StrikePrice    = "1260",
                    ExpirationDate = DateTime.Parse("2021-02-15"),
                    EntryDate      = DateTime.Parse("2020-07-11"),
                    NbrOfContracts = 2,
                    EntryPrice     = 51,
                    CurrentPrice   = 34,
                    CommissionFees = 12.89M,
                    ExitDate       = DateTime.Parse("2020-09-23"),
                    ExitPrice      = 49
                }

                    );
                context.SaveChanges();
            }
        }
示例#2
0
 public IndexModel(OptionsTrackerContext context)
 {
     _context = context;
 }
示例#3
0
 public CreateModel(OptionsTrackerContext context)
 {
     _context = context;
 }
 public DeleteModel(OptionsTrackerContext context)
 {
     _context = context;
 }
 public EditModel(OptionsTrackerContext context)
 {
     _context = context;
 }
示例#6
0
 public DetailsModel(OptionsTrackerContext context)
 {
     _context = context;
 }