Пример #1
0
def _get_db_trade_database_source():
    database_source_list = []
    test_harness_trade_database_list = []
    test_harness_trade_data_store_list = []

    if run_ms_sql_server_tests:
        database_source_list.append(DatabaseSourceMSSQLServer())
        test_harness_trade_database_list.append(
            test_harness_ms_sql_server_trade_data_database)
        test_harness_trade_data_store_list.append(
            test_harness_ms_sql_server_trade_data_store)

    if run_mysql_server_tests:
        database_source_list.append(DatabaseSourceMySQL())
        test_harness_trade_database_list.append(
            test_harness_mysql_trade_data_database)
        test_harness_trade_data_store_list.append(
            test_harness_mysql_trade_data_store)

    if run_sqlite_server_tests:
        database_source_list.append(DatabaseSourceSQLite())
        test_harness_trade_database_list.append(
            test_harness_sqlite_trade_data_database)
        test_harness_trade_data_store_list.append(
            test_harness_sqlite_trade_data_store)

    return database_source_list, test_harness_trade_database_list, test_harness_trade_data_store_list
Пример #2
0
def fill_market_trade_databases():
    """Fills market and trade data with test data
    """
    Mediator.get_volatile_cache().clear_cache()

    replace_append = 'replace'

    # Fill market data (assume: CHUNK_STORE as our default format!)
    for ticker in ticker_arctic:
        database_source = DatabaseSourceArctic(postfix='testharness',
                                               arctic_lib_type=arctic_lib_type)

        # Write CSV to Arctic
        database_source.convert_csv_to_table(csv_market_data_store,
                                             ticker,
                                             market_data_table,
                                             if_exists_table=replace_append,
                                             if_exists_ticker='replace',
                                             market_trade_data='market',
                                             remove_duplicates=False)

        replace_append = 'append'

    # Fill trade/order data
    database_source = DatabaseSourceMySQL()

    for t in trade_order_list:
        # Dump trade_df to SQL test harness database and overwrite
        database_source.convert_csv_to_table(
            csv_trade_order_mapping[t],
            None, (trade_order_mapping[trade_data_store])[t],
            database_name=trade_data_database_name,
            if_exists_table='replace',
            market_trade_data='trade')
Пример #3
0
    def __init__(self,
                 market_data_postfix='dukascopy',
                 csv_market_data=None,
                 write_to_db=True,
                 sql_trade_database_type='ms_sql_server'):
        if csv_market_data is None:
            self._market_data_source = 'arctic-' + market_data_postfix
        else:
            self._market_data_source = csv_market_data

        self._tca_market = Mediator.get_tca_market_trade_loader()

        # Assumes MongoDB for tick data and MSSQL for trade/order data
        if write_to_db:
            self._database_source_market = DatabaseSourceArctic(
                postfix=market_data_postfix)  # market data source

            self._market_data_database_name = constants.arctic_market_data_database_name
            self._market_data_database_table = constants.arctic_market_data_database_table

            if sql_trade_database_type == 'ms_sql_server':
                self._database_source_trade = DatabaseSourceMSSQLServer(
                )  # trade data source
                self._trade_data_database_name = constants.ms_sql_server_trade_data_database_name
            elif sql_trade_database_type == 'mysql':
                self._database_source_trade = DatabaseSourceMySQL(
                )  # trade data source
                self._trade_data_database_name = constants.mysql_trade_data_database_name

        self.time_series_ops = TimeSeriesOps()
        self.rand_time_series = RandomiseTimeSeries()