SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Wed Aug 12, 2020 8:44 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 14 posts ] 
Author Message
PostPosted: Thu Nov 10, 2011 12:45 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 362
Hi,

it would be nice if you could define a list of generic provider errors to return on the call to DataManager.GetHistoricalBars.

Of course those errors may be handled in the provider itself but the code would be much cleaner if the strategy deals with those.

I have in mind such errors like:

FAILED_TO_CONNECT
NO_DATA_AVAILABLE
etc.

Thanks,
Ed


Top
 Profile  
 
PostPosted: Thu Nov 10, 2011 12:47 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
I believe all providers simply propagate native broker/md provider API errors, which is quite logical I think


Top
 Profile  
 
PostPosted: Thu Nov 10, 2011 1:10 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 362
Well, then how do I get this error in the code? Today we call:


BarSeries updateBars = DataManager.GetHistoricalBars(...);

if (updateBars.Count <= 0) ... error.

But what is the provider error? Where is it? I hope you are not talking about synchronization with OnProviderError...

BTW - we use that GetHistoricalBars call in scenario so the provider errors are not fired up yet.

thanks
Ed


Top
 Profile  
 
PostPosted: Thu Nov 10, 2011 1:22 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
Are you using GetHistoricalBars with local db or with an external data provider?


Top
 Profile  
 
PostPosted: Thu Nov 10, 2011 1:31 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 362
We have built our own provider for EODData. it uses EmitError and EmitHistoricalDataError calls when encounters any errors in provider.

Ed


Top
 Profile  
 
PostPosted: Thu Nov 10, 2011 4:11 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
OK, and what is the problem ? You don't see errors that you emit in your custom provider in OQ provider error window or?


Top
 Profile  
 
PostPosted: Thu Nov 10, 2011 4:20 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 362
Anton,

We would like to get the provider error in the code that calls GetHistoricalBars. We don't need the errors in provider error window - just in our code so we can handle them accordingly.

Thanks
Ed


Top
 Profile  
 
PostPosted: Thu Nov 10, 2011 4:38 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
You can catch it in OnError handler.


Top
 Profile  
 
PostPosted: Thu Nov 10, 2011 4:50 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 362
Nope.

First - the call to GetHistoricalBars is in Scenario, not in the strategy (no OnError yet). Second - because of this I need to build a whole synchronization system - like call GetHistoricalBars, then wait for event from OnError. It is not worth it. I just wanted to know if the call to provider for historical bars failed and why. If it fails because of networking issues, I'll wait and retry. If it fails because no such symbol or no data i would merely iterate to the next instrument.

Anyway - that is the reason I write this in New Features Requests forum. We can live without it but such error would make our code more efficient.

Thanks
Ed


Top
 Profile  
 
PostPosted: Thu Nov 10, 2011 5:11 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
Have to think about it. I am not sure I know where to put this error info. The function itself returns a bar series. Adding something like GetHistoricalBars(..., out error) is not very nice but possible.


Top
 Profile  
 
PostPosted: Thu Nov 10, 2011 5:26 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 362
Frankly, neither I like the (..., out error). First I thought something like GetLastProviderError, but it is a bad idea, especially in a multi-thread environment. Maybe the best is to add a new method, something like GetHistoricalBarsExt that returns a structure with bars and error...

As I said it is not mandatory but nice to have. Today we just retry the call every time the Count is 0. This happens in any case, even for invalid symbol. Given we fetch about 5000 symbols daily it is a problem. But not so big - so if you'll find an elegant solution it is welcome. Otherwise we'll live with that.

Ed


Top
 Profile  
 
PostPosted: Fri Dec 02, 2011 10:30 am 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 362
Hi,

I think I have a reasonably good solution to this. We can define negative numbers as error codes in the return for the method.

So if the result it greater than zero then it means number of bars. Otherwise it is an error code.

Possible error codes:

ERROR_CODE_BASE = -10000;

INVALID_INSTRUMENT = ERROR_CODE_BASE - 1
NO_DATA_AVAILABLE = ERROR_CODE_BASE - 2
PROVIDER_AUTHENTICATION_ERROR = ERROR_CODE_BASE - 3
PROVIDER_TIMEOUT = ERROR_CODE_BASE - 4

What do you think?
Ed


Top
 Profile  
 
PostPosted: Fri Dec 02, 2011 10:49 am 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
GetHistoricalBars(...) returns bar series, not a number of bars...


Top
 Profile  
 
PostPosted: Fri Dec 02, 2011 12:03 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 362
Sorry, you are right. my mistake.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group