뻗는 부분 수정
This commit is contained in:
1555
AutoSeller.Designer.cs
generated
1555
AutoSeller.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@@ -25,7 +25,6 @@ namespace AutoSellerNS
|
||||
public int m_iAvailableQuantity;
|
||||
public double m_dBookUnitPrice;
|
||||
public long m_iProfitUnitPrice;
|
||||
public int m_iSellableCnt;
|
||||
|
||||
public int m_iCurPrice;
|
||||
}
|
||||
@@ -118,10 +117,8 @@ namespace AutoSellerNS
|
||||
if(m_bSell == false)
|
||||
return;
|
||||
|
||||
string strLog = "";
|
||||
lock(m_NCItems)
|
||||
{
|
||||
foreach(var NCItem in m_NCItems)
|
||||
var ClonedList = m_NCItems.ConvertAll(s => s);
|
||||
foreach(var NCItem in ClonedList)
|
||||
{
|
||||
if(NCItem.m_bAsk == true && DateTime.Now-NCItem.m_Time >= TimeSpan.FromSeconds(5))
|
||||
{
|
||||
@@ -132,15 +129,11 @@ namespace AutoSellerNS
|
||||
int iAskPrice = CurItem.m_aiAskPrice[0];
|
||||
m_CybosHelper.CorrectionItem(NCItem.m_strCode, NCItem.m_iOrgOrderNo, NCItem.m_iRemainCnt, iAskPrice);
|
||||
NCItem.m_Time = DateTime.Now;
|
||||
strLog += (string.Format("[{0}] 정정 주문", NCItem.m_strCodeName) + Environment.NewLine);
|
||||
Util.Log(Util.LOG_TYPE.SELL, string.Format("[{0}] 정정 주문", NCItem.m_strCodeName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(strLog.Length > 0)
|
||||
Util.Log(Util.LOG_TYPE.SELL, strLog);
|
||||
}
|
||||
|
||||
public void SetAccountList(string[] aAccountList)
|
||||
{
|
||||
cbAccount.Items.Clear();
|
||||
@@ -257,7 +250,7 @@ namespace AutoSellerNS
|
||||
{
|
||||
var NCItems = m_CybosHelper.UpdateNC();
|
||||
|
||||
lock(m_NCItems)
|
||||
//lock(m_NCItems)
|
||||
{
|
||||
m_NCItems.RemoveAll(s => NCItems.Any(t => t.m_iOrgOrderNo== s.m_iOrgOrderNo) == false);
|
||||
foreach(var NCItem in NCItems)
|
||||
@@ -277,6 +270,7 @@ namespace AutoSellerNS
|
||||
foreach(var NCItem in NCItems)
|
||||
{
|
||||
ListViewItem viewItem = new ListViewItem(new string[] {
|
||||
NCItem.m_iOrgOrderNo.ToString(),
|
||||
NCItem.m_strCode,
|
||||
NCItem.m_strCodeName,
|
||||
NCItem.m_strDesc,
|
||||
@@ -294,6 +288,7 @@ namespace AutoSellerNS
|
||||
foreach(var NCItem in NCItems)
|
||||
{
|
||||
ListViewItem viewItem = new ListViewItem(new string[] {
|
||||
NCItem.m_iOrgOrderNo.ToString(),
|
||||
NCItem.m_strCode,
|
||||
NCItem.m_strCodeName,
|
||||
NCItem.m_strDesc,
|
||||
@@ -309,28 +304,16 @@ namespace AutoSellerNS
|
||||
|
||||
public void UpdateItem(string strCode, string strCodeName, bool bBid, int iConclusionCnt, int iRemainCnt, int iBookValue)
|
||||
{
|
||||
btUpdate_Click(null, null);
|
||||
//if(lvList.InvokeRequired)
|
||||
//{
|
||||
// 잔고
|
||||
var Items = m_CybosHelper.UpdateItems();
|
||||
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// ListViewItem Item = lvList.Items.Cast<ListViewItem>().FirstOrDefault(s => s.SubItems[chCode.Index].Text == strCode);
|
||||
// if(Item == default(ListViewItem) && iRemainCnt > 0)
|
||||
// {
|
||||
// // 아이템 추가
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // 갱신
|
||||
// Item.SubItems[chCount.Index].Text = string.Format("{0:n0}", iRemainCnt);
|
||||
// Item.SubItems[chBookValue.Index].Text = string.Format("{0:n2}", iBookValue);
|
||||
// }
|
||||
//}
|
||||
m_Items.Clear();
|
||||
lvItems.Items.Clear();
|
||||
foreach(var Item in Items)
|
||||
AddItem(Item);
|
||||
}
|
||||
|
||||
public void OnReceipt()
|
||||
public void UpdateNCItem()
|
||||
{
|
||||
UpdateNC();
|
||||
}
|
||||
@@ -353,8 +336,9 @@ namespace AutoSellerNS
|
||||
return;
|
||||
|
||||
Item.m_iCurPrice = iPrice;
|
||||
Item.m_iAssessedValue = (int)(iPrice * Item.m_iAvailableQuantity * 99.94 / 100);
|
||||
Item.m_dYield = (Item.m_iCurPrice - Item.m_iProfitUnitPrice) * 100 / (double)Item.m_iProfitUnitPrice;
|
||||
Item.m_iAssessedValue = iPrice * Item.m_iItemCnt;
|
||||
Item.m_iValuationGains = (iPrice-Item.m_iProfitUnitPrice)*Item.m_iItemCnt;
|
||||
Item.m_dYield = (iPrice-Item.m_iProfitUnitPrice)*100 / (double)Item.m_iProfitUnitPrice;
|
||||
|
||||
if (lvItems.InvokeRequired)
|
||||
{
|
||||
@@ -366,6 +350,7 @@ namespace AutoSellerNS
|
||||
|
||||
row.SubItems[chCurPrice.Index].Text = string.Format("{0}{1:n0}", bReal?"":"*", Item.m_iCurPrice);
|
||||
row.SubItems[chAssessedValue.Index].Text = string.Format("{0:n0}", Item.m_iAssessedValue);
|
||||
row.SubItems[chValuation.Index].Text = string.Format("{0:n0}", Item.m_iValuationGains);
|
||||
row.SubItems[chYield.Index].Text = string.Format("{0:n2}", Item.m_dYield);
|
||||
row.SubItems[chMaxPrice.Index].Text = string.Format("{0:n0}", iMaxPrice);
|
||||
row.SubItems[chCheckCountLimit.Index].Text = string.Format("{0:n2}", dCheckCountLimit);
|
||||
@@ -380,6 +365,7 @@ namespace AutoSellerNS
|
||||
|
||||
row.SubItems[chCurPrice.Index].Text = string.Format("{0}{1:n0}", bReal?"":"*", Item.m_iCurPrice);
|
||||
row.SubItems[chAssessedValue.Index].Text = string.Format("{0:n0}", Item.m_iAssessedValue);
|
||||
row.SubItems[chValuation.Index].Text = string.Format("{0:n0}", Item.m_iValuationGains);
|
||||
row.SubItems[chYield.Index].Text = string.Format("{0:n2}", Item.m_dYield);
|
||||
row.SubItems[chMaxPrice.Index].Text = string.Format("{0:n0}", iMaxPrice);
|
||||
row.SubItems[chCheckCountLimit.Index].Text = string.Format("{0:n2}", dCheckCountLimit);
|
||||
@@ -455,7 +441,7 @@ namespace AutoSellerNS
|
||||
if(Item == default(ITEM))
|
||||
return 0;
|
||||
|
||||
return Item.m_iSellableCnt;
|
||||
return Item.m_iAvailableQuantity;
|
||||
}
|
||||
|
||||
private void lvList_SelectedIndexChanged(object sender, EventArgs e)
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace AutoSellerNS
|
||||
m_iMaxPrice));
|
||||
}
|
||||
|
||||
if(iTimeDiff >= Config.GetTimeLimit())
|
||||
if(iTimeDiff >= Config.GetTimeLimit() && m_Listener.IsSelling() == true)
|
||||
{
|
||||
m_CybosHelper.SellItem(m_strCode, m_Listener.GetSellableCount(m_strCode), m_aiAskPrice[0]);
|
||||
Util.Log(Util.LOG_TYPE.SELL, string.Format("[시간제한 매도] {0} ({1}초) (현재가 {2:n0}원, 최고가 {3:n0}원)",
|
||||
@@ -223,7 +223,6 @@ namespace AutoSellerNS
|
||||
Item.m_iAvailableQuantity = m_6033.GetDataValue(15, i);
|
||||
Item.m_dBookUnitPrice = m_6033.GetDataValue(17, i);
|
||||
Item.m_iProfitUnitPrice = m_6033.GetDataValue(18, i);
|
||||
Item.m_iSellableCnt = m_6033.GetDataValue(15, i);
|
||||
|
||||
if(strCodeList.Length > 0)
|
||||
strCodeList += ",";
|
||||
@@ -242,7 +241,7 @@ namespace AutoSellerNS
|
||||
{
|
||||
DSCBO1Lib.StockMst2 StockMst = new DSCBO1Lib.StockMst2();
|
||||
StockMst.SetInputValue(0, strCodeList);
|
||||
StockMst.BlockRequest2(0);
|
||||
StockMst.BlockRequest2(1);
|
||||
int iCnt = StockMst.GetHeaderValue(0);
|
||||
for (int i = 0; i < iCnt; i++)
|
||||
{
|
||||
@@ -272,20 +271,30 @@ namespace AutoSellerNS
|
||||
return aItems;
|
||||
}
|
||||
|
||||
static int iUpdateNCIdx = 1;
|
||||
public List<AutoSeller.NCITEM> UpdateNC()
|
||||
{
|
||||
int iIdx = iUpdateNCIdx++;
|
||||
Util.Log(Util.LOG_TYPE.DEBUG, string.Format("UpdateNC Start ({0}, {1}, {2}, {3})", iIdx,
|
||||
GetLimitRemainCountRQ(), GetLimitRemainCountSB(), GetLimitRemainCountTrade()
|
||||
));
|
||||
|
||||
while(GetLimitRemainCountTrade() < 1)
|
||||
Thread.Sleep(500);
|
||||
|
||||
List<AutoSeller.NCITEM> NCItems = new List<AutoSeller.NCITEM>();
|
||||
lock(m_NCItemLock)
|
||||
{
|
||||
|
||||
CPTRADELib.CpTd5339 CP5339 = new CPTRADELib.CpTd5339();
|
||||
CP5339.SetInputValue(0, Config.GetAccount());
|
||||
CP5339.SetInputValue(1, Config.GetSubAccount());
|
||||
CP5339.BlockRequest2(0);
|
||||
CP5339.BlockRequest2(1);
|
||||
|
||||
bool bContinue = true;
|
||||
while(bContinue)
|
||||
{
|
||||
int iCnt = CP5339.GetHeaderValue(5);
|
||||
Console.WriteLine("icnt : {0}", iCnt);
|
||||
|
||||
for(int i = 0; i<iCnt; i++)
|
||||
{
|
||||
AutoSeller.NCITEM Item = new AutoSeller.NCITEM();
|
||||
@@ -305,10 +314,11 @@ namespace AutoSellerNS
|
||||
|
||||
bContinue = (CP5339.Continue != 0);
|
||||
if(bContinue)
|
||||
CP5339.BlockRequest2(0);
|
||||
}
|
||||
CP5339.BlockRequest2(1);
|
||||
}
|
||||
|
||||
Util.Log(Util.LOG_TYPE.DEBUG, string.Format("UpdateNC End ({0})", iIdx));
|
||||
|
||||
return NCItems;
|
||||
}
|
||||
|
||||
@@ -332,6 +342,7 @@ namespace AutoSellerNS
|
||||
{
|
||||
case 1: // 체결
|
||||
m_Listener.UpdateItem(strCode, strCodeName, bBid, iConclusionCnt, iRemainCnt, iBookValue);
|
||||
m_Listener.UpdateNCItem();
|
||||
Util.Log(bBid?Util.LOG_TYPE.BUY:Util.LOG_TYPE.SELL, string.Format("{0}:{1} {2} 체결 ({3:n0}원 {4}주)", strCodeName, strCode, strBidOrAsk, iPrice, iConclusionCnt));
|
||||
break;
|
||||
|
||||
@@ -344,7 +355,7 @@ namespace AutoSellerNS
|
||||
break;
|
||||
|
||||
case 4: // 접수
|
||||
m_Listener.OnReceipt();
|
||||
m_Listener.UpdateNCItem();
|
||||
Util.Log(bBid ? Util.LOG_TYPE.BUY : Util.LOG_TYPE.SELL, string.Format("{0}:{1} {2} 접수 ({3:n0}원 {4}주)", strCodeName, strCode, strBidOrAsk, iPrice, iConclusionCnt));
|
||||
break;
|
||||
}
|
||||
@@ -390,7 +401,7 @@ namespace AutoSellerNS
|
||||
|
||||
DSCBO1Lib.StockJpbid2 JpBid = new DSCBO1Lib.StockJpbid2();
|
||||
JpBid.SetInputValue(0, Item.m_strCode);
|
||||
JpBid.BlockRequest2(0);
|
||||
JpBid.BlockRequest2(1);
|
||||
for(int i=0; i<10; i++)
|
||||
{
|
||||
StockCur.m_aiAskPrice[i] = JpBid.GetDataValue(0, i);
|
||||
@@ -440,8 +451,12 @@ namespace AutoSellerNS
|
||||
return (iValue/iUnit)*iUnit;
|
||||
}
|
||||
|
||||
static int iSellIdx = 1;
|
||||
public void SellItem(string strCode, int iCnt, int iAskPrice)
|
||||
{
|
||||
int iIdx = iSellIdx++;
|
||||
Util.Log(Util.LOG_TYPE.DEBUG, string.Format("SellItem Start ({0})", iIdx));
|
||||
|
||||
int iSellPrice = iAskPrice-GetUnitValue(iAskPrice);
|
||||
|
||||
CPTRADELib.CpTd0311 Td0311 = new CPTRADELib.CpTd0311();
|
||||
@@ -452,22 +467,34 @@ namespace AutoSellerNS
|
||||
Td0311.SetInputValue(4, iCnt);
|
||||
Td0311.SetInputValue(5, iSellPrice);
|
||||
Td0311.SetInputValue(8, "01");
|
||||
Td0311.BlockRequest2(0);
|
||||
Td0311.BlockRequest2(1);
|
||||
|
||||
Util.Log(Util.LOG_TYPE.DEBUG, string.Format("SellItem End ({0})", iIdx));
|
||||
}
|
||||
|
||||
static int iCancelIdx = 1;
|
||||
public void CancelItem(string strCode, int iOrgOrderNo)
|
||||
{
|
||||
int iIdx = iCancelIdx++;
|
||||
Util.Log(Util.LOG_TYPE.DEBUG, string.Format("CancelItem Start ({0})", iIdx));
|
||||
|
||||
CPTRADELib.CpTd0314 Td0314 = new CPTRADELib.CpTd0314();
|
||||
Td0314.SetInputValue(1, iOrgOrderNo);
|
||||
Td0314.SetInputValue(2, Config.GetAccount());
|
||||
Td0314.SetInputValue(3, Config.GetSubAccount());
|
||||
Td0314.SetInputValue(4, strCode);
|
||||
Td0314.SetInputValue(5, 0);
|
||||
Td0314.BlockRequest2(0);
|
||||
Td0314.BlockRequest2(1);
|
||||
|
||||
Util.Log(Util.LOG_TYPE.DEBUG, string.Format("CancelItem End ({0})", iIdx));
|
||||
}
|
||||
|
||||
static int iCorrectIdx = 1;
|
||||
public void CorrectionItem(string strCode, int iOrgOrderNo, int iCnt, int iAskPrice)
|
||||
{
|
||||
int iIdx = iCorrectIdx++;
|
||||
Util.Log(Util.LOG_TYPE.DEBUG, string.Format("CorrectionItem Start ({0})", iIdx));
|
||||
|
||||
int iSellPrice = iAskPrice-GetUnitValue(iAskPrice);
|
||||
|
||||
//CancelItem(strCode, iOrgOrderNo);
|
||||
@@ -481,7 +508,9 @@ namespace AutoSellerNS
|
||||
Td0313.SetInputValue(4, strCode);
|
||||
Td0313.SetInputValue(5, 0);
|
||||
Td0313.SetInputValue(6, iSellPrice);
|
||||
Td0313.BlockRequest2(0);
|
||||
Td0313.BlockRequest2(1);
|
||||
|
||||
Util.Log(Util.LOG_TYPE.DEBUG, string.Format("CorrectionItem End ({0})", iIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace AutoSellerNS
|
||||
// CPStockChart.SetInputValue(4, 100000);
|
||||
// CPStockChart.SetInputValue(5, new int[] { 0, 1, 5, 8, 9, 10, 11 });
|
||||
// CPStockChart.SetInputValue(6, 'T');
|
||||
// CPStockChart.BlockRequest2(0);
|
||||
// CPStockChart.BlockRequest2(1);
|
||||
|
||||
// int iFieldCnt = CPStockChart.GetHeaderValue(1);
|
||||
// string[] astrFieldName = CPStockChart.GetHeaderValue(2);
|
||||
@@ -96,7 +96,7 @@ namespace AutoSellerNS
|
||||
|
||||
// bContinue = (CPStockChart.Continue==1);
|
||||
// if(bContinue == true)
|
||||
// CPStockChart.BlockRequest2(0);
|
||||
// CPStockChart.BlockRequest2(1);
|
||||
|
||||
// m_tbLogView.AppendText(string.Format("RequestRQ({0}) ", m_CybosHelper.GetLimitRemainCountRQ()));
|
||||
// }
|
||||
@@ -149,7 +149,7 @@ namespace AutoSellerNS
|
||||
// CPStockChart.SetInputValue(3, StartDT.ToString("yyyyMMdd"));
|
||||
// CPStockChart.SetInputValue(5, new int[] { 0, 1, 5, 8, 9, 10, 11 });
|
||||
// CPStockChart.SetInputValue(6, 'T');
|
||||
// CPStockChart.BlockRequest2(0);
|
||||
// CPStockChart.BlockRequest2(1);
|
||||
|
||||
// int iFieldCnt = CPStockChart.GetHeaderValue(1);
|
||||
// string[] astrFieldName = CPStockChart.GetHeaderValue(2);
|
||||
@@ -184,7 +184,7 @@ namespace AutoSellerNS
|
||||
|
||||
// bContinue = (CPStockChart.Continue==1);
|
||||
// if(bContinue == true)
|
||||
// CPStockChart.BlockRequest2(0);
|
||||
// CPStockChart.BlockRequest2(1);
|
||||
|
||||
// m_tbLogView.AppendText(string.Format("RequestRQ({0}) ", m_CybosHelper.GetLimitRemainCountRQ()));
|
||||
// }
|
||||
@@ -236,7 +236,7 @@ namespace AutoSellerNS
|
||||
CPStockBid.SetInputValue(2, 20000);
|
||||
CPStockBid.SetInputValue(3, 'C');
|
||||
CPStockBid.SetInputValue(4, "2000");
|
||||
CPStockBid.BlockRequest2(0);
|
||||
CPStockBid.BlockRequest2(1);
|
||||
|
||||
List<object[]> aaRows = new List<object[]>();
|
||||
|
||||
@@ -262,7 +262,7 @@ namespace AutoSellerNS
|
||||
{
|
||||
while(m_CybosHelper.GetLimitRemainCountRQ() < 2)
|
||||
Thread.Sleep(100);
|
||||
CPStockBid.BlockRequest2(0);
|
||||
CPStockBid.BlockRequest2(1);
|
||||
}
|
||||
|
||||
m_tbLogView.AppendText(string.Format("RequestRQ({0}) ", m_CybosHelper.GetLimitRemainCountRQ()));
|
||||
@@ -450,6 +450,7 @@ namespace AutoSellerNS
|
||||
double dTimeSub = (double)aParams[10];
|
||||
int iTimeDiffLimit = (int)aParams[11];
|
||||
int iIgnorePrice = (int)aParams[12];
|
||||
bool bHalfTrailing = (bool)aParams[13];
|
||||
|
||||
var tokens = strLine.Split('\t');
|
||||
|
||||
@@ -521,7 +522,7 @@ namespace AutoSellerNS
|
||||
int iPrice = (int)(double)Sheet.Cells[iRow, 3].Value;
|
||||
int iAskPrice = (int)(double)Sheet.Cells[iRow, 4].Value;
|
||||
int iBidPrice = (int)(double)Sheet.Cells[iRow, 5].Value;
|
||||
int iConclusionCnt = (int)(double)Sheet.Cells[iRow, 8].Value;
|
||||
int iConclusionCnt = (int)(double)Sheet.Cells[iRow, 7].Value;
|
||||
|
||||
int iTimeDiff = 0;
|
||||
if(iPrevTime > 0)
|
||||
@@ -661,7 +662,7 @@ namespace AutoSellerNS
|
||||
if(iAskCount >= Math.Round(dCheckCount))
|
||||
{
|
||||
iSellPrice = iPrice - m_CybosHelper.GetUnitValue(iPrice);
|
||||
strReturnMsg = string.Format("[{0}] [{1}] 조건1 매도 (매수: {2:n0}원, {3}, line:{4}) (매도: {5:n0}원(매도가:{6:n0}원) {7} line:{8}) (손익: {9}, {10:n0} : {11:n2}%) {12} \n",
|
||||
strReturnMsg = string.Format("[{0}] [{1}] 조건 매도\n\t\t매수: {2:n0}원, {3}, line:{4}\n\t\t매도: {5:n0}원(매도가:{6:n0}원) {7} line:{8} (최고가: {9:n0})\n\t\t손익: {10}, {11:n0} : {12:n2}% ({13:n2}) \n",
|
||||
StartDT.ToString("yyyy-MM-dd"),
|
||||
strCodeName,
|
||||
|
||||
@@ -673,6 +674,7 @@ namespace AutoSellerNS
|
||||
iSellPrice,
|
||||
RowDT.ToString("HH:mm:ss"),
|
||||
iRow,
|
||||
iMaxPrice,
|
||||
|
||||
iSellPrice-iStartPrice,
|
||||
(iSellPrice-iStartPrice)*iStockCount,
|
||||
@@ -705,7 +707,7 @@ namespace AutoSellerNS
|
||||
if(iTrailingCount >= Config.GetTrailingCnt())
|
||||
{
|
||||
iSellPrice = iPrice - m_CybosHelper.GetUnitValue(iPrice);
|
||||
strReturnMsg = string.Format("[{0}] [{1}] 트레일링 매도 (매수: {2:n0}원, {3}, line:{4}) (매도: {5:n0}원(매도가:{6:n0}원) {7} line:{8}) (손익: {9}, {10:n0} : {11:n2}%) {12} \n",
|
||||
strReturnMsg = string.Format("[{0}] [{1}] 트레일링 매도 \n\t\t매수: {2:n0}원, {3}, line:{4}\n\t\t매도: {5:n0}원(매도가:{6:n0}원) {7} line:{8} (최고가: {9:n0})\n\t\t손익: {10}, {11:n0} : {12:n2}% ({13:n2}) \n",
|
||||
StartDT.ToString("yyyy-MM-dd"),
|
||||
strCodeName,
|
||||
|
||||
@@ -717,6 +719,7 @@ namespace AutoSellerNS
|
||||
iSellPrice,
|
||||
RowDT.ToString("HH:mm:ss"),
|
||||
iRow,
|
||||
iMaxPrice,
|
||||
|
||||
iSellPrice-iStartPrice,
|
||||
(iSellPrice-iStartPrice)*iStockCount,
|
||||
@@ -735,10 +738,10 @@ namespace AutoSellerNS
|
||||
break;
|
||||
}
|
||||
|
||||
if(iTimeDiff >= iTimeDiffLimit)
|
||||
if(bHalfTrailing == true && iMaxPrice/(float)iStartPrice >= 1.02 && iPrice < (iStartPrice+iMaxPrice)/2)
|
||||
{
|
||||
iSellPrice = iPrice - m_CybosHelper.GetUnitValue(iPrice);
|
||||
strReturnMsg = string.Format("[{0}] [{1}] 제한시간 매도 (매수: {2:n0}원, {3}, line:{4}) (매도: {5:n0}원(매도가:{6:n0}원) {7} line:{8}) (손익: {9}, {10:n0} : {11:n2}%) {12} \n",
|
||||
strReturnMsg = string.Format("[{0}] [{1}] 트레일링2 매도\n\t\t매수: {2:n0}원, {3}, line:{4}\n\t\t매도: {5:n0}원(매도가:{6:n0}원 {7} line:{8} (최고가: {9:n0})\n\t\t손익: {10}, {11:n0} : {12:n2}%) ({13:n2}) \n",
|
||||
StartDT.ToString("yyyy-MM-dd"),
|
||||
strCodeName,
|
||||
|
||||
@@ -750,6 +753,61 @@ namespace AutoSellerNS
|
||||
iSellPrice,
|
||||
RowDT.ToString("HH:mm:ss"),
|
||||
iRow,
|
||||
iMaxPrice,
|
||||
|
||||
iSellPrice-iStartPrice,
|
||||
(iSellPrice-iStartPrice)*iStockCount,
|
||||
(iSellPrice-iStartPrice)*100/(float)iStartPrice,
|
||||
|
||||
dCheckCount
|
||||
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
double dSlope = 0;
|
||||
if(m_PriceList.Count >= 5)
|
||||
{
|
||||
List<Point> LastSample = new List<Point>();
|
||||
for(int i = 0; i<5; i++)
|
||||
{
|
||||
Point Pos = new Point();
|
||||
Pos.X = m_PriceList[m_PriceList.Count-i-1];
|
||||
Pos.X = Pos.X/m_CybosHelper.GetUnitValue(Pos.X);
|
||||
|
||||
Pos.Y = 5-i;
|
||||
|
||||
LastSample.Add(Pos);
|
||||
}
|
||||
|
||||
double xBar = LastSample.Average(p => p.X);
|
||||
double yBar = LastSample.Average(p => p.Y);
|
||||
|
||||
double dividend = LastSample.Sum(p => (p.X - xBar) * (p.Y - yBar));
|
||||
double divisor = (double)LastSample.Sum(p => Math.Pow(p.X - xBar, 2));
|
||||
|
||||
dSlope = dividend / divisor;
|
||||
Sheet.Cells[iRow, 13].Value = dSlope;
|
||||
}
|
||||
|
||||
|
||||
if(iTimeDiff >= iTimeDiffLimit)
|
||||
{
|
||||
iSellPrice = iPrice - m_CybosHelper.GetUnitValue(iPrice);
|
||||
strReturnMsg = string.Format("[{0}] [{1}] 제한시간 매도\n\t\t매수: {2:n0}원, {3}, line:{4}\n\t\t매도: {5:n0}원(매도가:{6:n0}원) {7} line:{8} (최고가: {9:n0})\n\t\t손익: {10}, {11:n0} : {12:n2}%) ({13:n2}) \n",
|
||||
StartDT.ToString("yyyy-MM-dd"),
|
||||
strCodeName,
|
||||
|
||||
iStartPrice,
|
||||
StartDT.ToString("HH:mm:ss"),
|
||||
iStartRow,
|
||||
|
||||
iPrice,
|
||||
iSellPrice,
|
||||
RowDT.ToString("HH:mm:ss"),
|
||||
iRow,
|
||||
iMaxPrice,
|
||||
|
||||
iSellPrice-iStartPrice,
|
||||
(iSellPrice-iStartPrice)*iStockCount,
|
||||
@@ -774,7 +832,7 @@ namespace AutoSellerNS
|
||||
if(iRow == iMaxRow)
|
||||
{
|
||||
iSellPrice = iPrice - m_CybosHelper.GetUnitValue(iPrice);
|
||||
strReturnMsg = string.Format("[{0}] [{1}] 종료 매도 (매수: {2:n0}원, {3}, line:{4}) (매도: {5:n0}원(매도가:{6:n0}원) {7} line:{8}) (손익: {9}, {10:n0} : {11:n2}%) {12} \n",
|
||||
strReturnMsg = string.Format("[{0}] [{1}] 종료 매도\n\t\t매수: {2:n0}원, {3}, line:{4}\n\t\t매도: {5:n0}원(매도가:{6:n0}원) {7} line:{8} (최고가: {9:n0})\n\t\t손익: {10}, {11:n0} : {12:n2}%) ({13:n2}) \n",
|
||||
StartDT.ToString("yyyy-MM-dd"),
|
||||
strCodeName,
|
||||
|
||||
@@ -841,11 +899,12 @@ namespace AutoSellerNS
|
||||
double dTimeSub = (double)aParams[9];
|
||||
int iTimeDiffLimit = (int)aParams[10];
|
||||
int iIgnorePrice = (int)aParams[11];
|
||||
bool bHalfTrailing = (bool)aParams[12];
|
||||
|
||||
InsertLog(string.Format("[시뮬레이션 시작] 조건 : {0}회, 트레일링 : {1}%, {2}회\n \t\t리스트 크기:{3}, Fast : {4}, {5}, {6}, Slow : {7}, {8}, {9}, 초당 {10} 감소, 제한 시간: {11}, {12}원 이하 무시, 비교 방식 : {13}\n",
|
||||
InsertLog(string.Format("[시뮬레이션 시작] 조건 : {0}회, 트레일링 : {1}%, {2}회\n\t\t리스트 크기:{3}, Fast : {4}, {5}, {6}, Slow : {7}, {8}, {9}, 초당 {10} 감소, 제한 시간: {11}, {12}원 이하 무시, \n\t\t트레일링2 : {13}, 비교 방식 : {14}\n",
|
||||
Config.GetBidCount(), Config.GetTrailingRate(), Config.GetTrailingCnt(),
|
||||
iListCnt, dFastSD, dFastUpCnt, dFastDownCnt, dSlowSD, dSlowUpCnt, dSlowDownCnt,
|
||||
dTimeSub, iTimeDiffLimit, iIgnorePrice,
|
||||
dTimeSub, iTimeDiffLimit, iIgnorePrice, bHalfTrailing,
|
||||
strMethod
|
||||
));
|
||||
|
||||
@@ -861,7 +920,7 @@ namespace AutoSellerNS
|
||||
dSlowSD, dSlowUpCnt, dSlowDownCnt,
|
||||
iCompareType, strMethod,
|
||||
strLine, dTimeSub, iTimeDiffLimit,
|
||||
iIgnorePrice }));
|
||||
iIgnorePrice, bHalfTrailing }));
|
||||
|
||||
aTasks.Add(task);
|
||||
}
|
||||
@@ -891,6 +950,7 @@ namespace AutoSellerNS
|
||||
double dTimeSub;
|
||||
int iTimeDiffLimit;
|
||||
int iIgnorePrice;
|
||||
bool bHalfTrailing;
|
||||
|
||||
int.TryParse(m_AutoSeller.tbSMListSize.Text, out iListCnt);
|
||||
double.TryParse(m_AutoSeller.tbSMFastSD.Text, out dFastSD);
|
||||
@@ -902,6 +962,7 @@ namespace AutoSellerNS
|
||||
double.TryParse(m_AutoSeller.tbSMTimeSub.Text, out dTimeSub);
|
||||
int.TryParse(m_AutoSeller.tbSMTimeDiffLimit.Text, out iTimeDiffLimit);
|
||||
int.TryParse(m_AutoSeller.tbSMIgnorePrice.Text, out iIgnorePrice);
|
||||
bHalfTrailing = m_AutoSeller.chSMHalfTrailing.Checked;
|
||||
|
||||
string strMethod = "";
|
||||
m_AutoSeller.cbSMMethod.Invoke(new Action(() => {
|
||||
@@ -931,7 +992,7 @@ namespace AutoSellerNS
|
||||
dFastSD, dFastUpCnt, dFastDownCnt,
|
||||
dSlowSD, dSlowUpCnt, dSlowDownCnt,
|
||||
iCompareType, strMethod, dTimeSub, iTimeDiffLimit,
|
||||
iIgnorePrice
|
||||
iIgnorePrice, bHalfTrailing
|
||||
});
|
||||
// }
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user