2017-12-18
TickToChart增加轉出 JSON 檔案的功能,
範例內容
JSON檔
{"CHARTDATAS":
{"TYPE":"60Min"
,"TIME":"2017-12-18 03:37:30.611 GMT"
,"CHARTDATA":"TX-201712"
,"CHARTITEMS":[
{"T":"1600",O:10533,H:10541,L:10531,C:10540,V:1593,N:722},
{"T":"1700",O:10540,H:10543,L:10537,C:10539,V:838,N:453},
{"T":"1800",O:10540,H:10540,L:10536,C:10539,V:452,N:278},
{"T":"1900",O:10539,H:10540,L:10527,C:10527,V:1071,N:668},
{"T":"2000",O:10528,H:10532,L:10525,C:10529,V:499,N:320},
{"T":"2100",O:10529,H:10534,L:10525,C:10525,V:716,N:394},
{"T":"2200",O:10525,H:10532,L:10520,C:10531,V:988,N:634},
{"T":"2300",O:10531,H:10538,L:10527,C:10534,V:1432,N:839},
{"T":"2400",O:10534,H:10538,L:10530,C:10534,V:1424,N:704},
{"T":"0100",O:10534,H:10537,L:10529,C:10533,V:985,N:593},
{"T":"0200",O:10534,H:10534,L:10525,C:10530,V:469,N:312},
{"T":"0300",O:10530,H:10531,L:10522,C:10525,V:430,N:257},
{"T":"0400",O:10526,H:10527,L:10516,C:10519,V:774,N:463},
{"T":"0500",O:10519,H:10522,L:10514,C:10514,V:664,N:357},
{"T":"0900",O:10510,H:10515,L:10502,C:10506,V:7635,N:3893},
{"T":"1000",O:10506,H:10509,L:10435,C:10453,V:63246,N:32470},
{"T":"1100",O:10453,H:10460,L:10421,C:10431,V:32185,N:15484},
{"T":"1200",O:10432,H:10444,L:10427,C:10438,V:14828,N:6332},
{"T":"1300",O:10439,H:10455,L:10433,C:10454,V:15043,N:6080},
{"T":"1400",O:10453,H:10487,L:10451,C:10485,V:29869,N:12027}
]}}
XML檔
<?xml version='1.0' encoding='utf-8' ?><QUOTES><QUOTE>
<CHARTDATA TYPE='60Min' TIME='2017-12-18 03:37:30.611 GMT'>TX-201712</CHARTDATA>
<CHARTITEM T='1600' O='10533' H='10541' L='10531' C='10540' V='1593' N='722' />
<CHARTITEM T='1700' O='10540' H='10543' L='10537' C='10539' V='838' N='453' />
<CHARTITEM T='1800' O='10540' H='10540' L='10536' C='10539' V='452' N='278' />
<CHARTITEM T='1900' O='10539' H='10540' L='10527' C='10527' V='1071' N='668' />
<CHARTITEM T='2000' O='10528' H='10532' L='10525' C='10529' V='499' N='320' />
<CHARTITEM T='2100' O='10529' H='10534' L='10525' C='10525' V='716' N='394' />
<CHARTITEM T='2200' O='10525' H='10532' L='10520' C='10531' V='988' N='634' />
<CHARTITEM T='2300' O='10531' H='10538' L='10527' C='10534' V='1432' N='839' />
<CHARTITEM T='2400' O='10534' H='10538' L='10530' C='10534' V='1424' N='704' />
<CHARTITEM T='0100' O='10534' H='10537' L='10529' C='10533' V='985' N='593' />
<CHARTITEM T='0200' O='10534' H='10534' L='10525' C='10530' V='469' N='312' />
<CHARTITEM T='0300' O='10530' H='10531' L='10522' C='10525' V='430' N='257' />
<CHARTITEM T='0400' O='10526' H='10527' L='10516' C='10519' V='774' N='463' />
<CHARTITEM T='0500' O='10519' H='10522' L='10514' C='10514' V='664' N='357' />
<CHARTITEM T='0900' O='10510' H='10515' L='10502' C='10506' V='7635' N='3893' />
<CHARTITEM T='1000' O='10506' H='10509' L='10435' C='10453' V='63246' N='32470' />
<CHARTITEM T='1100' O='10453' H='10460' L='10421' C='10431' V='32185' N='15484' />
<CHARTITEM T='1200' O='10432' H='10444' L='10427' C='10438' V='14828' N='6332' />
<CHARTITEM T='1300' O='10439' H='10455' L='10433' C='10454' V='15043' N='6080' />
<CHARTITEM T='1400' O='10453' H='10487' L='10451' C='10485' V='29869' N='12027' />
</QUOTE></QUOTES>
本次更版 XML的輸出 於CHARTDATA的描述部分 有些微調整
原本內容與TYPE屬性相同
<CHARTDATA TYPE='60Min' TIME='2017-12-18 03:37:30.611 GMT'>60Min</CHARTDATA>
新版則改用轉檔所用之主檔名替代
<CHARTDATA TYPE='60Min' TIME='2017-12-18 03:37:30.611 GMT'>TX-201712</CHARTDATA>
老實說,這類資料傳輸格式大同小異,其實JSON不一定會比較省資料量,
主要還是得看資料的編排方式, 就像上面的內容,
JSON裏的O,H,L,C,V,N和內容值如果都使用雙引號的話其實檔案還比XML大...
新版程式可由 TickToChart 轉分線規格 的文章中, 於
轉檔程式 ( 下載 ) 的下載連結中自行下載