Skip to content

Commit

Permalink
moved the config module inside the zipline folder
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomiku committed Mar 20, 2021
1 parent 36bbc6b commit 7132b23
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 19 deletions.
1 change: 0 additions & 1 deletion config/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions zipline/config/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from zipline.config import bundle
File renamed without changes.
File renamed without changes.
10 changes: 3 additions & 7 deletions zipline/data/bundles/alpaca_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,18 @@
import alpaca_trade_api as tradeapi
from datetime import timedelta, time as dtime
import numpy as np
from os.path import join
from pathlib import Path
import pandas as pd
import pytz
from alpaca_trade_api.common import URL
from dateutil import tz
from trading_calendars import TradingCalendar

import config
import zipline.config
from zipline.data.bundles import core as bundles
from zipline.data.bundles.common import asset_to_sid_map
from zipline.data.bundles.universe import Universe, all_alpaca_assets, get_sp500, get_sp100, get_nasdaq100
from dateutil.parser import parse as date_parse
from zipline.errors import SymbolNotFound, SidsNotFound
from datetime import date


user_home = str(Path.home())

Expand All @@ -27,7 +23,7 @@

def initialize_client():
global CLIENT
conf = config.bundle.AlpacaConfig()
conf = zipline.config.bundle.AlpacaConfig()
key = conf.key
secret = conf.secret
base_url = conf.base_url
Expand All @@ -39,7 +35,7 @@ def initialize_client():
def list_assets():
global ASSETS
if not ASSETS:
conf = config.bundle.AlpacaConfig()
conf = zipline.config.bundle.AlpacaConfig()
custom_asset_list = conf.custom_asset_list
if custom_asset_list:
custom_asset_list = custom_asset_list.strip().replace(" ", "").split(",")
Expand Down
6 changes: 2 additions & 4 deletions zipline/data/bundles/alpha_vantage_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

from ratelimit import limits, sleep_and_retry

import config
import zipline.config
from zipline.data.bundles import core as bundles
from zipline.data.bundles.common import asset_to_sid_map
from zipline.data.bundles.universe import Universe, get_sp500, get_sp100, get_nasdaq100, all_alpaca_assets
Expand All @@ -36,9 +36,7 @@
import os
import time

from zipline.errors import SymbolNotFound, SidsNotFound

av_config = config.bundle.AlphaVantage()
av_config = zipline.config.bundle.AlphaVantage()
AV_FREQ_SEC = av_config.sample_frequency
AV_CALLS_PER_FREQ = av_config.max_calls_per_freq
AV_TOLERANCE_SEC = av_config.breathing_space
Expand Down
8 changes: 4 additions & 4 deletions zipline/data/bundles/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ def asset_db_relative(bundle_name, timestr, db_version=None):


def external_db_path(bundle_name, environ):
import config.data_backend
import zipline.config.data_backend
path = None
if config.data_backend.db_backend_configured():
if config.data_backend.db_backend_configured() == 'postgres':
db = config.data_backend.PostgresDB()
if zipline.config.data_backend.db_backend_configured():
if zipline.config.data_backend.db_backend_configured() == 'postgres':
db = zipline.config.data_backend.PostgresDB()
host = db.host
port = db.port
user = db.user
Expand Down
6 changes: 3 additions & 3 deletions zipline/data/psql_daily_bars.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import psycopg2
import sqlalchemy as sa

import config.data_backend
import zipline.config.data_backend
from zipline.utils.db_utils import check_and_create_engine
import pandas as pd

Expand All @@ -43,7 +43,7 @@
)
from zipline.utils.functional import apply
from zipline.utils.input_validation import expect_element
from zipline.utils.numpy_utils import iNaT, float64_dtype, uint32_dtype
from zipline.utils.numpy_utils import float64_dtype
from zipline.utils.memoize import lazyval
from zipline.utils.cli import maybe_show_progress
from ._equities import _compute_row_slices, _read_tape_data
Expand Down Expand Up @@ -530,7 +530,7 @@ def ensure_database(self, db_path):
create the bundle database. it will have the name of the bundle
:param db_path: expected db path (table). used to get the bundle name.
"""
db_config = config.data_backend.PostgresDB()
db_config = zipline.config.data_backend.PostgresDB()
host = db_config.host
port = db_config.port
user = db_config.user
Expand Down

0 comments on commit 7132b23

Please sign in to comment.