107 lines
2.4 KiB
C#
107 lines
2.4 KiB
C#
using MySql.Data.MySqlClient;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace upper_limit_crawler
|
|
{
|
|
public struct SETTING
|
|
{
|
|
public float m_fSearchMin;
|
|
public float m_fSearchMax;
|
|
public float m_fBidMin;
|
|
public float m_fBidMax;
|
|
public float m_fBidAmount;
|
|
public float m_fTimeout;
|
|
public float m_fTrailing;
|
|
public float m_fLossCut;
|
|
}
|
|
|
|
public class WATCH_ITEM
|
|
{
|
|
public string m_strCode;
|
|
public string m_strCodeName;
|
|
public DSCBO1Lib.StockCur m_StockCur = null;
|
|
public void Received()
|
|
{
|
|
m_iCurPrice = m_StockCur.GetHeaderValue(13);
|
|
m_iPrevClosing = m_iCurPrice - m_StockCur.GetHeaderValue(2);
|
|
m_iStartPrice = m_StockCur.GetHeaderValue(4);
|
|
m_iHighestPrice = m_StockCur.GetHeaderValue(5);
|
|
m_iVolume = m_StockCur.GetHeaderValue(9);
|
|
m_iBidPrice = m_StockCur.GetHeaderValue(8);
|
|
m_iBidCnt = 0;
|
|
}
|
|
|
|
public int m_iCurPrice;
|
|
public int m_iPrevClosing;
|
|
public int m_iStartPrice;
|
|
public int m_iHighestPrice;
|
|
|
|
public int m_iVolume;
|
|
public int m_iBidPrice;
|
|
public int m_iBidCnt;
|
|
}
|
|
|
|
public class ULDataMgr
|
|
{
|
|
public SETTING m_Setting = new SETTING();
|
|
|
|
ULTrader m_Trader = new ULTrader();
|
|
|
|
Dictionary<string, WATCH_ITEM> m_WatchList = new Dictionary<string, WATCH_ITEM>();
|
|
List<string> m_BlackList = new List<string>();
|
|
|
|
public ULDataMgr()
|
|
{
|
|
}
|
|
|
|
public string GetAccount()
|
|
{
|
|
return m_Trader.GetAccount();
|
|
}
|
|
|
|
public ULTrader GetTrader()
|
|
{
|
|
return m_Trader;
|
|
}
|
|
|
|
public void AddWatch(string strCode, string strCodeName, int iCurPrice, int iPrevClosing)
|
|
{
|
|
if (m_WatchList.ContainsKey(strCode))
|
|
return;
|
|
|
|
WATCH_ITEM item = new WATCH_ITEM();
|
|
item.m_strCode = strCode;
|
|
item.m_strCodeName = strCodeName;
|
|
item.m_iCurPrice = iCurPrice;
|
|
item.m_iPrevClosing = iPrevClosing;
|
|
|
|
item.m_StockCur = new DSCBO1Lib.StockCur();
|
|
item.m_StockCur.SetInputValue(0, strCode);
|
|
item.m_StockCur.Received += item.Received;
|
|
item.m_StockCur.SubscribeLatest();
|
|
|
|
m_WatchList.Add(strCode, item);
|
|
}
|
|
|
|
public void AddBlackList(string strCode)
|
|
{
|
|
m_BlackList.Add(strCode);
|
|
}
|
|
|
|
public bool IsInBlackList(string strCode)
|
|
{
|
|
return m_BlackList.Contains(strCode);
|
|
}
|
|
|
|
public Dictionary<string, WATCH_ITEM> GetWatchList()
|
|
{
|
|
return m_WatchList;
|
|
}
|
|
}
|
|
}
|