- 트레일링 매도 추가

This commit is contained in:
2017-02-01 09:43:04 +09:00
parent da9a59622b
commit 1d43655567
4 changed files with 339 additions and 158 deletions

View File

@@ -65,6 +65,12 @@ namespace AutoSellerNS
lvCurPrice.Items[10].SubItems[chAskCount.Index].Text = "현재가";
lvCurPrice.Items[10].SubItems[chCallPrice.Index].Font = new Font(lvCurPrice.Items[0].SubItems[0].Font, FontStyle.Bold);
cbAccount.Text = Config.GetAccount();
tbSubAccount.Text = Config.GetSubAccount();
tbBidCount.Text = Config.GetBidCount().ToString();
tbTrailingP.Text = Config.GetTrailingRate().ToString();
tbTrailingCnt.Text = Config.GetTrailingCnt().ToString();
m_CybosHelper = new CybosHelper(this);
m_iCurPricePanelWith = splitContainer2.Panel2.Width;
@@ -115,8 +121,10 @@ namespace AutoSellerNS
if(lvItems.InvokeRequired)
{
CybosHelper.STOCK_CUR_ITEM ItemCur = m_CybosHelper.GetItem(Item.m_strCode);
lvItems.Invoke(new Action(() => {
lvItems.Items.Add(new ListViewItem(new string[] {
lvItems.Items.Add(new ListViewItem(new string[] {
Item.m_strCode,
Item.m_strCodeName,
string.Format("{0:n0}", Item.m_iCurPrice),
@@ -126,8 +134,8 @@ namespace AutoSellerNS
string.Format("{0:n0}", Item.m_iAssessedValue),
string.Format("{0:n0}", Item.m_iValuationGains),
string.Format("{0:n2}", Item.m_dYield),
"",
"",
ItemCur != null ? string.Format("{0:n0}", ItemCur.m_iMaxPrice) : "",
ItemCur != null ? string.Format("{0:n0}", ItemCur.m_iCheckCount) : "",
}));
var listviewItem = lvItems.Items[lvItems.Items.Count - 1];
@@ -141,6 +149,8 @@ namespace AutoSellerNS
}
else
{
CybosHelper.STOCK_CUR_ITEM ItemCur = m_CybosHelper.GetItem(Item.m_strCode);
lvItems.Items.Add(new ListViewItem(new string[] {
Item.m_strCode,
Item.m_strCodeName,
@@ -151,10 +161,12 @@ namespace AutoSellerNS
string.Format("{0:n0}", Item.m_iAssessedValue),
string.Format("{0:n0}", Item.m_iValuationGains),
string.Format("{0:n2}", Item.m_dYield),
"",
"",
ItemCur != null ? string.Format("{0:n0}", ItemCur.m_iMaxPrice) : "",
ItemCur != null ? string.Format("{0:n0}", ItemCur.m_iCheckCount) : "",
}));
var listviewItem = lvItems.Items[lvItems.Items.Count - 1];
lvItems.Items[lvItems.Items.Count - 1].UseItemStyleForSubItems = false;
@@ -262,7 +274,7 @@ namespace AutoSellerNS
}
}
public void OnReceivedCall(string strCode, int[] aiBidPrice, int[] aiBidCount, int[] aiAskPrice, int[] aiAskCount)
public void OnReceivedCall(string strCode, int iCurPrice, int[] aiBidPrice, int[] aiBidCount, int[] aiAskPrice, int[] aiAskCount)
{
if (strCode != m_strSelectedCode)
return;
@@ -274,6 +286,10 @@ namespace AutoSellerNS
if (lvCurPrice.InvokeRequired)
{
lvCurPrice.Invoke(new Action(() => {
if(iCurPrice > 0)
lvCurPrice.Items[10].SubItems[chCallPrice.Index].Text = string.Format("{0:n0}", iCurPrice);
for (int i = 0; i < 10; i++)
{
lvCurPrice.Items[i].SubItems[chAskCount.Index].Text = string.Format("{0:n0}", aiAskCount[9-i]);
@@ -289,6 +305,9 @@ namespace AutoSellerNS
}
else
{
if(iCurPrice > 0)
lvCurPrice.Items[10].SubItems[chCallPrice.Index].Text = string.Format("{0:n0}", iCurPrice);
for (int i = 0; i < 10; i++)
{
lvCurPrice.Items[i].SubItems[chAskCount.Index].Text = string.Format("{0:n0}", aiAskCount[9-i]);
@@ -323,7 +342,7 @@ namespace AutoSellerNS
return;
m_strSelectedCode = strCode;
OnReceivedCall(strCode, Item.m_aiBidPrice, Item.m_aiBidCount, Item.m_aiAskPrice, Item.m_aiAskCount);
OnReceivedCall(strCode, Item.m_iCurPrice, Item.m_aiBidPrice, Item.m_aiBidCount, Item.m_aiAskPrice, Item.m_aiAskCount);
//OnReceivedCurPrice(strCode, Item.m_iCurPrice);
}
@@ -336,6 +355,12 @@ namespace AutoSellerNS
int iBidCount = 0;
int.TryParse(tbBidCount.Text, out iBidCount);
Config.SetBidCount(iBidCount);
float fTrailingPercent = 0;
float.TryParse(tbTrailingP.Text, out fTrailingPercent);
int iTrailingCnt = 0;
int.TryParse(tbTrailingCnt.Text, out iTrailingCnt);
Config.SetTrailing(fTrailingPercent, iTrailingCnt);
}
}
}