happydasch / btoandav20

Support for Oanda-V20 API in backtrader
Apache License 2.0
131 stars 52 forks source link

Add order.info params to oanda's clientExtensions #67

Closed josipbudzaki closed 3 years ago

josipbudzaki commented 3 years ago

This change adds the parameters from order.info to oanda's clientExtensions (v20.transaction.ClientExtensions) as comment. Therefore it's possible to access those parameters earlier in the "Backtrader Strategy". Specifically within notify_store() instead of notify_order().

josipbudzaki commented 3 years ago

Thank you! Sure, here we go:

def notify_store(self, msg, *args, **kwargs):
        if "clientExtensions" in msg:
            o_info = json.loads(msg["clientExtensions"]["comment"]