public static MonthPerformanceModel GetMonthPerformance(DateTime start)
 {
     using (TradeProAssistantContext context = new TradeProAssistantContext())
     {
         DateTime           end          = start.AddDays(context.TradingSettings.First().Weeks * 7);
         List <TradeTicket> tradeTickets = context.TradeTickets.Where(x => x.Timestamp >= start && x.Timestamp < end).ToList();
         return(new MonthPerformanceModel(start, tradeTickets));
     }
 }
        public ActionResult GetSecurities(String text)
        {
            using (TradeProAssistantContext context = new TradeProAssistantContext())
            {
                List <SecurityModel> result = mapper.Map <List <SecurityModel> >(context.Securities
                                                                                 .Where(x => x.Symbol.Contains(text) || x.Name.Contains(text))
                                                                                 .OrderBy(x => x.Symbol).ToList());

                return(new GuerillaLogisticsApiJsonResult(result));
            }
        }
 public static void Delete(int identifier)
 {
     using (TradeProAssistantContext context = new TradeProAssistantContext())
     {
         try
         {
             FutureContract futurecontract = context.FutureContracts.Find(identifier);
             context.Entry(futurecontract).State = EntityState.Deleted;
             context.SaveChanges();
         }
         catch { }
     }
 }
Esempio n. 4
0
        public static void Delete(Query query)
        {
            using (TradeProAssistantContext context = new TradeProAssistantContext())
            {
                DbQuery <BullPutSpread> dbQuery = context.BullPutSpreads;
                List <int> identifiers          = dbQuery.Where(query.WhereClause).Select(i => i.Identifier).ToList();

                foreach (int identifier in identifiers)
                {
                    Delete(identifier);
                }
            }
        }
Esempio n. 5
0
        public static int Save(WeekCandlestick weekcandlestick)
        {
            using (TradeProAssistantContext context = new TradeProAssistantContext())
            {
                context.Entry(weekcandlestick).State = weekcandlestick.IsNew ?
                                                       EntityState.Added :
                                                       EntityState.Modified;

                context.SaveChanges();

                return(weekcandlestick.Identifier);
            }
        }
Esempio n. 6
0
 public static void Delete(int identifier)
 {
     using (TradeProAssistantContext context = new TradeProAssistantContext())
     {
         try
         {
             WeekCandlestick weekcandlestick = context.WeekCandlesticks.Find(identifier);
             context.Entry(weekcandlestick).State = EntityState.Deleted;
             context.SaveChanges();
         }
         catch { }
     }
 }
        public static int Save(Security security)
        {
            using (TradeProAssistantContext context = new TradeProAssistantContext())
            {
                context.Entry(security).State = security.IsNew ?
                                                EntityState.Added :
                                                EntityState.Modified;

                context.SaveChanges();

                return(security.Identifier);
            }
        }
 public static void Delete(int identifier)
 {
     using (TradeProAssistantContext context = new TradeProAssistantContext())
     {
         try
         {
             Security security = context.Securities.Find(identifier);
             context.Entry(security).State = EntityState.Deleted;
             context.SaveChanges();
         }
         catch { }
     }
 }
Esempio n. 9
0
 public static void Delete(int identifier)
 {
     using (TradeProAssistantContext context = new TradeProAssistantContext())
     {
         try
         {
             EconomicEvent economicevent = context.EconomicEvents.Find(identifier);
             context.Entry(economicevent).State = EntityState.Deleted;
             context.SaveChanges();
         }
         catch { }
     }
 }
 public static void Delete(int identifier)
 {
     using (TradeProAssistantContext context = new TradeProAssistantContext())
     {
         try
         {
             TradeTicket tradeticket = context.TradeTickets.Find(identifier);
             context.Entry(tradeticket).State = EntityState.Deleted;
             context.SaveChanges();
         }
         catch { }
     }
 }
