Ejemplo n.º 1
0
        public static void Add(OrderAutoAdd order, string key)
        {
            Dictionary <string, string> items = new Dictionary <string, string>();

            items.Add("id", order.id.ToString());
            items.Add("unit_id", order.unit_id.ToString());
            items.Add("user_id", order.user_id.ToString());
            items.Add("platform", order.platform.ToString());
            items.Add("account_id", order.account_id.ToString());
            items.Add("account_name", order.account_name);
            items.Add("code", order.code);
            items.Add("name", order.name);
            items.Add("status", "0");
            items.Add("type", order.type.ToString());
            items.Add("price_min", order.price_min.ToString());
            items.Add("price_max", order.price_max.ToString());
            items.Add("price_type", order.price_type.ToString());
            items.Add("count_min", order.count_min.ToString());
            items.Add("count_max", order.count_max.ToString());
            items.Add("count_total", order.count_total.ToString());
            items.Add("time_min", order.time_min.ToString());
            items.Add("time_max", order.time_max.ToString());
            items.Add("time_next_dt", DateTime.MinValue.Format());
            items.Add("time_prev_dt", DateTime.MinValue.Format());
            items.Add("order_times", "0");
            items.Add("order_count", "0");
            items.Add("result_prev", "");
            items.Add("operator_start", "");
            items.Add("operator_stop", "");
            TradeRA.SetFields(key, items);
            TradeRA.SetExpire(key);
        }
Ejemplo n.º 2
0
        public static void Add(Account account, string key)
        {
            Dictionary <string, string> items = new Dictionary <string, string>();

            items.Add("id", account.id.ToString());
            items.Add("code", account.code);
            items.Add("name", account.name);
            items.Add("limit_no_buying", account.limit_no_buying);
            items.Add("limit_ratio_single", account.limit_ratio_single.ToString());
            items.Add("limit_ratio_gem_single", account.limit_ratio_gem_single.ToString());
            items.Add("limit_ratio_gem_total", account.limit_ratio_gem_total.ToString());
            items.Add("ratio_capital_warning", account.ratio_capital_warning.ToString());
            items.Add("capital_initial", account.capital_initial.ToString());
            items.Add("status", account.status.ToString());
            items.Add("status_order", account.status_order.ToString());
            items.Add("created_by", account.created_by.ToString());
            items.Add("capital_available", account.capital_available.ToString());
            items.Add("capital_stock_value", account.capital_stock_value.ToString());
            items.Add("capital_stock_value_gem", account.capital_stock_value_gem.ToString());
            items.Add("capital_total", account.capital_total.ToString());
            items.Add("capital_profit", account.capital_profit.ToString());
            items.Add("synchronized_time", account.synchronized_time ?? "");
            TradeRA.SetFields(key, items);
            TradeRA.SetExpire(key);
        }
Ejemplo n.º 3
0
        public static void Add(Order order, string key)
        {
            Dictionary <string, string> items = new Dictionary <string, string>();

            items.Add("trade_no", order.trade_no);
            items.Add("trade_count", order.trade_count.ToString());
            items.Add("code", order.code);
            items.Add("name", order.name);
            items.Add("price", order.price.ToString());
            items.Add("count", order.count.ToString());
            items.Add("type", order.type.ToString());
            items.Add("unit_id", order.unit_id.ToString());
            items.Add("unit_name", order.unit_name ?? UnitRA.GetName(order.unit_id));
            items.Add("user_id", order.user_id.ToString());
            items.Add("user_name", order.user_name ?? UserRA.Get(order.user_id.ToString(), "name"));
            items.Add("platform", order.platform.ToString());
            items.Add("deal_count", order.deal_count.ToString());
            items.Add("deal_average_price", order.deal_average_price.ToString());
            items.Add("cancel_count", "0");
            items.Add("status", order.status ?? "");
            items.Add("state", order.state.ToString());
            items.Add("time_dt", order.time_dt.Format());
            items.Add("account_id", order.account_id.ToString());
            items.Add("account_name", order.account_name ?? AccountRA.GetName(order.account_id));
            items.Add("order_no", order.order_no ?? "");
            items.Add("remark", order.remark ?? "");
            TradeRA.SetFields(key, items);
            TradeRA.SetExpire(key);
        }
Ejemplo n.º 4
0
        private static void AddItems(OrderAuto order_auto, Order order)
        {
            Dictionary <string, string> items = new Dictionary <string, string>();

            items.Add("id", order_auto.order_times.ToString());
            items.Add("time", order_auto.time_prev_dt.Format());
            items.Add("price", order.price.ToString());
            items.Add("count", order.count.ToString());
            items.Add("result", order_auto.result_prev);
            string key = "T_" + order_auto.id + "_" + order_auto.order_times.ToString().PadLeft(3, '0');

            TradeRA.SetFields(key, items);
            TradeRA.SetExpire(key);
        }
Ejemplo n.º 5
0
        public static void Add(AccountGroupItem item, string key)
        {
            Dictionary <string, string> items = new Dictionary <string, string>();

            items.Add("account_group_id", item.account_group_id.ToString());
            items.Add("account_id", item.account_id.ToString());
            items.Add("capital_allow", item.capital_allow.ToString());
            items.Add("sort_buy", item.sort_buy.ToString());
            items.Add("sort_sell", item.sort_sell.ToString());
            items.Add("unit_id", item.unit_id.ToString());
            items.Add("capital_stock_value", item.capital_stock_value.ToString());
            TradeRA.SetFields(key, items);
            TradeRA.SetExpire(key);
        }
