public static bool CheckCanSellByAnaylyzeData(AnaylyzeData anaylyzeData, TradeRecord tradeRecord) { decimal nearHigherOpen = new decimal(0); foreach (var item in anaylyzeData.OneKlineData) { if (Utils.GetDateById(item.id) <= tradeRecord.BuyDate) { continue; } if (item.open > nearHigherOpen) { nearHigherOpen = item.open; } } decimal percent = (decimal)1.08; if (anaylyzeData.NowPrice < tradeRecord.BuyOrderPrice * percent) { return(false); } if (anaylyzeData.NowPrice * (decimal)1.005 < nearHigherOpen && anaylyzeData.NowPrice * (decimal)1.015 > nearHigherOpen) { return(true); } return(false); }
public void CreateTradeRecord(TradeRecord tradeRecord) { if (tradeRecord.BuyAnalyze.Length > 4500) { tradeRecord.BuyAnalyze = tradeRecord.BuyAnalyze.Substring(0, 4500); } if (tradeRecord.BuyOrderResult.Length > 500) { tradeRecord.BuyOrderResult = tradeRecord.BuyOrderResult.Substring(0, 500); } using (var tx = Database.BeginTransaction()) { Database.Insert(tradeRecord); tx.Commit(); } }