Can not update streaming chart in custom streaming provider
Author: puciwei
Creation Date: 10/20/2015 8:11 PM
profile picture

puciwei

#1
Hello every body
I want to display realtime 1 minute bars on streaming chart,and use that 1 minute bars to drive trade strategy.
I have wrote one streaming provider and one static provider, streaming provider can update quotes window successfully,static provider can show some 1 minute bars on chart window.but when i click "Stream" button right bottom , it has some problems:
1. It seems that "RequestData" method of my static provider is called with Daily scale even current chart window is on minute scale.
2. Chart windows is not updated, while "UpdateQuote" method is called constantly , chart windows has no change, even "ghost bar" is not displayed.

Below is my code ,do i miss something?

CODE:
Please log in to see this code.


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

CODE:
Please log in to see this code.


EDIT: Excessive code edited out by Eugene
profile picture

Eugene

#2
Hi,
QUOTE:
1. It seems that "RequestData" method of my static provider is called with Daily scale even current chart window is on minute scale.


Please rewrite your SupportsDynamicUpdate method as follows:
CODE:
Please log in to see this code.


QUOTE:
2. Chart windows is not updated, while "UpdateQuote" method is called constantly , chart windows has no change, even "ghost bar" is not displayed.

Streaming quotes are not updated because the ctpUpdate() method is not used. It's called only once during initialization whereas the idea is to call it periodically or eventually (on subscription basis). For example, you might want to check the Google streaming provider's source code, namely its Updater() routine.
profile picture

puciwei

#3
My provider working now, Thank you Eugene !
I'm now run into another problem: when quote data is between 13:00 --14:00,chart window is updated as expected, when quote data is between 21:00 --22:00 ,chart windows displays "ghost bar" , no new 1 minute bar generated.
I guess it is because 21:00--22:00 is not "market hours" of wealth lab.
To market i will trade in ,market hours is "9:00-11:30","13:30-15:00","21:00-1:00", how should i set this in wealth lab?

profile picture

Eugene

#4
Your understanding is correct. Streaming quotes work during the U.S. market hours (9:30am-4pm) because stock symbols are treated as U.S. equities by default. Multiple market/timezone support is realized by implementing the GetMarketInfo property in your provider(s) as documented here or here.

And while you're at it, I also recommend to implement support for the Market Manager in your static and/or streaming data provider and enjoy the benefits it provides i.e. ability to define custom market hours, to hide pre/after-market data, etc.:

Supporting Market Manager in Custom Data Providers
profile picture

puciwei

#5
It seems that if i set time range as 21:00:00--1:00:00, data between 21:00:00 and 22:00:00 is filtered.and there is only one time range can be set for one market.
1 How can i set time range 21:00:00--1:00:00 in market manager ?
2 How can i set more than one time range for one market?

Should i just set both open time and close time as 00:00:00 ?
profile picture

Eugene

#6
1 - You can not set a time range like 21:00:00--1:00:00.
2 - Only one time range can be set for a market group.

You can leave both times as 00:00:00 if you want round-the-clock trading (i.e. the market never closes).
profile picture

puciwei

#7
QUOTE:

You can leave both times as 00:00:00 if you want round-the-clock trading (i.e. the market never closes).

Ok. I think now i can trade in real market with wealth lab.
Thank you !
profile picture

Eugene

#8
Glad to have helped.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).