auto cancel

This commit is contained in:
2018-10-16 19:55:00 +09:00
parent 7197272479
commit 22b38609cd
3 changed files with 98 additions and 4 deletions

View File

@@ -117,6 +117,9 @@ namespace AutoSellerNS
tbCFTimeDown.Text = Config.GetTimeDown().ToString();
tbCFIgnorePrice.Text = Config.GetIgnorePrice().ToString();
cbAutoCancel.Checked = Config.IsAutoCancel();
tbAutoCancelDelay.Text = Config.GetAutoCancelDelay().ToString();
cbMockTrading.Checked = Config.GetMockTrading();
m_CybosHelper = new CybosHelper(this);
@@ -355,6 +358,20 @@ namespace AutoSellerNS
}
private async void AutoCancelProc()
{
TimeSpan delay = TimeSpan.FromSeconds(Config.GetAutoCancelDelay());
List<NCITEM> cloned;
lock (m_NCItems)
cloned = m_NCItems.ConvertAll(s => s);
foreach (var nc in cloned)
{
if (nc.m_bAsk == false && DateTime.Now >= nc.m_Time + delay)
await m_CybosHelper.CancelItem(nc.m_strCode, nc.m_iOrgOrderNo);
}
}
private async void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
await CorrectItems();
@@ -371,6 +388,9 @@ namespace AutoSellerNS
if(m_bClearBeforeClosing == true)
ClearBeforeClsosingProc();
if (Config.IsAutoCancel() == true)
AutoCancelProc();
}
private void btUpdate_Click(object sender, EventArgs e)
@@ -641,6 +661,11 @@ namespace AutoSellerNS
int.TryParse(tbCFIgnorePrice.Text, out iIgnorePrice);
Config.SetVolatility(iListSize, dFastSD, dFastUp, dFastDown, dSlowSD, dSlowUp, dSlowDown, iTimeLimit, dTimeDown, iIgnorePrice);
int iAutoCancelDelay;
int.TryParse(tbAutoCancelDelay.Text, out iAutoCancelDelay);
Config.SetAutoCancel(cbAutoCancel.Checked, iAutoCancelDelay);
Config.SetMockTrading(cbMockTrading.Checked);
}