Esempio n. 11
0
 public static void Delete(int identifier)
 {
     using (TradeProAssistantContext context = new TradeProAssistantContext())
     {
         try
         {
             Call call = context.Calls.Find(identifier);
             context.Entry(call).State = EntityState.Deleted;
             context.SaveChanges();
         }
         catch { }
     }
 }
Esempio n. 12
0
 public static void Delete(int identifier)
 {
     using (TradeProAssistantContext context = new TradeProAssistantContext())
     {
         try
         {
             BullPutSpread bullputspread = context.BullPutSpreads.Find(identifier);
             context.Entry(bullputspread).State = EntityState.Deleted;
             context.SaveChanges();
         }
         catch { }
     }
 }
Esempio n. 13
0
        public static int Save(Call call)
        {
            using (TradeProAssistantContext context = new TradeProAssistantContext())
            {
                context.Entry(call).State = call.IsNew ?
                                            EntityState.Added :
                                            EntityState.Modified;

                context.SaveChanges();

                return(call.Identifier);
            }
        }
Esempio n. 14
0
 public static void Delete(int identifier)
 {
     using (TradeProAssistantContext context = new TradeProAssistantContext())
     {
         try
         {
             RiskParameters riskparameters = context.RiskParameters.Find(identifier);
             context.Entry(riskparameters).State = EntityState.Deleted;
             context.SaveChanges();
         }
         catch { }
     }
 }
Esempio n. 15
0
        public static int Save(RiskParameters riskparameters)
        {
            using (TradeProAssistantContext context = new TradeProAssistantContext())
            {
                context.Entry(riskparameters).State = riskparameters.IsNew ?
                                                      EntityState.Added :
                                                      EntityState.Modified;

                context.SaveChanges();

                return(riskparameters.Identifier);
            }
        }
Esempio n. 16
0
 public static void Delete(int identifier)
 {
     using (TradeProAssistantContext context = new TradeProAssistantContext())
     {
         try
         {
             OptionDate optiondate = context.OptionDates.Find(identifier);
             context.Entry(optiondate).State = EntityState.Deleted;
             context.SaveChanges();
         }
         catch { }
     }
 }
Esempio n. 17
0
        public static int Save(OptionDate optiondate)
        {
            using (TradeProAssistantContext context = new TradeProAssistantContext())
            {
                context.Entry(optiondate).State = optiondate.IsNew ?
                                                  EntityState.Added :
                                                  EntityState.Modified;

                context.SaveChanges();

                return(optiondate.Identifier);
            }
        }
Esempio n. 18
0
        public static int Save(EconomicEvent economicevent)
        {
            using (TradeProAssistantContext context = new TradeProAssistantContext())
            {
                context.Entry(economicevent).State = economicevent.IsNew ?
                                                     EntityState.Added :
                                                     EntityState.Modified;

                context.SaveChanges();

                return(economicevent.Identifier);
            }
        }
Esempio n. 19
0
        public static int Save(PairCondor paircondor)
        {
            using (TradeProAssistantContext context = new TradeProAssistantContext())
            {
                context.Entry(paircondor).State = paircondor.IsNew ?
                                                  EntityState.Added :
                                                  EntityState.Modified;

                context.SaveChanges();

                return(paircondor.Identifier);
            }
        }
        public static int Save(TradeTicket tradeticket)
        {
            using (TradeProAssistantContext context = new TradeProAssistantContext())
            {
                context.Entry(tradeticket).State = tradeticket.IsNew ?
                                                   EntityState.Added :
                                                   EntityState.Modified;

                context.SaveChanges();

                return(tradeticket.Identifier);
            }
        }
Esempio n. 21
0
 public static void Delete(int identifier)
 {
     using (TradeProAssistantContext context = new TradeProAssistantContext())
     {
         try
         {
             PairCondor paircondor = context.PairCondors.Find(identifier);
             context.Entry(paircondor).State = EntityState.Deleted;
             context.SaveChanges();
         }
         catch { }
     }
 }