Ejemplo n.º 6
0
        public static void Add(Unit unit, string key)
        {
            Dictionary <string, string> items = new Dictionary <string, string>();

            items.Add("id", unit.id.ToString());
            items.Add("code", unit.code);
            items.Add("name", unit.name);
            items.Add("user_id", unit.user_id.ToString());
            items.Add("account_group_id", unit.account_group_id.ToString());
            items.Add("capital_scale", unit.capital_scale.ToString());
            items.Add("ratio_freezing", unit.ratio_freezing.ToString());
            items.Add("ratio_management_fee", unit.ratio_management_fee.ToString());
            items.Add("ratio_commission", unit.ratio_commission.ToString());
            items.Add("ratio_software_fee", unit.ratio_software_fee.ToString());
            items.Add("limit_stock_count", unit.limit_stock_count.ToString());
            items.Add("limit_ratio_mbm_single", unit.limit_ratio_mbm_single.ToString());
            items.Add("limit_ratio_gem_single", unit.limit_ratio_gem_single.ToString());
            items.Add("limit_ratio_gem_total", unit.limit_ratio_gem_total.ToString());
            items.Add("limit_ratio_sme_single", unit.limit_ratio_sme_single.ToString());
            items.Add("limit_ratio_sme_total", unit.limit_ratio_sme_total.ToString());
            items.Add("limit_ratio_smg_total", unit.limit_ratio_smg_total.ToString());
            items.Add("limit_ratio_star_single", unit.limit_ratio_star_single.ToString());
            items.Add("limit_ratio_star_total", unit.limit_ratio_star_total.ToString());
            items.Add("ratio_warning", unit.ratio_warning.ToString());
            items.Add("ratio_close_position", unit.ratio_close_position.ToString());
            items.Add("limit_no_buying", unit.limit_no_buying);
            items.Add("limit_order_price", unit.limit_order_price.ToString());
            items.Add("status", unit.status.ToString());
            items.Add("status_order", unit.status_order.ToString());
            items.Add("capital_balance", unit.capital_balance.ToString());
            items.Add("priority_strategy", unit.priority_strategy.ToString());
            items.Add("capital_freezing", "0");
            items.Add("capital_inout", "0");
            items.Add("capital_stock_value", unit.capital_stock_value.ToString());
            items.Add("capital_stock_value_mbm", unit.capital_stock_value_mbm.ToString());
            items.Add("capital_stock_value_star", unit.capital_stock_value_star.ToString());
            items.Add("capital_stock_value_gem", unit.capital_stock_value_gem.ToString());
            items.Add("capital_stock_value_sme", unit.capital_stock_value_sme.ToString());
            items.Add("capital_profit", unit.capital_profit.ToString());
            TradeRA.SetFields(key, items);
            TradeRA.SetExpire(key);
        }
Ejemplo n.º 7
0
        public static void Add(Position position, string key)
        {
            Dictionary <string, string> items = new Dictionary <string, string>();

            items.Add("id", position.id.ToString());
            items.Add("code", position.code);
            items.Add("name", position.name);
            items.Add("price_cost", position.price_cost.ToString());
            items.Add("count", position.count.ToString());
            items.Add("count_sellable", position.count_sellable.ToString());
            items.Add("price_cost_today_buy", position.price_cost_today_buy.ToString());
            items.Add("price_cost_today_sell", position.price_cost_today_sell.ToString());
            items.Add("count_today_buy", position.count_today_buy.ToString());
            items.Add("count_today_sell", position.count_today_sell.ToString());
            items.Add("unit_id", position.unit_id.ToString());
            items.Add("unit_name", position.unit_name ?? UnitRA.GetName(position.unit_id));
            items.Add("account_id", position.account_id.ToString());
            items.Add("account_name", position.account_name ?? AccountRA.GetName(position.account_id));
            items.Add("price_latest", position.price_latest.ToString());
            items.Add("block", position.block.ToString());
            TradeRA.SetFields(key, items);
            TradeRA.SetExpire(key);
        }
Ejemplo n.º 8
0
        public static void Add(Deal deal, string key)
        {
            Dictionary <string, string> items = new Dictionary <string, string>();

            items.Add("code", deal.code);
            items.Add("name", deal.name);
            items.Add("type", deal.type.ToString());
            items.Add("count", deal.count.ToString());
            items.Add("money", deal.money.ToString());
            items.Add("time_dt", deal.time_dt.Format());
            items.Add("deal_no", deal.deal_no);
            items.Add("order_no", deal.order_no);
            items.Add("price", deal.price.ToString());
            items.Add("unit_id", deal.unit_id.ToString());
            items.Add("unit_name", deal.unit_name ?? UnitRA.GetName(deal.unit_id));
            items.Add("account_id", deal.account_id.ToString());
            items.Add("account_name", deal.account_name ?? AccountRA.GetName(deal.account_id));
            items.Add("commission", deal.commission.ToString());
            items.Add("management_fee", deal.management_fee.ToString());
            items.Add("transferred", deal.transferred.ToString());
            items.Add("profit", deal.profit.ToString());
            TradeRA.SetFields(key, items);
            TradeRA.SetExpire(key);
        }