COCO研究院

 找回密碼
 註冊
搜索
查看: 3197|回復: 4

[教學] 請問 data plugin 的寫法

[複製鏈接]
發表於 17-4-8 22:03 | 顯示全部樓層 |閱讀模式
我在 data plugin 的說明中有看到這一段

---------------------------------------------------------------------
In the second case (remote sources) quotes have to be retrieved in asynchronous   way. When GetQuotesEx() function is called for the first   time, request for new data has to be send to the data source. As data from   remote     source arrive usually after a few seconds (or more) we can not   block calling application (AmiBroker). Instead control should be returned to   AmiBroker. Depending on architecture of your data source you should either  setup   a window or another thread that will wait for the message sent back by the  data  source when data is ready. When such message is received the plugin should  send   WM_USER_STREAMING_UPDATE message that will nofity AmiBroker that it should  ask  for quotes. In the response to this message AmiBroker will call GetQuotesEx()   function again. This time you should fill Quotation array with the data you   received from remote source. To avoid repeated requests for historical intraday    data, once it is retrieved, real-time plugins begin to collect streaming time/sales   data and build-up intraday bars. Each successive GetQuotesEx()   call receives bars that were build-up inside plugin from streaming upates.  This  mode of operation is used by eSignal and myTrack real-time plugins.

---------------------------------------------------

請問要如何 send message to AmiBroker

發表於 17-4-10 10:10 | 顯示全部樓層
因為GetQuotesEx()是寫在dll裡面
看你的資料來源是哪裡才要決定是否使用WM_USER_STREAMING_UPDATE
AmiBroker會去call GetQuotesEx(),你的資料要等遠端的伺服器傳資料,假設要等一分鐘,因為AmiBroker執行到GetQuotesEx(),主畫面就會很像當機一樣不能動,所以就要使用thread,把GetQuotesEx可以有回傳值,AmiBroker才可以繼續操作
 樓主| 發表於 17-4-10 11:03 | 顯示全部樓層
找到方法了,
在 Notify 會傳來 Amibroker 的 hwnd 值

在 SendMessgaes 中代入就可以了

::SendMessage( g_hAmiBrokerWnd, WM_USER_STREAMING_UPDATE, 0, 0 );
發表於 17-4-13 07:22 | 顯示全部樓層
你在寫什麼的 plugin?
 樓主| 發表於 17-4-13 07:51 | 顯示全部樓層
本帖最後由 kuolung 於 17-4-13 09:37 編輯

amibroker 的 realtime data plugin
目前用 群益 api 下載 k 線 元大 rtd 即時分料
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

手機版|Archiver|站長信箱|廣告洽詢|COCO研究院

GMT+8, 24-11-25 06:24

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回復 返回頂部 返回列表
理財討論網站 |