A strategy that touches two distinct sources of DB?


I am working on a strategy that interacts with the sids in EDI source and IBKR source - It reads index indicator from EDI source and trades the forex sids from the IBKR source.

Zipline seems to limit a strategy to a single bundle, which can be created from a DB which as I understand can not mix the EDI and IBKR sources.

Similarly moonshoot seems to pick a single DB.

Would there a recommended resolution to my situation?

Thank you.

Moonshot can use multiple dbs by specifying a list of dbs. If the dbs have different fieldnames, specify the combined set of desired fields:

class MyStrategy(Moonshot):

    DB = ['my-db-1', 'my-db-2']
    DB_FIELDS = ['some-field-from-db1', 'some-field-from-db2', 'some-field-from-both-dbs']

Moonshot uses get_prices to query data so you can consult the API reference for that function (and experiment with it interactively for testing); Moonshot attributes prefixed with DB_ correspond to parameters to get_prices (e.g. DB_FIELDS corresponds to fields).

Zipline bundles can also point to multiple dbs (API Reference) but the field names must be the same in both databases. More importantly for your situation, Zipline supports equities and futures but not FX, so Moonshot would be the way to go here.

1 Like