Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

feed subscription questions
 Post subject: feed subscription questions Post rating: 0   New post Posted: Wed 07 Dec, 2011, 04:15 

User rating: 0
Joined: Tue 22 Nov, 2011, 12:47
Posts: 130
Location: United States,
hi,

Please observe the following pseudo code:

>>Strategy.onStart-->
-line1- subscribeToFeed with anonymous class containing a call back function "onBar"
-line2- wait 1000 milliseconds //wait for the subscription operation completion
-line3- load bars from history

Questions -
1. Is there a more reliable way to get a feedback of subscription status rather than wait for 1000 milli?
2. Does the onBar callback from line 2 will be called on the Strategy thread or is it spawned on a different thread?
3. How to avoid missed bars? I want to make sure that the loading from history includes all available bars including bars that arrive during the sleep operation in line 2
4. If onBar from line 1 is executing too long is it possible that the system will drop bars instead of buffering them?


 
 Post subject: Re: feed subscription questions Post rating: 0   New post Posted: Wed 07 Dec, 2011, 09:03 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
cb888trader wrote:
1. Is there a more reliable way to get a feedback of subscription status rather than wait for 1000 milli?
The subscription happens in the strategy thread, meaning that setting such waiting time in our previous example was redundant and unnecessary.
cb888trader wrote:
2. Does the onBar callback from line 2 will be called on the Strategy thread or is it spawned on a different thread?
No, this happens in the strategy thread.
cb888trader wrote:
3. How to avoid missed bars? I want to make sure that the loading from history includes all available bars including bars that arrive during the sleep operation in line 2
4. If onBar from line 1 is executing too long is it possible that the system will drop bars instead of buffering them?
Presumably the previous 2 answers clarify also those 2 questions.


 
 Post subject: Re: feed subscription questions Post rating: 0   New post Posted: Wed 07 Dec, 2011, 09:48 

User rating: 0
Joined: Tue 22 Nov, 2011, 12:47
Posts: 130
Location: United States,
Quote:
The subscription happens in the strategy thread, meaning that setting such waiting time in our previous example was redundant and unnecessary.


1. So - feed subscription is a blocking function (meaning it will continue to next line only when subscribed)?

2. Also, when processing live bars (not historical bars), is it possible to miss bars due to slow processing? (I know that ticks can be missed as explained here)


 
 Post subject: Re: feed subscription questions Post rating: 0   New post Posted: Wed 07 Dec, 2011, 13:15 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
cb888trader wrote:
1. So - feed subscription is a blocking function (meaning it will continue to next line only when subscribed)?
Yes.
cb888trader wrote:
2. Also, when processing live bars (not historical bars), is it possible to miss bars due to slow processing? (I know that ticks can be missed as explained here)
Such policy only gets applied to ticks, bars remain enqueued and wait for their sequential execution.


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com