Example #1
0
 public static void Delete4AccountGroup(int account_group_id)
 {
     string[] keys = TradeRA.KeySearch("G_" + account_group_id + "_*");
     foreach (string key in keys)
     {
         TradeRA.Delete(key);
     }
 }
Example #2
0
        public static List <Position> List4Account(int account_id)
        {
            List <Position> list = new List <Position>();

            string[] keys = TradeRA.KeySearch("P_*_A_" + account_id + "_U_*");
            foreach (string key in keys)
            {
                list.Add(Get(key));
            }
            return(list);
        }
Example #3
0
        public static List <Position> List4Unit(int unit_id)
        {
            List <Position> list = new List <Position>();

            string[] keys = TradeRA.KeySearch("P_*_U_" + unit_id);
            foreach (string key in keys)
            {
                list.Add(Get(key));
            }
            return(list);
        }
Example #4
0
        public static int GetSellable(int unit_id, string code)
        {
            int count_sellable = 0;

            string[] keys = TradeRA.KeySearch("P_" + code + "_A_*_U_" + unit_id);
            foreach (string key in keys)
            {
                count_sellable += TradeRA.GetInt(key, "count_sellable");
            }
            return(count_sellable);
        }
Example #5
0
        public static List <AccountGroupItem> List4Unit(int unit_id)
        {
            List <AccountGroupItem> list = new List <AccountGroupItem>();

            string[] keys = TradeRA.KeySearch("G_*_U_" + unit_id + "_A_*");
            foreach (string key in keys)
            {
                list.Add(Get(key));
            }
            return(list);
        }
Example #6
0
        public static List <Order> List4Trade(string trade_no)
        {
            List <Order> list = new List <Order>();

            string[] keys = TradeRA.KeySearch("O_*_T_" + trade_no + "*");
            foreach (string key in keys)
            {
                list.Add(Get(key));
            }
            return(list);
        }
Example #7
0
        public static IEnumerable <Order> List4Failed(Model.Search.SearchOrderStatus model)
        {
            List <Order> list = new List <Order>();

            string[] keys = TradeRA.KeySearch("O_*_F");
            foreach (string key in keys)
            {
                list.Add(Get(key));
            }
            return(list.Where(o => o.state_enum == model.status));
        }
Example #8
0
        public static void UpdateCapitalStockValue(string ua, decimal value)
        {
            List <AccountGroupItem> list = new List <AccountGroupItem>();

            string[] keys = TradeRA.KeySearch("G_*_" + ua);

            if (keys.Length > 0)
            {
                Dictionary <string, string> items = new Dictionary <string, string>();
                items.Add("capital_stock_value", value.ToString());
                items.Add("calculated_time", DateTime.Now.Format());
                TradeRA.SetFields(keys[0], items);
            }
        }
Example #9
0
        public static List <Order> List4In()
        {
            List <Order> list = new List <Order>();

            string[] keys = TradeRA.KeySearch("O_*");
            foreach (string key in keys)
            {
                if (!key.EndsWith("_F") && !key.EndsWith("U_0"))
                {
                    list.Add(Get(key));
                }
            }
            return(list);
        }