Esempio n. 22
0
        public static int Save(BullPutSpread bullputspread)
        {
            using (TradeProAssistantContext context = new TradeProAssistantContext())
            {
                context.Entry(bullputspread).State = bullputspread.IsNew ?
                                                     EntityState.Added :
                                                     EntityState.Modified;

                context.SaveChanges();

                return(bullputspread.Identifier);
            }
        }
        public static int Save(FutureContract futurecontract)
        {
            using (TradeProAssistantContext context = new TradeProAssistantContext())
            {
                context.Entry(futurecontract).State = futurecontract.IsNew ?
                                                      EntityState.Added :
                                                      EntityState.Modified;

                context.SaveChanges();

                return(futurecontract.Identifier);
            }
        }
 public static void Delete(int identifier)
 {
     using (TradeProAssistantContext context = new TradeProAssistantContext())
     {
         try
         {
             WeeklyIncomeComboCount weeklyincomecombocount = context.WeeklyIncomeComboCounts.Find(identifier);
             context.Entry(weeklyincomecombocount).State = EntityState.Deleted;
             context.SaveChanges();
         }
         catch { }
     }
 }
        public static void Delete(Query query)
        {
            using (TradeProAssistantContext context = new TradeProAssistantContext())
            {
                DbQuery <WeeklyIncomeComboCount> dbQuery = context.WeeklyIncomeComboCounts;
                List <int> identifiers = dbQuery.Where(query.WhereClause).Select(i => i.Identifier).ToList();

                foreach (int identifier in identifiers)
                {
                    Delete(identifier);
                }
            }
        }
        public static int Save(WeeklyIncomeComboCount weeklyincomecombocount)
        {
            using (TradeProAssistantContext context = new TradeProAssistantContext())
            {
                context.Entry(weeklyincomecombocount).State = weeklyincomecombocount.IsNew ?
                                                              EntityState.Added :
                                                              EntityState.Modified;

                context.SaveChanges();

                return(weeklyincomecombocount.Identifier);
            }
        }
 public static void Delete(int identifier)
 {
     using (TradeProAssistantContext context = new TradeProAssistantContext())
     {
         try
         {
             WeeklyIncomeActionPlan weeklyincomeactionplan = context.WeeklyIncomeActionPlans.Find(identifier);
             context.Entry(weeklyincomeactionplan).State = EntityState.Deleted;
             context.SaveChanges();
         }
         catch { }
     }
 }
        public static int Save(WeeklyIncomeActionPlan weeklyincomeactionplan)
        {
            using (TradeProAssistantContext context = new TradeProAssistantContext())
            {
                context.Entry(weeklyincomeactionplan).State = weeklyincomeactionplan.IsNew ?
                                                              EntityState.Added :
                                                              EntityState.Modified;

                context.SaveChanges();

                return(weeklyincomeactionplan.Identifier);
            }
        }
        public static WeeklyIncomeComboCount Get(Query query)
        {
            using (TradeProAssistantContext context = new TradeProAssistantContext())
            {
                DbQuery <WeeklyIncomeComboCount> dbQuery = context.WeeklyIncomeComboCounts;

                if (query.Includes.Count > 0)
                {
                    dbQuery = SetIncludes(dbQuery, query.Includes);
                }

                var weeklyincomecombocounts = dbQuery.Where(query.WhereClause).Take(1);

                return((weeklyincomecombocounts != null && weeklyincomecombocounts.Count() > 0) ? weeklyincomecombocounts.First() : null);
            }
        }
        public static TradeTicket Get(Query query)
        {
            using (TradeProAssistantContext context = new TradeProAssistantContext())
            {
                DbQuery <TradeTicket> dbQuery = context.TradeTickets;

                if (query.Includes.Count > 0)
                {
                    dbQuery = SetIncludes(dbQuery, query.Includes);
                }

                var tradetickets = dbQuery.Where(query.WhereClause).Take(1);

                return((tradetickets != null && tradetickets.Count() > 0) ? tradetickets.First() : null);
            }
        }