커뮤니티

옵션데이타 데이타베이스 저장

프로필 이미지
inko
2013-08-05 16:37:10
498
글번호 222489
답변완료
옵션 데이타를 개인데이타 베이스에 저장하려 합니다. 아래와 같이 수식을 만들었는데 장시작시 부터 장 종료시까지만 데이타를 등록하고자 하려면 무엇을 추가해야 할까요 ? var CCode = new Array(101); var PCode = new Array(101); var CPrice = new Array(101); var PPrice = new Array(101); var SQL_C; var SQL_P; function Main_OnStart() { for(var i = -50; i <= 50; i++) { CCode[50+i] = Option.GetATMCallRecent(i); PCode[50+i] = Option.GetATMPutRecent(i); Main.ReqMarketData(CCode[50+i], 1,0); Main.ReqMarketData(PCode[50+i], 1,0); } Main.SetTimer(1, 60 * 1000); } function Main_OnTimer(nEventID) { if (nEventID == 1) { for(var i = 0; i <= 100; i++) { CPrice[i] = Option.GetCurrentByCode(CCode[i]); PPrice[i] = Option.GetCurrentByCode(PCode[i]); SQL_C = "OPTION_DATA (O_CODE, O_VALUE, O_TIME) VALUES ('" + CCode[i] + "' , " + CPrice[i] + ", SYSTIMESTAMP )"; SQL_P = "OPTION_DATA (O_CODE, O_VALUE, O_TIME) VALUES ('" + PCode[i] + "' , " + PPrice[i] + ", SYSTIMESTAMP )"; DataBase1.In$ert(SQL_C); DataBase1.In$ert(SQL_P); } } }
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2013-08-07 14:38:47

안녕하세요 예스스탁입니다. 아래와 같이 날짜시간객체(자바스크립트 기본제공 객체)를 이용해 시간 9시~15시15분 사이에만 값을 저정하도록 하시면 됩니다. Date객체는 컴퓨터의 날짜와 시간을 사용하므로 컴퓨터 시간설정에 유의하시기 바랍니다. var CCode = new Array(101); var PCode = new Array(101); var CPrice = new Array(101); var PPrice = new Array(101); var SQL_C; var SQL_P; function Main_OnStart() { var d = new Date(); var HHMMSS = d.getHours()*10000+d.getMinutes()*100+d.getSeconds(); if (HHMMSS >= 90000 && HHMMSS <= 151500) { for(var i = -50; i <= 50; i++) { CCode[50+i] = Option.GetATMCallRecent(i); PCode[50+i] = Option.GetATMPutRecent(i); Main.ReqMarketData(CCode[50+i], 1,0); Main.ReqMarketData(PCode[50+i], 1,0); } Main.SetTimer(1, 60 * 1000); } } function Main_OnTimer(nEventID) { var d = new Date(); var HHMMSS = d.getHours()*10000+d.getMinutes()*100+d.getSeconds(); if (nEventID == 1 && HHMMSS >= 90000 && HHMMSS <= 151500) { for(var i = 0; i <= 100; i++) { CPrice[i] = Option.GetCurrentByCode(CCode[i]); PPrice[i] = Option.GetCurrentByCode(PCode[i]); SQL_C = "OPTION_DATA (O_CODE, O_VALUE, O_TIME) VALUES ('" + CCode[i] + "' , " + CPrice[i] + ", SYSTIMESTAMP )"; SQL_P = "OPTION_DATA (O_CODE, O_VALUE, O_TIME) VALUES ('" + PCode[i] + "' , " + PPrice[i] + ", SYSTIMESTAMP )"; DataBase1.In$ert(SQL_C); DataBase1.In$ert(SQL_P); } } } 즐거운 하루되세요 > inko 님이 쓴 글입니다. > 제목 : 옵션데이타 데이타베이스 저장 > 옵션 데이타를 개인데이타 베이스에 저장하려 합니다. 아래와 같이 수식을 만들었는데 장시작시 부터 장 종료시까지만 데이타를 등록하고자 하려면 무엇을 추가해야 할까요 ? var CCode = new Array(101); var PCode = new Array(101); var CPrice = new Array(101); var PPrice = new Array(101); var SQL_C; var SQL_P; function Main_OnStart() { for(var i = -50; i <= 50; i++) { CCode[50+i] = Option.GetATMCallRecent(i); PCode[50+i] = Option.GetATMPutRecent(i); Main.ReqMarketData(CCode[50+i], 1,0); Main.ReqMarketData(PCode[50+i], 1,0); } Main.SetTimer(1, 60 * 1000); } function Main_OnTimer(nEventID) { if (nEventID == 1) { for(var i = 0; i <= 100; i++) { CPrice[i] = Option.GetCurrentByCode(CCode[i]); PPrice[i] = Option.GetCurrentByCode(PCode[i]); SQL_C = "OPTION_DATA (O_CODE, O_VALUE, O_TIME) VALUES ('" + CCode[i] + "' , " + CPrice[i] + ", SYSTIMESTAMP )"; SQL_P = "OPTION_DATA (O_CODE, O_VALUE, O_TIME) VALUES ('" + PCode[i] + "' , " + PPrice[i] + ", SYSTIMESTAMP )"; DataBase1.In$ert(SQL_C); DataBase1.In$ert(SQL_P); } } }