- ago
We are making BrokerAdapter, Historical Data Provider and others. Everything was ok in build 1. But now we have this issue:

GetCustomSettingsPage() doesn’t return a form with fields to be filled when we start to deal with our Historical Data Provider on Data Manager -> Historical Providers.
0
1,013
8 Replies

Reply

Bookmark

Sort
- ago
#1
And we see this form if we deal with our Streaming Provider.
0
Glitch8
 ( 12.10% )
- ago
#2
You have to override that method and return your own form.

I think it's explained on the API docs, but the easiest way is to use the ucDataProviderParameters class, which descends from CustomSettingsPanel. Or, if you want to create your own UI, derive your own.

You'd have to create a new UserControl in Visual Studio, and then change the ancestor class to CustomSettingsPanel both in the xaml and the cs file.
0
Glitch8
 ( 12.10% )
- ago
#3
Here it is in Kraken, for example, just to show that it is working in Historical Providers too.

0
- ago
#4
It worked! Just this way as on the screen. But in WL7 build 1. Doesn't work in build 6.

0
- ago
#5
We used to this code before upgrade.

CODE:
public override CustomSettingsPanel GetCustomSettingsPage() { ucDataProviderParameters dpp = new ucDataProviderParameters(); return dpp; }


it doesn't work anymore for dll-history provider (https://www.wealth-lab.com/Support/ExtensionApi/HistoricalDataProvider), but it is working for this (https://www.wealth-lab.com/Support/ExtensionApi/StreamingDataProvider).

Could you give some advice about this situation?

0
Glitch8
 ( 12.10% )
- ago
#6
I can put together a working example tomorrow.
1
Glitch8
 ( 12.10% )
- ago
#7
I realize there are some missing pieces in the documentation puzzle for this, apologies! Here is an example using our "Random" data provider from DataExtensions. In the constructor, you need to see if the Parameters were already created, and if not, create them and assign them to the Configuration string. I will update the docs to reflect this clearly.

CODE:
using WealthLab.Core; using System; using WealthLab.Data; namespace WealthLab.DataExtensions { public class RandomProvider : DataProviderBase { //constructor public RandomProvider() : base() { //this loads the saved configuration, and will assign the Parameters instances if they were already defined LoadConfig(); //if the parameter instances aren't there, it is a new install, so add them now if (Parameters.Count == 0) { Parameters.Add(new Parameter("Dummy User Name", ParameterTypes.String, "")); Parameters.Add(new Parameter("Dummy Password", ParameterTypes.Password, "")); Configuration = Parameters.Persist(); } } //this provider doesn't really require configuration, but we return yes as an example for those that do public override bool IsConfigurable => true; //it's considered configured if both "user name" and "password" have values public override bool IsConfigured { get { return Parameters[0].AsString.Trim() != "" && Parameters[1].AsString.Trim() != ""; } } //return a page for the custom settings panel, use the built-in Parameters editor page class public override CustomSettingsPanel GetCustomSettingsPage() { if (_settingsPage == null) _settingsPage = new ucDataProviderParameters(); return _settingsPage; } //any required initialization would go here public override void Initialize() { base.Initialize(); } //provider friendly name public override string Name => "Random"; //provider glyph public override System.Drawing.Bitmap Glyph => Properties.Resources.Random; //provider description public override string HelpDescription => "Returns randomized historical data for backtesting."; //provider help URL public override string HelpURL => "<a href="https://www.wealth-lab.com/extension/detail/DataExtensions" target="_blank">https://www.wealth-lab.com/extension/detail/DataExtensions</a>"; //it uses persistent storage public override bool UsesPersistentStorage => true; //supports intraday public override bool SupportsScale(HistoryScale scale) { if (scale.Scale == HistoryScales.Daily || scale.Scale == HistoryScales.Minute || scale.Scale == HistoryScales.Hour) return true; return false; } //get (randomized) history protected override BarHistory GetHistoryInternal(string symbol, HistoryScale scale, DateTime startDate, DateTime endDate, int maxBars) { //supports daily and several intraday scales bool scaleSupported = false; if (scale.Scale == HistoryScales.Daily || scale.Scale == HistoryScales.Minute || scale.Scale == HistoryScales.Hour) scaleSupported = true; if (!scaleSupported) return null; var cached = base.LoadFromStorage(symbol, scale); double lastClose = cached == null ? 0 : cached.Close[cached.Close.Count - 1]; RandomClient rc = new RandomClient(); BarHistory bh = rc.CreateHistory(symbol, scale, startDate, lastClose, RandomizationMethod.Default); return bh; } //private variables private ucDataProviderParameters _settingsPage = null; } }
3
- ago
#8
Thanks, Glitch!
0

Reply

Bookmark

Sort