warren-oneill / powerline

Extension to the zipline library for the German EPEX and EEX energy markets
Other
7 stars 1 forks source link

Refactoring: store and db-views #16

Open ghost opened 9 years ago

ghost commented 9 years ago

Currently, store and db-views are imported in several Powerline modules. There should be one single module that contains all the dependencies to the other gg modules (db, messaging) to achive more loose coupling.

warren-oneill commented 9 years ago

:+1: good idea

ghost commented 8 years ago

@warren-oneill Basically, what I would like to do is:

  1. Introduce a new module for powerline that contains all dependencies from gg.database. All powerline modules requiring db access then would import store etc. from this module. The same applies to the messaging.
  2. Introduce a prefix + classname naming convention, e.g. EEXMetadata, EEXSource, EEXExchange, where not yet done in that way. EDIT: I see thats done, except for the DataGenerator class

    3. Refactor assets, exchanges and sources by introducing a simple factory pattern. E.g. you could do exch = Exchange('EEX') rather than exch = EEXExchange(). By using the naming convention in (2.) the Exchange class creates the relevant objects, i.e. acts as a factory.

I have some code and ideas for the items above I will present in our meeting on Friday.

warren-oneill commented 8 years ago

1) makes sense 2) Isn't that what I do? the only difference I can see is my prefix is not all caps. 3) whats the advantage of using this method?

ghost commented 8 years ago

@warren-oneill As we talked in our meeting, the scope of the refactoring focus on a strict separation of all db and query stuff from the exchange, metadata and source classes, including a clean use if session (see also: http://docs.sqlalchemy.org/en/latest/orm/session_basics.html#what-does-the-session-do ). Refactored code is in a separate branch.

ghost commented 8 years ago

Refactoring includes:

Still TODO: