Example #1
0
 private static void addPlan(DownloadedTodayPlan plan)
 {
     if (plan.PlanName.Equals("FDDL"))
     {
         if (plan.OrderType == 0)//매수
         {
             s_fddls.addPlan(new FDDLBuyExecution(plan.ID, plan.StockCode, plan.Quantity, plan.Price));
         }
         else if (plan.OrderType == 1)//매도
         {
             s_fddls.addPlan(new FDDLSellExecution(plan.ID, plan.StockCode, plan.Quantity, plan.Price));
         }
     }
 }
Example #2
0
 public static bool loadPlans()
 {
     try
     {
         string[] planList = Directory.GetFiles("./DownloadedPlans");
         foreach (string filename in planList)
         {
             DownloadedTodayPlan plan = JsonConvert.DeserializeObject <DownloadedTodayPlan>(filename);
             addPlan(plan);
         }
         reserveReport();
     }
     catch (Exception e)
     {
         //Log : file error
         ProgramControl.getLogger().Error("Exception : PlanManager : " + e.Message);
         return(false);
     }
     return(true);
 }
Example #3
0
        private static HttpResponse FDDLBuy(HttpRequest request)
        {
            if (request.Headers["Pass"].Equals(SystemInfo.PASS))
            {
                DownloadedTodayPlan downloadedInfo = JsonConvert.DeserializeObject <DownloadedTodayPlan>(request.Content);

                FDDLBuyExecution exe = new FDDLBuyExecution(downloadedInfo.ID, downloadedInfo.StockCode, downloadedInfo.Quantity, downloadedInfo.Price);
                PlanManager.getFDDLManager().addPlan(exe);
                exe.run();

                return(new HttpResponse()
                {
                    ReasonPhrase = "OK",
                    StatusCode = "200"
                });
            }

            return(new HttpResponse()
            {
                ReasonPhrase = "Unauth",
                StatusCode = "401"
            });
        }
Example #4
0
        public static void saveTomorrowPlans(string jsonReq)
        {
            DownloadedTodayPlan plan = JsonConvert.DeserializeObject <DownloadedTodayPlan>(jsonReq);

            File.WriteAllText(string.Format("./DownloadedPlans/{0}.json", plan.ID), jsonReq);
        }