public static void UpdateTransfer(int from_unit, int to_unit, int from_account, int to_account, string code, int count, decimal price_latest) { string key_from = "P_" + code + "_A_" + from_account + "_U_" + from_unit; TradeRA.Increment(key_from, "count", -count); TradeRA.Increment(key_from, "count_sellable", -count); string key_to = "P_" + code + "_A_" + to_account + "_U_" + to_unit; if (TradeRA.KeyExists(key_to)) { TradeRA.Increment(key_to, "count", count); TradeRA.Increment(key_to, "count_sellable", count); } else { Position position = Get(key_from); position.unit_id = to_unit; position.account_id = to_account; position.count = position.count_sellable = count; position.price_cost_today_buy = position.price_cost_today_sell = 0; position.count_today_buy = position.count_today_sell = 0; position.price_latest = price_latest; Add(position, key_to); } }
public static void UpdateCapitalStockValue(decimal value, string key) { if (!TradeRA.KeyExists(key)) { return; } Dictionary <string, string> items = new Dictionary <string, string>(); items.Add("capital_stock_value_gem", value.ToString()); items.Add("calculated_time", DateTime.Now.Format()); TradeRA.SetFields(key, items); }