I have the following code snippet (from part of a Class):
def __init__(self):
self.data_end = self.datas[0].end
self.data_start = self.datas[0].start
Then, the following code:
def next_trans(self):
if not self.position:
if self.buy_signal > 0:
size = int(self.getcash() / self.datas[0].start)
self.log(f'BUY - Size: {size}, Cash: {self.getcash():.2f}, Start: {self.data_start[0]}, End: {self.data_end[0]}')
self.start(size=size)
The problem I have is that the "Start" and "End" values are printing as long floating point numbers (e.g. 89.12999725341797).
I tried various ways to use round(), but with no success. I get errors such as:
AttributeError: 'LineBuffer' object has no attribute 'round'
and
TypeError: type LineBuffer doesn't define __round__ method
How do I round the output to two decimal places (e.g. 89.13)?
Thanks in advance!