예스스탁
예스스탁 답변
2019-08-29 16:02:08
안녕하세요
예스스탁입니다.
var fList = [], req;
function Main_OnStart()
{
Main.SetTimer(1, 5000);
}
function Main_OnTimer(nEventID)
{
var d = new Date();
var HHMMSS = d.getHours()*10000+d.getMinutes()*100+d.getSeconds();
if (nEventID == 1 && HHMMSS >= 153600 )
{
Main.KillTimer(1);
var num = Account1.GetTheNumberOfBalances();
if (num > 0)
{
fList = [];
for (var i = 0; i < num; i++)
{
Account1.SetBalance(i);
//옵션종목
if (Option1.GetCurrent(Account1.Balance.code) > 0)
{
if (Account1.Balance.position == 1)
{
Account1.OrderBuy(Account1.Balance.code, Account1.Balance.count,0,1);
}
if (Account1.Balance.position == 2)
{
Account1.OrderSell(Account1.Balance.code, Account1.Balance.count,0,1)
}
}
else //옵션외종목(선물)
{
fList.push(Account1.Balance.code);
}
}
Main.MessageList("선물종목수 :",fList.length);
if (fList.length > 0)
{
req = 0;
Main.MessageList("선물종목객체요청 :",fList[req]);
Main.ReqMarketData(fList[req]);
}
}
}
}
function Main_OnRcvMarketData(MarketData)
{
if (MarketData.code == fList[req] && MarketData.current > 0)
{
if (Account1.Balance.position == 1)
{
Account1.OrderBuy(Account1.Balance.code, Account1.Balance.count,MarketData.current + MarketData2.GetTickSize(MarketData.current)*50,0);
}
if (Account1.Balance.position == 2)
{
Account1.OrderSell(Account1.Balance.code, Account1.Balance.count,MarketData.current - MarketData2.GetTickSize(MarketData.current)*50,0)
}
}
req = req + 1
if (req < fList.length)
{
Main.MessageList("선물종목객체요청 :",fList[req]);
Main.ReqMarketData(fList[req]);
}
else
{
Main.MessageList("종료")
}
}
즐거운 하루되세요
> ujm 님이 쓴 글입니다.
> 제목 : 도움 부탁드립니다.
> 안녕하세요.153600시간에 시장가로 청산주문 넣는 예스스팟수식입니다.
코스닥선물150에서 어제 사이드카가 발동되어서인지,
마감동시호가에 아래의 시장가 주문이 접수가 안되는 경우가 발생되었습니다.
(시장가 주문불가라는 메세지가 뜸)
근 1년간 아무런 문제없이 시장가 청산 잘 되었음.
그래서 시장가 대신에 현재가+50틱 지정가로 청산주문을 넣는 수식으로
변경하려 합니다. 염치없지만, 수정 부탁드립니다.
function Main_OnStart()
{
Main.SetTimer(1, 5000);
}
function Main_OnTimer(nEventID)
{
var d = new Date();
var HHMMSS = d.getHours()*10000+d.getMinutes()*100+d.getSeconds();
if (nEventID == 1 && HHMMSS >= 153600 )
{
Main.KillTimer(1);
var num = Account1.GetTheNumberOfBalances();
if (num > 0)
{
for (var i = 0; i < num; i++)
{
Account1.SetBalance(i);
if (Option1.GetCurrent(Account1.Balance.code) > 0)
{
if (Account1.Balance.position == 1)
{
Account1.OrderBuy(Account1.Balance.code, Account1.Balance.count,0,1);
}
if (Account1.Balance.position == 2)
{
Account1.OrderSell(Account1.Balance.code, Account1.Balance.count,0,1)
}
}
else
{
if (Account1.Balance.position == 1)
{
Account1.OrderBuy(Account1.Balance.code, Account1.Balance.count,0,1);
}
if (Account1.Balance.position == 2)
{
Account1.OrderSell(Account1.Balance.code, Account1.Balance.count,0,1)
}
}
}
}
}
}