That probably depends on your definition of that. But see
And there are people listing backtrader as a skill in freelancing platforms:
And in other platforms like Codementor, Freelancer. Some of the offers seen are gathered here:
Backtrader - References - Job Offers- https://www.backtrader.com/home/references/jobs/
Browsing some of them may give you and idea as how to post a project on one of the hire-for-pay sites.
You also have several listing backtrader as a skill in LinkedIn
Backtrader - References - LinkedIn - https://www.backtrader.com/home/references/linkedin/
They may be open to be contacted ... or not.
How do you access the attribute values out of _trades? I've tried this:
for k, v in self._trades.items():
and get this error:
AttributeError: 'Lines_LineSeries_DataSeries_OHLC_OHLCDateTime_Abst' object has no attribute 'tradeid'
Just to be clear, what have you exactly found?
The signature for addstrategy and optstrategy is clear an documented. It taks *args and *kwargs and where possible some of the keyword arguments are incorporated to the declarative built-in params (see below). The rest is given verbatim to the strategy.
Docs - Cerebro - https://www.backtrader.com/docu/cerebro/
Note: you probably didn't want to use addstrategy in your last post, given that you obviously pass a combination of parameters meant for optimization.
@lampalork said in Dynamic parameters passed to cerebro.optstrategy():
For addstrategy(), I'm using something like
where parameters is a dictionary that is received by the __init__ method of my strategy
def __init__(self, params):
That pattern for example goes against the declarative params provided as a built-in by backtrader and brings absolutely no benefit.
Docs - Concepts - Parameters - https://www.backtrader.com/docu/concepts/#parameters
Try this (not tested)
if self.openinterest == 2:
self.order_target_value(target = -100)
if self.openinterest == 1:
self.order_target_value(target = 100)
But with all my respect, you may want to apply more efforts to understand docs and programming by yourself, if you want to get to success faster. This was probably easiest task from what you can expect on algotrading road.
Thanks for your reply. What you say makes sense and I will use the trading calendar feature. But just to make sure I understand the behavior correctly, let's look at the duplicate timestamp of 2018-02-09 shown in my first post above.
2018-02-09 is a Friday. So the the backtrader resampling mechanism creates a daily bar at the end of the day 2018-02-09. At this point it cannot know whether trading might continue on the weekend so it basically looks at the days 2018-02-10 and 2018-02-11. It cannot find that data, so it produces a weekly bar with the timestamp 2018-02-09 in a separate call to next().
Am I assuming correctly that backtrader assumes by default that a week is ending on Sunday if nothing else is specified in terms of trading calendars?
Also in the above code you see that I am using two resampled data feeds but NOT the original data feed. If I am using the original data feed together with one resampled data feed this alignment problem does not seem to happen. I understand that you may need more information to give an answer to this but maybe it's obvious and I am missing something.
I will continue to post any issues with web-content here, then.
While your response was pending (re: my non-thread question), I was coming to the same conclusion that I was abusing the class, and had moved some temporal functions back up to strategy-level in order to overcome the absence of inherited time-context, the rationale for which I understand.
With the ability to call
from up there if I want to see it plotted, I think I have all I need.
Thanks for the notes and for caring enough to update the minor typos:
"How infinitessimal is the importance of anything I do.
How infinitely important it is that I do it."
(approximately Voltaire, but likely slightly mis-quoted, from memory)