コード例 #1
0
ファイル: quandl.py プロジェクト: willwynne76/catalyst
        )


    def _format_wiki_url(self,
                         api_key,
                         symbol,
                         start_date,
                         end_date,
                         data_frequency):
        """
        Build a query URL for a quandl WIKI dataset.
        """
        query_params = [
            ('start_date', start_date.strftime('%Y-%m-%d')),
            ('end_date', end_date.strftime('%Y-%m-%d')),
            ('order', 'asc'),
        ]
        if api_key is not None:
            query_params = [('api_key', api_key)] + query_params

        return (
            "https://www.quandl.com/api/v3/datasets/WIKI/"
            "{symbol}.csv?{query}".format(
                symbol=symbol,
                query=urlencode(query_params),
            )
        )

register_calendar_alias('QUANDL', 'NYSE')
register_bundle(QuandlBundle)
コード例 #2
0
        query_params = [
            ('command', 'returnChartData'),
            ('currencyPair', symbol),
            ('start', start_date.value / 10**9),
            ('end', end_date.value / 10**9),
            ('period', period),
        ]
            
        return self._format_polo_query(query_params)
    
    def _format_polo_query(self, query_params):
        return 'https://poloniex.com/public?{query}'.format(
            query=urlencode(query_params),
        )

''' 
As a second parameter, you can pass an array of currency pairs 
that will be processed as an asset_filter to only process that 
subset of assets in the bundle, such as:
register_bundle(PoloniexBundle, ['USDT_BTC',])

For a production environment make sure to use (to bundle all pairs):
register_bundle(PoloniexBundle)
'''

if 'ingest' in sys.argv and '-c' in sys.argv:
    register_bundle(PoloniexBundle)
else:
    register_bundle(PoloniexBundle, create_writers=False)

コード例 #3
0
ファイル: quandl.py プロジェクト: zhoukalex/catalyst
        )

    def _format_wiki_url(self,
                         api_key,
                         symbol,
                         start_date,
                         end_date,
                         data_frequency):
        """
        Build a query URL for a quandl WIKI dataset.
        """
        query_params = [
            ('start_date', start_date.strftime('%Y-%m-%d')),
            ('end_date', end_date.strftime('%Y-%m-%d')),
            ('order', 'asc'),
        ]
        if api_key is not None:
            query_params = [('api_key', api_key)] + query_params

        return (
            "https://www.quandl.com/api/v3/datasets/WIKI/"
            "{symbol}.csv?{query}".format(
                symbol=symbol,
                query=urlencode(query_params),
            )
        )


register_calendar_alias('QUANDL', 'NYSE')
register_bundle(QuandlBundle)
コード例 #4
0
ファイル: poloniex.py プロジェクト: dawtips/catalyst
        try:
            period = period_map[data_frequency]
        except KeyError:
            return None

        query_params = [
            ('command', 'returnChartData'),
            ('currencyPair', symbol),
            ('start', start_date.value / 10**9),
            ('end', end_date.value / 10**9),
            ('period', period),
        ]

        return self._format_polo_query(query_params)

    def _format_polo_query(self, query_params):
        return 'https://poloniex.com/public?{query}'.format(
            query=urlencode(query_params), )


''' 
As a second parameter, you can pass an array of currency pairs 
that will be processed as an asset_filter to only process that 
subset of assets in the bundle, such as:
register_bundle(PoloniexBundle, ['USDT_BTC',])

For a production environment make sure to use (to bundle all pairs):
register_bundle(PoloniexBundle)
'''
register_bundle(PoloniexBundle)
コード例 #5
0
ファイル: poloniex.py プロジェクト: zhoukalex/catalyst
        query_params = [
            ('command', 'returnChartData'),
            ('currencyPair', symbol),
            ('start', start_date.value / 10**9),
            ('end', end_date.value / 10**9),
            ('period', period),
        ]

        return self._format_polo_query(query_params)

    def _format_polo_query(self, query_params):
        # TODO: got against the exchange object
        return 'https://poloniex.com/public?{query}'.format(
            query=urlencode(query_params),
        )


'''
As a second parameter, you can pass an array of currency pairs
that will be processed as an asset_filter to only process that
subset of assets in the bundle, such as:
register_bundle(PoloniexBundle, ['USDT_BTC',])

For a production environment make sure to use (to bundle all pairs):
register_bundle(PoloniexBundle)
'''
if 'ingest' in sys.argv and '-c' in sys.argv:
    register_bundle(PoloniexBundle)
else:
    register_bundle(PoloniexBundle, create_writers=False)
コード例 #6
0
ファイル: extension.py プロジェクト: w1r2p1/KryptoBot
from catalyst.data.bundles.core import register_bundle
from kryptobot.catalyst_extensions.bundles.binance import BinanceBundle

register_bundle(BinanceBundle)