Hello
Thank You to both of you. It helped me a lot.
Sorry for late response but finally I found reason for issue and together with your suggestion it works well :-)
thx
S.
Hello
Thank You to both of you. It helped me a lot.
Sorry for late response but finally I found reason for issue and together with your suggestion it works well :-)
thx
S.
@rudolph0strange
Does coinigy provide algo-trading?
to be specific: is it possible that coinigy will make and limit orders for me (on bittrex) according to my algorithm (crossing 2 Exponential Moving Averages)?
@kroitor
Wooow so ccxt is already the BIT THING :-) - congratualtions :-)
@kroitor
Hi Kroitor
do I guess it properly that You are ccxt developer? :-)
ccxt is great tool :-) I'm using it already :-)
It would be great to connect it with backtrader :-)
regards
Pawel
Hello
I'm working with ccxt and It's great tool :-). Till now I'm using it for data reading/downloading and I didn't yet use it for orders management but using it would help us a lot :-)
I think we should 1st check what's already there - not to do double work. Maybe not only ccxt could be used and speed up our work.
Pawel
Hello
I didn't ... but I'm looking for similar goal. If it's not existing yet - I'm open to cooperate to make it happen.
regards
Silverbald
Hello
Question: how can I get value of actual limit of bt.Order.StopTrail (and bt.Order.Limit)?
Goal: I want to plot actual limit of bt.Order.StopTrail (and bt.Order.Limit) - to see on the plot how it is changing during time.
Details:
I open bracket orders:
os=self.buy_bracket(stopexec=bt.Order.Limit, stopprice=stopprice1,
limitexec=bt.Order.StopTrail, limitargs=dict(trailpercent=trailpercent1))
and to make plot I use observer:
class obsSellSLTS(bt.Observer):
lines = ('StopLoss', 'TrailStop')
plotinfo = dict(plot=True, subplot=False)
plotlines = dict(
StopLoss=dict(color='lime'),
TrailStop=dict(color='gold')
)
def next(self):
if len(self._owner.broker.orders)==3: #checking if bracket order is set
if self._owner.broker.orders[1].created.pricelimit is not None:
self.lines.StopLoss[0] = self._owner.broker.orders[1].created.pricelimit
if self._owner.broker.orders[2].created.pricelimit is not None:
self.lines.TrailStop[0] = self._owner.broker.orders[2].created.pricelimit
but looks like ' self._owner.broker.orders[2].created.pricelimit' is not the right data
So: which data should I use:
self._owner.broker.orders[2].created.pclose,
self._owner.broker.orders[2].created.plimit,
self._owner.broker.orders[2].created.price,
self._owner.broker.orders[2].created.pricelimit,
or from 'executed'
self._owner.broker.orders[2].executed.pclose,
self._owner.broker.orders[2].executed.plimit,
self._owner.broker.orders[2].executed.price,
self._owner.broker.orders[2].executed.pricelimit,
or in any other source?
kind regards
Pawel
Wooow :-)
great thanks - it's amazing how quick You are with your help :-)
I'll read community FAQ once more :-)
grat thanks :-)
regards
Pawel
Hello
I have problem with resampledata.
My original data is 5minutes data
my problem / question is: how to make resampling 5 minutes data to 1day data???
Code below shows problem
adddata: data length=2142
resampledata-days: data length=2142
resampledata-weeks: data length=5
Code to generate problem:
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import backtrader as bt
import urllib.request
dataurl='https://raw.githubusercontent.com/mementum/backtrader/master/datas/2006-min-005.txt'
datapath='tmpfile.txt'
urllib.request.urlretrieve(dataurl,datapath)
def test(type):
cerebro = bt.Cerebro(stdstats=False)
cerebro.addstrategy(bt.Strategy)
data = bt.feeds.GenericCSVData(
dataname=datapath,
nullvalue=0.0,
dtformat=('%Y-%m-%d'),
tmformat=('%H:%M:%S'),
datetime=0,
time=1,
open=2,
high=3,
low=4,
close=5,
volume=6,
openinterest=-1
)
if type=='adddata': cerebro.adddata(data)
if type=='resampledata-days': cerebro.resampledata(data, timeframe=bt.TimeFrame.Days)
if type=='resampledata-weeks': cerebro.resampledata(data, timeframe=bt.TimeFrame.Weeks)
r1=cerebro.run()
cerebro.plot(style='candle', savefig=True, figfilename='{}.png'.format(type))
print('{}: data length={}'.format(type, r1[0].data_datetime.lencount))
test('adddata')
test('resampledata-days')
test('resampledata-weeks')
adddata - 5 minutes data
resampledata-days - 5 minutes data resampled to 1-day data (should be different than 5 minutes data)
resampledata-days - 5 minutes data resampled to 1-week data (it is different than 5 minutes data)
all suggestions are more than welcome :-)
kind regards
Pawel
Hello
Looks like it's my mistake. I've wrongly assumed that it's rounding currency calculations to 2 decimal places - but it's not.
I've corrected numbers format printing and it's OK.
So thank You for inspirational question.
And I'm sorry for bothering with simple problem.
kind regards
silverbald
Hello
I'm wokring on backtrading on cryptocurrency market and most of cryptocurrencies do have much more than 2 decimal places (in most cases 6-10 decimal places).
How can I set more (i.e. 8 ) decimal places for backtrader?
kind regards
Silverbald