def get_client(exchange, authkeys=None):
    key = None
    secret = None
    if authkeys is not None:
        try:
            key = codecs.decode(authkeys[exchange]['API_KEY'], 'rot_13')
            secret = codecs.decode(authkeys[exchange]['API_SECRET'], 'rot_13')
        except:
            pass
    if exchange.lower() == 'surbtc':
        return SURBTC.Standard(key=key, secret=secret)
    elif exchange.lower() == 'kraken':
        return Kraken.Standard(key=key, secret=secret)
    elif exchange.lower() == 'bitfinex':
        return Bitfinex.Standard(key=key, secret=secret)
    elif exchange.lower() == 'cryptomkt':
        return CryptoMKT.Standard()
    else:
        raise
def main():
    since = get_since(data_file_name)
    kraken = Kraken.Public()

    while True:
        logger.info("Starting iteration.")

        config = load_config()

        raw_data = pd.concat([
            get_data(kraken, pair, config["interval"], since)
            for pair in config["pairs"]
        ])
        data = transform_data(raw_data)
        append_data(data, data_file_name)

        since = update_since(data)

        logger.info(
            f"Finished iteration and sleeping for {config['sleep_period'] / 3600} hours."
        )
        sleep(config["sleep_period"])
Exemple #3
0
 def setUp(self):
     self.client = Kraken.Auth(API_KEY, API_SECRET)
Exemple #4
0
 def setUp(self):
     self.client = Kraken.Public()
Exemple #5
0
 def client(self) -> Kraken.Auth:
     self.check_credentials()
     return Kraken.Auth(**self.credentials, **self.client_params)
Exemple #6
0
 def client(self) -> Kraken.Public:
     return Kraken.Public(**self.client_params)