검증 개발 중
This commit is contained in:
98
MainForm.cs
98
MainForm.cs
@@ -259,31 +259,101 @@ namespace upper_limit_crawler
|
||||
|
||||
private void btMATest_Click(object sender, EventArgs e)
|
||||
{
|
||||
string strCode = "A010240";
|
||||
|
||||
CPSYSDIBLib.StockChart stockChart = new CPSYSDIBLib.StockChart();
|
||||
stockChart.SetInputValue(0, "A043580");
|
||||
stockChart.SetInputValue(0, strCode);
|
||||
stockChart.SetInputValue(1, '1');
|
||||
stockChart.SetInputValue(2, "20160722");
|
||||
stockChart.SetInputValue(3, "20160722");
|
||||
stockChart.SetInputValue(2, "20160725");
|
||||
stockChart.SetInputValue(3, "20160725");
|
||||
stockChart.SetInputValue(5, new int[] { 0, 1, 2, 3, 4, 5, 6, 10 });
|
||||
stockChart.SetInputValue(6, 'm');
|
||||
stockChart.SetInputValue(6, 'T');
|
||||
stockChart.BlockRequest2(1);
|
||||
|
||||
int iCnt = (int)stockChart.GetHeaderValue(3);
|
||||
|
||||
ULWatchItem item = new ULWatchItem();
|
||||
item.m_strCode = strCode;
|
||||
item.m_strCodeName = "흥국";
|
||||
item.m_iCurPrice = 0;
|
||||
item.m_iPrevClosing = 0;
|
||||
|
||||
ULBalanceDlg.OWN_ITEM OwnItem = new ULBalanceDlg.OWN_ITEM();
|
||||
|
||||
int iFieldCnt = stockChart.GetHeaderValue(1);
|
||||
string[] astrFieldName = stockChart.GetHeaderValue(2);
|
||||
|
||||
ULWatchItem item = new ULWatchItem();
|
||||
|
||||
for (int i=iCnt-1; i>=0; i--)
|
||||
while (true)
|
||||
{
|
||||
int iTime = (int)stockChart.GetDataValue(1, i);
|
||||
int iPrice = (int)stockChart.GetDataValue(5, i);
|
||||
int iVolume = (int)stockChart.GetDataValue(5, i);
|
||||
int iCnt = (int)stockChart.GetHeaderValue(3);
|
||||
for (int i = iCnt - 1; i >= 0; i--)
|
||||
{
|
||||
int iTime = (int)stockChart.GetDataValue(1, i);
|
||||
iTime *= 100;
|
||||
|
||||
iTime *= 100;
|
||||
int iPrice = (int)stockChart.GetDataValue(5, i);
|
||||
int iVolume = (int)stockChart.GetDataValue(5, i);
|
||||
|
||||
item.m_iCurPrice = iPrice;
|
||||
item.InsertPriceNode(iTime, iPrice);
|
||||
if (item.m_iPrevClosing == 0)
|
||||
item.m_iPrevClosing = (int)stockChart.GetHeaderValue(6);
|
||||
|
||||
item.m_iCurPrice = iPrice;
|
||||
item.InsertPriceNode(iTime, iPrice);
|
||||
|
||||
float fCompRate = item.m_iCurPrice / (float)item.m_iPrevClosing - 1.0f;
|
||||
if (fCompRate >= m_DataMgr.m_Setting.m_fBidMin && fCompRate <= m_DataMgr.m_Setting.m_fBidMax)
|
||||
{
|
||||
if (item.Is5MAGoingUp() == false)
|
||||
{
|
||||
//UlUtil.Trace(string.Format("[{0}] 조건 매수 실패. 5ma 상승하지 않음 {1}원 ({2})", item.m_strCodeName, item.m_iCurPrice, fCompRate.ToString("0.00%")));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m_DataMgr.IsInBlackList(iTime, strCode) == true)
|
||||
{
|
||||
//UlUtil.Trace(string.Format("[{0}] 조건 매수 실패. black list {1}원 ({2})", item.m_strCodeName, item.m_iCurPrice, fCompRate.ToString("0.00%")));
|
||||
continue;
|
||||
}
|
||||
|
||||
// bid and add to black list
|
||||
UlUtil.Trace(string.Format("[{0}] 조건 매수 {1}원 ({2})", item.m_strCodeName, item.m_iCurPrice, fCompRate.ToString("0.00%")));
|
||||
|
||||
//m_DataMgr.GetTrader().Buy(strCode, item.m_iCurPrice, (int)m_DataMgr.m_Setting.m_fBidAmount);
|
||||
m_DataMgr.AddBlackList(iTime, strCode);
|
||||
}
|
||||
|
||||
|
||||
// loss cut
|
||||
if (iPrice <= OwnItem.m_iUnitBEP * (1.0f - m_DataMgr.m_Setting.m_fLossCut))
|
||||
{
|
||||
UlUtil.Trace(string.Format("[{0}] 손절 {1}원 ({2})", OwnItem.m_strCodeName, iCurPrice, (iCurPrice / (float)OwnItem.m_iUnitBEP - 1.0f).ToString("0.00%")));
|
||||
//m_DataMgr.GetTrader().SellCurPrice(OwnItem.m_strCode, OwnItem.m_iPayBalance);
|
||||
//m_OwnList.Remove(OwnItem);
|
||||
//m_DataMgr.RemoveWatch(strCode);
|
||||
|
||||
// own에서 삭제하고 미체결 리스트에 넣고, watch에서도 뺀다
|
||||
|
||||
// 미체결 잔량 취소
|
||||
}
|
||||
// trailing
|
||||
else if (iPrice <= OwnItem.m_iMaxPrice - OwnItem.m_iUnitBEP * m_DataMgr.m_Setting.m_fTrailing)
|
||||
{
|
||||
if (WatchItem.Is5MAGoingUp() == true)
|
||||
{
|
||||
UlUtil.Trace(string.Format("[{0}] 트레일링 매도 대기. 5ma 상승 중 {1}원 ({2})", OwnItem.m_strCodeName, iCurPrice, (iCurPrice / (float)OwnItem.m_iUnitBEP - 1.0f).ToString("0.00%")));
|
||||
continue;
|
||||
}
|
||||
|
||||
UlUtil.Trace(string.Format("[{0}] 트레일링 매도 {1}원 ({2})", OwnItem.m_strCodeName, iCurPrice, (iCurPrice / (float)OwnItem.m_iUnitBEP - 1.0f).ToString("0.00%")));
|
||||
//m_DataMgr.GetTrader().SellCurPrice(OwnItem.m_strCode, OwnItem.m_iPayBalance);
|
||||
//m_OwnList.Remove(OwnItem);
|
||||
//m_DataMgr.RemoveWatch(strCode);
|
||||
}
|
||||
}
|
||||
|
||||
if (stockChart.Continue == 1)
|
||||
stockChart.BlockRequest2(1);
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
item.PrintChart();
|
||||
|
||||
Reference in New Issue
Block a user