Exemple #1
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);
        }
Exemple #2
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);
        }
Exemple #3
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);
        }