- 현재가 log 저장

- 정정 주문시 주문번호 log
This commit is contained in:
2017-11-07 20:33:52 +09:00
parent d4515954ce
commit bc6a5791d3
2 changed files with 25 additions and 5 deletions

View File

@@ -129,7 +129,7 @@ namespace AutoSellerNS
int iAskPrice = CurItem.m_aiAskPrice[0]; int iAskPrice = CurItem.m_aiAskPrice[0];
m_CybosHelper.CorrectionItem(NCItem.m_strCode, NCItem.m_iOrgOrderNo, NCItem.m_iRemainCnt, iAskPrice); m_CybosHelper.CorrectionItem(NCItem.m_strCode, NCItem.m_iOrgOrderNo, NCItem.m_iRemainCnt, iAskPrice);
NCItem.m_Time = DateTime.Now; NCItem.m_Time = DateTime.Now;
Util.Log(Util.LOG_TYPE.SELL, string.Format("[{0}] 정정 주문", NCItem.m_strCodeName)); Util.Log(Util.LOG_TYPE.SELL, string.Format("[{0}] 정정 주문 (주문번호: {1})", NCItem.m_strCodeName, NCItem.m_iOrgOrderNo));
} }
} }
} }

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
@@ -28,7 +29,8 @@ namespace AutoSellerNS
public int m_iTrailingCount = 0; public int m_iTrailingCount = 0;
public List<int> m_PriceList = new List<int>(); // real time, price time, price
public List<Tuple<int, int, int>> m_PriceList = new List<Tuple<int, int, int>>();
public double m_dCheckCountLimit = 5; public double m_dCheckCountLimit = 5;
int m_iPrevTime = 0; int m_iPrevTime = 0;
@@ -46,9 +48,11 @@ namespace AutoSellerNS
if(bReal == true) if(bReal == true)
{ {
m_PriceList.Add(m_iCurPrice); DateTime RealTime = DateTime.Now;
double dAverage = (float)m_PriceList.Average(); int iRealTime = RealTime.Hour * 10000 + RealTime.Minute * 100 + RealTime.Second;
double sumOfSquaresOfDifferences = m_PriceList.Select(val => Math.Pow((val-dAverage)/m_CybosHelper.GetUnitValue(val), 2)).Sum(); m_PriceList.Add(new Tuple<int, int, int>(iRealTime, iTime, m_iCurPrice));
double dAverage = (float)m_PriceList.Average(s => s.Item3);
double sumOfSquaresOfDifferences = m_PriceList.Select(val => Math.Pow((val.Item3-dAverage)/m_CybosHelper.GetUnitValue(val.Item3), 2)).Sum();
double dStdDev = Math.Sqrt(sumOfSquaresOfDifferences / m_PriceList.Count); double dStdDev = Math.Sqrt(sumOfSquaresOfDifferences / m_PriceList.Count);
if(dStdDev >= Config.GetFastSD()) if(dStdDev >= Config.GetFastSD())
{ {
@@ -191,6 +195,21 @@ namespace AutoSellerNS
m_CpConclusion.Subscribe(); m_CpConclusion.Subscribe();
} }
public void SavePrice(STOCK_CUR_ITEM item)
{
if (Directory.Exists(Util.GetLogPath()) == false)
Directory.CreateDirectory(Util.GetLogPath());
string strToday = DateTime.Now.ToString("yyyy-MM-dd");
string strFilePath = Util.GetLogPath() + "/price-" + strToday + item.m_strCodeName + ".txt";
string strMessage = "";
foreach (var pair in item.m_PriceList)
{
strMessage = string.Format("[{0}] {1} ({2})", pair.Item2, pair.Item3, pair.Item1);
File.AppendAllText(strFilePath, strMessage + Environment.NewLine, new UTF8Encoding(true));
}
}
public List<AutoSeller.ITEM> UpdateItems() public List<AutoSeller.ITEM> UpdateItems()
{ {
List<AutoSeller.ITEM> aItems = new List<AutoSeller.ITEM>(); List<AutoSeller.ITEM> aItems = new List<AutoSeller.ITEM>();
@@ -265,6 +284,7 @@ namespace AutoSellerNS
{ {
m_aStockCur[Key].m_StockCur.Unsubscribe(); m_aStockCur[Key].m_StockCur.Unsubscribe();
m_aStockCur[Key].m_Jpbid.Unsubscribe(); m_aStockCur[Key].m_Jpbid.Unsubscribe();
SavePrice(m_aStockCur[Key]);
m_aStockCur.Remove(Key); m_aStockCur.Remove(Key);
} }