 |
W-Man
初級會員
註冊日期: Jan 2016
來 自: 中部
文章數量: 7 |
|
每秒記錄一筆文字檔
請教版主大大:
要如何在時間有變動時,才記錄一筆資料進文字檔^^?
我的程式是有成交時就記錄:如下
CC1:C;
VarNow:=NUMTOSTR(currenttime,0);
Clo:= NUMTOSTR(CC1,1);
產品字串:=STKNAME;
<%
on error resume next
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fs, wrkfs
vPP = FFL.VarData("Clo")
vNowTime = FFL.VarData("VarNow")
Report = FFL.VarData("產品字串")
Report = Report + "," + vPP
if (1) then
Report = vNowTime + "," + Report
Set fs = CreateObject("Scripting.FileSystemObject")
Set wrkfs = fs.OpenTextFile("d:\temp\tttt.csv",ForAppending ,TRUE)
wrkfs.WriteLine(report)
wrkfs.close
end if
err.clear
%>
==========================
文字檔的內容
230154,日圓連續,8227.0
230154,日圓連續,8227.0
230154,日圓連續,8227.5
230155,日圓連續,8227.5
230155,日圓連續,8227.0
230156,日圓連續,8227.0
230156,日圓連續,8227.0
230156,日圓連續,8227.0
230157,日圓連續,8227.0
230157,日圓連續,8227.5
230157,日圓連續,8227.5
230158,日圓連續,8227.0
230158,日圓連續,8227.0
230158,日圓連續,8227.0
230201,日圓連續,8228.0
230201,日圓連續,8228.0
230201,日圓連續,8228.0
230202,日圓連續,8229.0
230202,日圓連續,8228.0
230204,日圓連續,8228.0
230204,日圓連續,8228.0
230205,日圓連續,8229.0
230205,日圓連續,8228.0
230206,日圓連續,8228.0
230206,日圓連續,8228.0
230207,日圓連續,8228.0
230207,日圓連續,8228.5
======================
但我想要的內容應如下:
230154,日圓連續,8227.0
230155,日圓連續,8227.5
230156,日圓連續,8227.0
230157,日圓連續,8227.0
230158,日圓連續,8227.0
230201,日圓連續,8228.0
230202,日圓連續,8229.0
230204,日圓連續,8228.0
230205,日圓連續,8229.0
230206,日圓連續,8228.0
230207,日圓連續,8228.0
謝謝!
|
|
向版主報告此篇 |  |
|
2016-01-29 23:19 |
|
|
|  |
 |
cgjj
總版主

註冊日期: Oct 2003
來 自:
文章數量: 18211 |
|
回覆: 每秒記錄一筆文字檔
引用: 最初由 W-Man 發表
請教版主大大:
要如何在時間有變動時,才記錄一筆資料進文字檔^^?
我的程式是有成交時就記錄:如下
CC1:C;
VarNow:=NUMTOSTR(currenttime,0);
Clo:= NUMTOSTR(CC1,1);
產品字串:=STKNAME;
<%
on error resume next
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fs, wrkfs
vPP = FFL.VarData("Clo")
vNowTime = FFL.VarData("VarNow")
Report = FFL.VarData("產品字串")
Report = Report + "," + vPP
if (1) then
Report = vNowTime + "," + Report
Set fs = CreateObject("Scripting.FileSystemObject")
Set wrkfs = fs.OpenTextFile("d:\temp\tttt.csv",ForAppending ,TRUE)
wrkfs.WriteLine(report)
wrkfs.close
end if
err.clear
%>
==========================
文字檔的內容
230154,日圓連續,8227.0
230154,日圓連續,8227.0
230154,日圓連續,8227.5
230155,日圓連續,8227.5
230155,日圓連續,8227.0
230156,日圓連續,8227.0
230156,日圓連續,8227.0
230156,日圓連續,8227.0
230157,日圓連續,8227.0
230157,日圓連續,8227.5
230157,日圓連續,8227.5
230158,日圓連續,8227.0
230158,日圓連續,8227.0
230158,日圓連續,8227.0
230201,日圓連續,8228.0
230201,日圓連續,8228.0
230201,日圓連續,8228.0
230202,日圓連續,8229.0
230202,日圓連續,8228.0
230204,日圓連續,8228.0
230204,日圓連續,8228.0
230205,日圓連續,8229.0
230205,日圓連續,8228.0
230206,日圓連續,8228.0
230206,日圓連續,8228.0
230207,日圓連續,8228.0
230207,日圓連續,8228.5
======================
但我想要的內容應如下:
230154,日圓連續,8227.0
230155,日圓連續,8227.5
230156,日圓連續,8227.0
230157,日圓連續,8227.0
230158,日圓連續,8227.0
230201,日圓連續,8228.0
230202,日圓連續,8229.0
230204,日圓連續,8228.0
230205,日圓連續,8229.0
230206,日圓連續,8228.0
230207,日圓連續,8228.0
謝謝!
每秒記錄一筆 <> 時間有變動才記錄
兩者是不相同的
套用於圖的公式,需有行情才會被觸發重算
所以無法固定為每秒記錄一次(可能數秒後才有交易)
一般而言,不會應用 currenttime
currenttime 是電腦當前時間,不是行情時間
currenttime 是否合用,要視您用途而定
時間有變動才記錄,這個用VBScript是可以實現的
將目前的時間與最後資料的時間做比對
若有不同才進行寫檔,如此就可以實現
|
|
向版主報告此篇 |  |
|
2016-01-30 09:22 |
|
|
|  |
 |
W-Man
初級會員
註冊日期: Jan 2016
來 自: 中部
文章數量: 7 |
|
感謝總版主的回覆:
我的表達可能不夠清楚。
一、在快市行情可能一秒內會有數十筆資料成交。但我只要求記錄一筆。^^"
二、在慢市行情,可能數秒或數分鐘才成交一筆。我也只要求在成交時才記錄。
三、最主要是避開快市時不斷的寫入文字檔。但是奇狐最小單位是秒,語法中,我不知如何寫才能表現時間差的成交資料。^^呵呵,麻煩您指導了。感恩。
|
|
向版主報告此篇 |  |
|
2016-01-30 11:06 |
|
|
|  |
 |
W-Man
初級會員
註冊日期: Jan 2016
來 自: 中部
文章數量: 7 |
|
簡單的說
就是您要把上次最終紀錄的時間,儲存起來
下回運算將其取出,與當前資料時間比對
------------------------------------------------------------
大大您的意思是:
1、要把上次最終紀錄的時間儲存在"另一個文字檔"?或者是
2、要把上次最終紀錄的時間儲存在"自設變數"?
下回運算將其取出。
有大大您的引導,很多細節都可迎刃而解。謝謝。^^
|
|
向版主報告此篇 |  |
|
2016-01-30 13:03 |
|
|
|  |
本站所有內容未經作者授權禁止轉貼節錄, 發表言論僅供參考勿作為投資決策依據。瀏覽本站請使用 IE 5.5 以上版本, 最佳瀏覽解析度 1024 x 768 全彩。
|
Powered by: vBulletin Version 2.3.0 - Copyright©2000-, Jelsoft Enterprises Limited.
簡愛洋行 製作 Copyright 2003-. All Rights Reserved. 聯絡我們
|