Creating Bars/Positions for unit tests
Author: jecjackal
Creation Date: 5/12/2019 4:46 PM
profile picture

jecjackal

#1
I have a some code I am trying to write unit tests for. Creating DataSeries with test data is easy, but I have not found a way to create Bars or Positions with test data. I can create a Bars object with its constructor, but I don't see a way to create a Bars object with me specifying the values for the OHLC DataSeries. I am have a similar issue with Position. These tests are for a custom PosSizer I wrote.

Does anyone have a solution for unit testing code that depends upon specific values found in a Bars object or Position? Any help will be appreciated. Thanks in advance,

Jec
profile picture

Eugene

#2
Inserting a custom Position object into Wealth-Lab's Positions collection will not work out if you're after that.

On how to create a Bars object and specify the values for the OHLC DataSeries, see the QuickRef for Bars object > SaveToFile example.
profile picture

jecjackal

#3
Thanks Eugene. I think that is exactly what I needed.
profile picture

Eugene

#4
You're welcome.
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).