Charts & TradeID
-
-
Are only completed trades shown in the chart? (i.e. open positions don't show?)
-
Currently, I am passing a tradeid (generated by str(uuid.uuid4())[:8]) to every order, so that I can keep references to them in an internal dict. If order is long, i would call self.sell(tradeid=some_tradeid). I've noticed in other forum posts that this isn't how people close out their positions. Is my understanding incorrect?
-
-
@Taewoo-Kim said in Charts & TradeID:
- Are only completed trades shown in the chart? (i.e. open positions don't show?)
Yes
- Currently, I am passing a tradeid (generated by str(uuid.uuid4())[:8]) to every order, so that I can keep references to them in an internal dict. If order is long, i would call self.sell(tradeid=some_tradeid). I've noticed in other forum posts that this isn't how people close out their positions. Is my understanding incorrect?
tradeid
has no specific requirements. It is just an identifier. It would seem simpler to use something likemytradeid = itertools.counter(1)
and then usemynewtradeid = next(mytradeid)
to have a unique reference which is a lot more palatable for human consumption. But anytradeid
will actually do.If you use the
tradeid
and want to undo abuy(tradeid=x)
, you should either dosell(tradeid=x)
. Of coursesell
doesn't guarantee you close a position unless you specifiy the samesize
or have a sizer that does it for you. You may also useclose(tradeid=x
), because
close` calculates the right size for you.