Exemplo n.º 1
0
#

if __name__ == '__main__':

    import time

    start = time.clock()

    data_vendor = 'ncfx'

    if data_vendor == 'dukascopy':
        from tcapy.data.databasesource import DatabaseSourceDukascopy as DatabaseSource
    elif data_vendor == 'ncfx':
        from tcapy.data.databasesource import DatabaseSourceNCFX as DatabaseSource

    database_source = DatabaseSource()

    ticker = 'EURUSD'

    # df1 = database_source.fetch_market_data(start_date='02 Apr 2016 20:00', finish_date='04 Apr 2016 02:00',
    #                                         ticker=ticker)

    # Note: some data sources might only let you download a small chunk of tick data (try daily and hourly)
    df1 = database_source.fetch_market_data(start_date='05 Aug 2016 00:00', finish_date='05 Aug 2016 02:00', ticker=ticker)
    df2 = database_source.fetch_market_data(start_date='06 Aug 2019', finish_date='07 Aug 2019', ticker=ticker)
    df3 = database_source.fetch_market_data(start_date='07 Aug 2019', finish_date='08 Aug 2019', ticker=ticker)

    # Both points on a Saturday (should result in empty DataFrame)
    df4 = database_source.fetch_market_data(start_date='25 Apr 2020 00:00', finish_date='25 Apr 2020 02:00',
                                            ticker=ticker)
Exemplo n.º 2
0
# web_proxies = {
#     'http' : "http://127.0.0.1:8080",
#     'https' : "https://127.0.0.1:7000",
# }

chunk_int_min_dict = {'dukascopy' : None, 'ncfx' : 60} # number of minutes to download from data vendor (eg. 5 minutes)

########################################################################################################################
folder = Constants().test_data_harness_folder

#### Change for your data vendor
data_vendor_name_list = ['dukascopy'] # ['ncfx', 'dukascopy']

database_populator_dict = {'dukascopy' : DatabasePopulatorDukascopy(), 'ncfx' : DatabasePopulatorNCFX()}
database_source_dict = {'dukascopy' : DatabaseSourceDukascopy(), 'ncfx' : DatabaseSourceNCFX()}

if constants.ncfx_url is None and 'ncfx' in data_vendor_name_list:
    data_vendor_name_list.remove('ncfx')

if constants.ncfx_url is not None and 'ncfx' in data_vendor_name_list:
    if len(constants.ncfx_url) < 10:
        data_vendor_name_list.remove('ncfx')

invalid_start_date = '01 Jan 1999'
invalid_finish_date = '01 Feb 1999'

use_multithreading = False

def test_fetch_market_data_from_data_vendor():
    """Test the various downloaders (low level one, high level one - also with invalid dates, to test error messages)
Exemplo n.º 3
0
    'dukascopy': None,
    'ncfx': 60
}  # number of minutes to download from data vendor (eg. 5 minutes)

########################################################################################################################
folder = Constants().test_data_harness_folder

#### change for your data vendor
data_vendor_name_list = ['ncfx', 'dukascopy']

database_populator_dict = {
    'dukascopy': DatabasePopulatorDukascopy(),
    'ncfx': DatabasePopulatorNCFX()
}
database_source_dict = {
    'dukascopy': DatabaseSourceDukascopy(),
    'ncfx': DatabaseSourceNCFX()
}

if constants.ncfx_url is None:
    data_vendor_name_list.remove('ncfx')

####

trade_order_list = ['trade_df', 'order_df']

sql_trade_order_mapping = OrderedDict([
    ('trade_df',
     '[dbo].[trade]'),  # name of table which has broker messages to client
    ('order_df', '[dbo].[order]')
])  # name of table which has orders from client
Exemplo n.º 4
0
    def _get_input_data_source(self):
        from tcapy.data.databasesource import DatabaseSourceDukascopy

        return DatabaseSourceDukascopy()
Exemplo n.º 5
0
#
# Copyright 2017 Cuemacro Ltd. - http//www.cuemacro.com / @cuemacro
#
# See the License for the specific language governing permissions and limitations under the License.
#

from tcapy.data.databasesource import DatabaseSourceDukascopy as DatabaseSource

if __name__ == '__main__':

    import time

    start = time.clock()

    database_source = DatabaseSource()

    ticker = 'EURUSD'

    df1 = database_source.fetch_market_data(start_date='05 Aug 2019',
                                            finish_date='06 Aug 2019',
                                            ticker=ticker)
    df2 = database_source.fetch_market_data(start_date='06 Aug 2019',
                                            finish_date='07 Aug 2019',
                                            ticker=ticker)
    df3 = database_source.fetch_market_data(start_date='07 Aug 2019',
                                            finish_date='08 Aug 2019',
                                            ticker=ticker)

    print(df1)
    print(df2)